Posts

Showing posts from March, 2015

javascript - How to keep the menu state on page reload -

i have following code snippet , wanted know if there possibility update achieving menu behaviour: step 1. on mouse hover link 1 ----> translated 1.5em right (already set); step 2. on link 1 click ----> menu button remain fixed in place @ translated position (done, special @guest271314 ) on page reload too, until new menu button clicked (not set yet) and page loaded . note: next/prev buttons code section, remain unchanged (or can edited if it's must, in order remain functional). note2: have mention in end, solution implemented in wordpress not static html sitepage. $(function () { $('nav ul li').click(function (e) { //set aesthetics (similar :hover) $('nav ul li') .not(".clicked").removeclass('hovered') .filter(this).addclass("clicked hovered") .siblings().toggleclass("clicked hovered", false); }).hover(function () { $(this).addclass(...

java - GridBagLayout not resizing on image load -

i have jframe. uses jpanel content pane, , jpanel uses gridbaglayout layoutmanager. jpanel contains 2 more items: button, , jpanel. on program start, image loaded file lowest-level jpanel bufferedimage using imageio.read(...). here goes pieces. the image loads correctly, can see small corner of on screen (14px square specified in debugger). there nothing can figure out cause layout grow , fit entire image in lowest level jpanel on screen. image in debuggers shows correct size of 500px. preferred size of cardimagepanel shows correctly same size image. layout not respect preferred size unless manually set cardimagepanel size using setsize(...) i'm pretty sure not supposed necessary gbl. i have tried putting revalidate() , repaint() calls on every single jframe, jpanel, layout, grid bag, image, etc throughout entire program , can't find correct place or time call them make thing work. i've been trying let image load incorrectly , use button force revalidation ...

How to integrate groups with AbstractBaseUser in django? -

how can add group capabilities custom django user model? seen i'm able inherit permissionsmixin not see group functionality in doing so. basically, need able add custom groups custom user model. if custom django user model inherit abstractuser, default inherits permissionsmixin class abstractuser(abstractbaseuser, permissionsmixin): """ abstract base class implementing featured user model admin-compliant permissions. username, password , email required. other fields optional. """ username = models.charfield(_('username'), max_length=30, unique=true, ... so, u can use default groups options. documentation

git grep & bash script cache issue -

i on linux (mint mate 17.2), wrote simple shell script call git grep -e me search sub directory of git repository, works well. when changed name of sub directory, e.g language 4-1.language , modify script accordingly. then script won't give search result, while should, after try several times, guess it's kind of cache. i reboot computer, new version of script works. my question is: which part did cache? git or bash script or .. ? and how make script work without restart computer? @update i kind found reason, seems if modify sub directory name, without commit, git grep -e can't search neither of old or new name, after commit it, can search new name expected result. are sure commit new directory before using script ? it looks in tracked files look specified patterns in tracked files in work tree if rename subdirectory , did not add track git grep not find it.

javascript - How to reload page when jquery.counter trigger finish.countdown event for multiple instance? -

i using multiple instance jquery countdown , implement page reload when counter finished e.g. $('.countdown').each(function() { var $this = $(this), finaldate = $(this).data('countdown'); $this.countdown((finaldate), function(event) { var days = event.strftime('%d'); $(this).find('.days').children('span').html(days); $(this).find('.hours').children('span').html(event.strftime('%h')); $(this).find('.minutes').children('span').html(event.strftime('%m')); $(this).find('.seconds').children('span').html(event.strftime('%s')); }); $(this).on('finish.countdown', function(event){ /*if(!window.location.hash && !(window.location.hash.indexof('_loaded') > -1)) { window.location = window.location + '#_loaded'; window.location.reload(); }*/ //if put w...

How to get "name" attribute of html tag using php getStr? -

i'm trying find way content of html attribute "name", using php getstr, can't work anyhow, have searched, couldn't find find may me. <input id="9d6e793e-eed2-4095-860a-41ca7f89396b.subject" maxlength="50" name="9d6e793e-eed2-4095-860a-41ca7f89396b:subject" value="" tabindex="1" class="subject required field" type="text"/> i want value string: 9d6e793e-eed2-4095-860a-41ca7f89396b:subject i can value of tag one: <input type="hidden" name="message" value="1442814179635.oz1lxjnxvcmmj0qpv0wglx4roea="/> with code: getstr($b,'name="message" value="','"'); but can't find way attribute name of first one? this bit of code want: <?php $b = '<input id="9d6e793e-eed2-4095-860a-41ca7f89396b.subject" maxlength="50" name="9d6e793e-eed2-4095-860a-41c...

TypeError: expected dynamic type 'string', but had type int64 in react-native Example for Android -

i met problem after load js, idea ? many thanks. typeerror: expected dynamic type 'string', had type 'int64'. the error caused react-native using gradle package on repository pre-built. if version of react-native github run incompatible binaries. solution change file in projectname/android/app/build.gradle compile 'com.facebook.react:react-native:0.11.+' to compile project(':reactandroid') that way depend on local library (and ofcourse need move reactandroid folder correct position & need android-ndk ) i recommend wait sometime.

r - ggplot2 of categorical data - grayscale/BW theme for enhanced readability -

Image
i trying plot line graph group in r using ggplot2 follows. intended grayscale print. library(ggplot2) # summarise data mry <- do.call(rbind, by(movies, round(movies$rating), function(df) { nums <- tapply(df$length, df$year, length) data.frame(rating=round(df$rating[1]), year = as.numeric(names(nums)), number=as.vector(nums)) })) p <- ggplot(mry, aes(x=year, y=number, colour=factor(rating))) p + geom_line() + scale_color_grey() + theme_bw() however clarity lacking in resulting plot there 10 groups involved. how adjust colors/pch/line style in ggplot2 better readability in such case large number of groups involved? i'd inclined use facets, this: ggplot(mry, aes(x=year, y=number))+ geom_line() + scale_color_grey() + theme_bw() + facet_grid(rating~.) obviously better in portrait mode, @ minuscule scale can tell ratings of 1,2,3,9, , 10 extremely rare, , common ratings 6 , 7 (at least recently). more can plotting on top of each other....

java - Restarting Phone when it is shutdown -

is there way start phone automatically after every 'n' minutes after shutdown... developing solution not getting success. or link solution highly recommended. in advance. you can not turn device on app on device, obvious reasons. there way boot device computer. if device had usb debugging turned on, can use adb , run adb reboot boot device connected usb computer.

database - How to return a new value in a trigger from a cte in PostgreSQL -

from previous question in postgresql (9.3), how check sequence efficiently used , unused values in postgresql , have table chart_gap has list of unused chart numbers table charts: create table chart_gap (chart_number integer); in trying understand triggers bit more, have added following trigger procedure taken more or less question: create or replace function next_chart() returns trigger $body$ begin -- check empty chart number if new.chart_number null ins ( select chart_number chart_gap pg_try_advisory_xact_lock(chart_number) limit 1 ) delete chart_gap c using ins i.chart_number = c.chart_number; new.chart_number := select chart_number ins; <--wrong! end if; return new; end; $body$ language plpgsql volatile; the trigger procedure tied charts file with: create trigger next_chart before insert on charts each row execute procedure next_chart(); what attempting replace empty chart number f...

winforms - C# - Contextmenu bug with SaveFileDialog -

i use contextmenu on pictureedit (devexpress) when user right clicks , select menu item should save file. context menu still showing when savedialog windows open. how remove bug? private void initializecontextmenu() { ui_pictureedit.properties.contextmenustrip = new contextmenustrip(); var menu = new contextmenustrip(); menu.items.add("save image"); menu.itemclicked += contextmenu_saveimageclicked; menu.show(); ui_pictureedit.properties.contextmenustrip = menu; } using (var dialog = new savefiledialog()) { dialog.defaultext = "*.png"; dialog.filter = "image files (*.png)|*.png|all files (*.*)|*.*"; if (dialog.showdialog() == dialogresult.ok) { ui_pictureedit.image.save(dialog.filename); } } so can close question: move menu object scope it's accessible contextmenu_saveima...

java - Whitelisting a web resource using spring security -

the standard method secure web application forbid unauthenticated access , white-list specific resources. all of following xml fragments allow access resource, different though implications: <http pattern="/favicon.ico" security="none" /> <intercept-url pattern="/favicon.ico" filters="none" /> <intercept-url pattern="/favicon.ico" access="permitall"/> <intercept-url pattern="/favicon.ico" access="role_anonymous" /> <intercept-url pattern="/favicon.ico" access="is_authenticated_anonymously" /> which should used when , under circumstances? <http pattern="/favicon.ico" security="none" /> will bypass security filters completely, want kind of resource we're dealing here (i.e. favicon.ico). if do <intercept-url pattern="/favicon.ico" access="is_authenticated_anonymously" /> you...

html - How to hide content first in Toggle(hide/show) button with jquery -

i made toggle button jquery. opened page, first see content visible. when clicked on button hides. want make first hide , when click on button show. http://imgur.com/a/yxrog first image before click second after click html <button id="pak">asia</button> <div class="asia"> <ul> <li><a href="file:///c:/documents%20and%20settings/maheer/desktop/cities/aisa.html">&nbsp;&nbsp;&nbsp;&nbsp;<font size="4">list of cities in asia</font></a></li> <li><a href="file:///c:/documents%20and%20settings/maheer/desktop/cities/shag.html">&nbsp;&nbsp;&nbsp;&nbsp;shanghai</a></li> <li><a href="file:///c:/documents%20and%20settings/maheer/desktop/cities/toky.html">&nbsp;&nbsp;&nbsp;&nbsp;tokyo</a></li> <li><a href="file:///c:/documents%20and%20settings/maheer/d...

html - Very basic CSS animation not working in IE11 -

i have problem basic animation not work in ie11. work in mozilla x86/x64, opera , chrome. while animation plays fine in other browsers, ie11 shows nothing until animation time over, , shows text. created fiddle show problem. .fade { animation: fade 5s; } @keyframes fade { 0% { opacity: 0; } 100% { opacity: 1; } } <table> <tr class="fade"> <td>i</td> <td>am</td> <td>a</td> <td>table</td> <td>row</td> </tr> </table> jsfiddle you need add microsoft vendor css prefix .fade { -o-animation: fade 5s; -moz-animation: fade 5s; -webkit-animation: fade 5s; animation: fade 5s; } @-o-keyframes fade { { opacity: 0; } { opacity: 1; } } @-moz-keyframes fade { { opacity: 0; } { opacity: 1; } } @-webkit-keyframes fade { { opacity: 0; } { opacity: 1; } } @keyframes fade { { opacity: 0; } { ...

actionmailer - Rails 4 mailers with gmail smtp -

i want use mailer of rails 4 gmail's smtp configuration in development file set: config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "gmail.com", :user_name => "mymail@gmail.com", :password => "mygmailpassword", :authentication => :plain, :enable_starttls_auto => true } but don't recive mails. output of terminal: to: antonioni.giovanni9@gmail.com message-id: <55ffb56da9e91_aa929362303435c@pc-rails.mail> subject: conferma ordine mime-version: 1.0 content-type: multipart/alternative; boundary="--==_mimepart_55ffb56da807b_aa92936230342e1"; charset=utf-8 content-transfer-encoding: 7bit ----==_mimepart_55ffb56da807b_aa92936230342e1 content-ty...

c# - MVC Session Serialization Error.Unable to find assembly 'EntityFrameworkDynamicProxies -

i have mvc commerce project. use sessions user login. example use membership information in session this.ofc session not null. member member=session["membersuccess"] member also because of pool time of shared hostings use sql state session.it works fine @ localhost. when upload server gives me error this; unable find assembly 'entityframeworkdynamicproxies-datalayer, version=1.0.0.0, culture=neutral, publickeytoken=null'. i don't know there relevance servers trust level full. use entity framework. , keep edmx file in seperate class library. tried adding [serializable] attiributes @ classes under .tt file. and here stack trace [serializationexception: unable find assembly 'entityframeworkdynamicproxies-datalayer, version=1.0.0.0, culture=neutral, publickeytoken=null'.] system.runtime.serialization.formatters.binary.binaryassemblyinfo.getassembly() +3124514 system.runtime.serialization.formatters.binary.objectreader.gettype(binaryassem...

PHP File Download - Maximum execution time occurs randomly -

it seems have problem file downloading. logs show error "maximum execution time of 60 seconds exceeded" requested file little css-file 1.64 kb. shouldn't take 60 seconds deliver , unfortunately error not reproducable. if open url works perfectly, errorlog shows errors occuring (randomly?) on other clients several times. there bug in code? // code from: http://www.richnetapps.com/the-right-way-to-handle-file-downloads-in-php/ // fix ie catching or php bug issue header("pragma: public"); header("expires: -1"); // set expiration time header("cache-control: must-revalidate, post-check=0, pre-check=0"); // browser must download file server instead of cache if(substr($filename, -4) == ".css") { $mimetype = "text/css"; } header("content-type: ".$mimetype); header("content-length: ".$filesize); $filehandle = fopen($filename, "rb"); // large file handling: while(!feof($filehandle)) { pri...

java - Error: Execution failed for task ':app:dexDebug' -

"com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.8.0_25\bin\java.exe'' finished non-zero exit value 2" build.gradle(using android studio) apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.1" uselibrary 'org.apache.http.legacy' defaultconfig { applicationid "app.com.notifdemo" minsdkversion 14 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' ...

Android 6.0 Permissions -

i working on big project reasonably big code base. want ask hints on how reliably check have provide solution adapt android 6.0 . have used analyze > inspect code , static analysis of code , shows missing checks in section : android > constant , resource type mismatches. looks not right place find problems , why asking make sure using right thing , looking @ right thing, plus bit confused because have parts of code write files , not getting notified permissions checks there(is normal behaviour?!) public static boolean write(string foldername, string filename, object objtowrite) { // serialize cardmodel fileoutputstream file = null; objectoutputstream o = null; file dirfile = appcontroller.getinstance().getapplicationcontext().getdir(foldername, context.mode_private); try { // create archivedir file mypath = new file(dirfile, filename); file = new fileoutputstream(mypath, false); o = new objectoutputstream(file); o...

linux - Running cron less then one minute- laravel -

i wanna ask if there way set cron in laravel less 1 minute. right execute script in while true loop inconsiderable. i'm talking linux system. you can not execute cron jobs less 1 minute interval. can check alternate solutions on https://serverfault.com/questions/49082/can-i-run-a-cron-job-more-frequently-than-every-minute

How to collapse system tray in windows 10 Phone UWP -

i'm developing windows 10 uwp app. need collapse system tray windows 10 mobile app. finally got answer var statusbar = "windows.ui.viewmanagement.statusbar"; if (apiinformation.istypepresent(statusbar)) { //await windows.ui.viewmanagement.statusbar.getforcurrentview().showasync(); await windows.ui.viewmanagement.statusbar.getforcurrentview().hideasync(); } note: don't forget add windows phone extention before using above code fore more info: https://msdn.microsoft.com/en-us/library/windows/apps/dn609832.aspx

ios - Restrict orientation per view controller -

i want in each view controller orientation supports , restrict them. tried: use custom navigation controller in 1 of old posts , doesn't seem work anymore. solution similar ios 6 - (bool)shouldautorotate not getting called navigation controllers pushed viewcontrollers i tried setting orientation in xamarin ios , app crashes on rootviewcontroller . nullreferenceexception here. furthermore tried ios 8 : restricting orientation on view controller deleted blog shri chakraborty (shrixamarin). here app crashes if use application:supportedinterfaceorientationsforwindow: , because rootviewcontroller null. solution seems similar how restrict orientation per view controller in ios7 in navigation controller hierarchy none of solutions seems work. or miss important? how can restrict orientation view controller landscape only, view controller b portrait , view controller c can shown in available orientations? overriding getsupportedinterfaceorientations() in view contro...

Access java variable inside selenium webdriver javascriptexecutor -

i have int variable in java like int height = 10; i want use java int type variable inside javascriptexecutor of selenium webdriver. have tried in ways shows error time javascriptexecutor jse = (javascriptexecutor)driver; jse.executescript("var test = '${height}';") or jse.executescript("var test = '<%=height%>';" what way use int type variable inside javascriptexecutor of selenium webdriver? you need use + operator achieve it. use code below: webdriver driver=new firefoxdriver(); driver.get("https://www.google.co.in/"); int height=10; string script="alert('"+height+" book not exist');"; javascriptexecutor js=(javascriptexecutor)driver; js.executescript(script);

How to provide property file name dynamically in java -

hi using 2 property files. 1 application configuration , 1 object repository. going use these 2 properties through out application. each , every testcase initialising property , access files using property object. want initialise property in separate method in separate class.also want call method in class , access property files using initialised property object. don't know how this. please give me hand task done.thanks in advance below code public class propertiesexample { public static void main(string[] args) { webdriver driver = null; string baseurl; file file = new file("/home/vaav/workspace/propertiesexample/config.properties"); properties prop = new properties(); fileinputstream fileio = null; try{ fileio = new fileinputstream(file); prop.load(fileio); fileio.close(); }catch(filenotfoundexception ex){ ex.printstacktrace(); } catch (ioexcept...

bitmap - Android - Fill Path with color partially -

Image
i trying draw heart shaped canvas using path in android. code follows : @override protected void ondraw(canvas canvas) { super.ondraw(canvas); // fill canvas background color canvas.drawcolor(color.white); // paint.setshader(null); // defining of heart path starts path.moveto(left + width / 2, top + height / 4); // starting point // create cubic bezier cubic left path path.cubicto(left+width/5,top, left+width/4,top+4*height/5, left+width/2, top+height); // right bezier cubic path path.cubicto(left + 3 * width / 4, top + 4 * height / 5, left + 4 * width / 5, top, left + width / 2, top + height / 4); paint.setshader(new lineargradient(0, canvas.getheight()/4, canvas.getwidth(), canvas.getheight()/4, new int[]{color.red, color.yellow, color.green}, new float[]{0, 0.6f, 1}, shader.tilemode.clamp)); canvas.drawpath(p...

oauth 2.0 - Does Firebase provide access token for consuming Google API's (Contacts, Calender)? -

i have code accessing google contacts api using firebase. authenticates user , returns access_token not seem work accessing contacts api(i using angularfire). here code: var ref = new firebase("<<firebase-app>>"); $scope.click = function() { ref.authwithoauthpopup("google", function (error, authdata) { if (error) { console.log("login failed!", error); } else { console.log("authenticated payload:", authdata); console.log(authdata.google.accesstoken); var resource = "https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + authdata.google.accesstoken; $.getjson(resource,function (response) { console.log(resource); }); } the error received is: https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token … 401 (ok) here format of authdata rece...

android - Collapsing toolbar, tabLayout and ViewPager not working properly after scroll -

Image
i trying create similar layout user profile screen in app. here need: 1. back, plus , image button should in toolbar in collapsed expanded state. 2. toolbar should transparent in expanded state , change color of content scrim on being collapsed. 3. served(180) , cooked(300) text should clickable , lead other activities. 4. on collapsing, tablayout should pinned below toolbar. 5. viewpager attached tabs should work fine , contains listview. here attempt: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#231f20" android:fitssystemwindows="true"> <android.support.v4.view.viewp...

android DrawerLayout navigation Fragment reload without click on DrawerLayout item -

i creating simple app having drawerlayout navigation. in 1 menu item my profile . in my profile screen there button open change password screen in same fragment . if open drawerlayout 's menu , close without clicking, my profile screen loads again. following code public class homeactivity extends actionbaractivity { private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle; private charsequence mdrawertitle; private charsequence mtitle; private arraylist<sidemenuentity> listsidemenuitems; private sidemenuadapter adaptersidemenu; menu menu; fragment fragment; asynctaskhelper loadfragmenttask; int position, old_position; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); mtitle = mdrawertitle = gettitle(); mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrawerlist = (listview) findviewb...

sql server - T-SQL Sorting by year and month -

i sort date according date yyyy,mm. tried using varchars first: group (year(join_date) varchar(4)) + '-' + cast(month(join_date) varchar(2)) but converting them varchar meant sort went 2014.1 - 2014.11 - 2014.12 - 2014.2 how sort them in year month order? select year(join_date) + month(join_date) date, count(*) count x mtype ='a' , (join_date between dateadd(year, -5, getdate()) , getdate()) group year(join_date) + month(join_date) order date asc you don't need convert them varchar, year , month return ints: select year(join_date) joinedyear, month(join_date) joinedmonth, count(*) count x mtype ='a' , (join_date between dateadd(year, -5, getdate()) , getdate()) group year(join_date), month(join_date) order year(join_date) asc, month(join_date) asc

Having a little trouble understanding objects (Java) -

i trying understand difference between: public class guessgame { player p1; player p2; player p3; and public void startgame() { p1 = new player(); p2 = new player(); p3 = new player(); basically, these both in program? understand startgame method creating objects, first part of program for? first part calling declaration of object . declarations notify compiler using name refer variable type type. declarations not instantiate objects. instantiate player object, or other object, use new operator. the second part called instantiating object the new operator instantiates new object allocating memory it. new requires single argument: constructor method object created. constructor method responsible initializing new object. you can check official java tutorial on object creation more info. or here .

Mips help syscall -

i not understand why when mars runs function prints numbers in array not new line. can me? stampac: lw $t6,0($a1) #stampo c[i] li $v0, 1 move $a0, $t6 syscall li $v0, 4 la $a0, a_capo syscall addi $a1,$a1, 4 addi $a3,$a3, 1 #i++ bne $a3, 10, stampac #continua fino quando i=10 jr $ra assuming trying print newline a_capo literal, guess not defining correctly literal. in .data section should write a_capo: .asciiz "\n" then, snippet should print newline: li $v0, 4 la $a0, a_capo syscall

optimization - How to conduct optimisation in R when there are constraints -

i need optimise following object function. qgpd package fextremes . var.asym <- function(alpha1, alpha2, xi, beta, n){ term11 <- alpha1*(1-alpha1)^(2*xi-1) term12 <- alpha1*(1-alpha1)^(xi-1)*(1-alpha2)^xi term22 <- alpha2*(1-alpha2)^(2*xi-1) sigma <- matrix(c(term11, term12, term12, term22), nrow=2, byrow=true) sigma*beta^2/n } mop.jacob.inv <- function(alpha1, alpha2, xi, beta){ term11 <- -qgpd(alpha1, xi, beta)/xi - beta*(1-alpha1)^xi*log(1-alpha1)/xi term12 <- qgpd(alpha1, xi, beta)/beta term21 <- -qgpd(alpha2, xi, beta)/xi - beta*(1-alpha2)^xi*log(1-alpha2)/xi term22 <- qgpd(alpha2, xi, beta)/beta jacob <- matrix(c(term11, term12, term21, term22), nrow=2, byrow=true) jacob.inv <- solve(jacob) jacob.inv } var.asym2 <- function(alpha1, alpha2) var.asym(alpha1, alpha2, 0.2, 1, 1000) mop.jacob.inv2 <- function(alpha1, alpha2) mop.jacob.inv(alpha1, alpha2, 0.2, 1) # function optimised: object <- function(a...

ios - Expand custom section cells in UITableView -

1)here problem.i designing ios app need show contents of cell on clicking on section(my custom sections).i have 2 such sections.now logic used here i'm hiding cell until click on section.but problem i'm facing in regard when 1st cell expands,it overlaps second section fraction of second.the reason following code: //call uitableview delegate method 'cellforrowatindexpath:' [tableview beginupdates]; //some code [tableview endupdates]; now i'm calling 'cellforrowatindexpath:' unhide cell gets executed after updates. 2)second logic thought set height each row 0 @ start.but ain't helping designs of both custom cells overlap each other. what should now? use following code expandable cell uitableview - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwit...

xpath - Getting a substring of an attribute is not working -

this html code: <table id="laptop_detail" class="table"> <tbody> <tr> <td style="padding-left:36px" class="ha">&nbsp;camera pixels &nbsp;</td> <td class="val">8 megapixel camera</td> </tr> </tbody> </table> how first character "8" in chrome? approach far is: $x('//*[@id="laptop_detail"]//tr/td[contains(. ,"camera")]/following-sibling::td[1]/text()[substring(. , 0, 2)]') don't put function need output of predicate, instead, apply on node: substring(//*[@id="laptop_detail"]//tr/td[contains(., "camera")]/following-sibling::td[1], 1, 1) note in xpath, characters in string numbered 1, not 0. also, don't need specify text() , substring knows should operate on strings. btw, want 1 if number of megapixels 10? maybe substring-before(...,...

ember.js - Am I rendering from a promise appropriately? -

this question has answer here: setting controller property after model hook 2 answers i trying display user logged in. few things note. user has async relationship profile . in user model, have: profile: ds.belongsto('polymorphable', { polymorphic: true, async: true }), my application route has: model() { return this.store.findrecord('user', this.currentsession.get('id')); }, the application template has like: <div class="profile-photo"> {{image-tag imageurl=model.profile.imageurl}} </div> the image-tag component object has computed property: src: ember.computed('imageurl', { get() { let imageurl = this.get('imageurl'); console.log(imageurl.indexof('imgix') > -1) // returns error } }) i uncaught typeerror: cannot read property 'indexof' of undefined ...

javascript - Download canvas image using JS Jquery -

i'm trying download canvas image desktop using following code: <script type="text/javascript"> var canvas; $(document).ready(function() { if ($('#designs-wrapper').length) { $('.design').each(function() { var design = $(this).attr('data-design'); var canvas = $(this).find('canvas')[0]; var ctx = canvas.getcontext('2d'); var img = new image; img.onload = function() { ctx.drawimage(this, 0, 0); }; img.src = design; }); } $('#canvas').click(function() { this.href = canvas.todataurl(); this.download = 'design.png'; }); }); </script> sadly i'm getting following error: uncaught typeerror: cannot read property 'todataurl' of undefined does have idea how fix this? live preview: http://dane.helpful.ninja/fds/index.php?username=z-justin i...

php - How can i test all scenarios of firstname and lastname -

i have function must test scenarios of firstname : 1-first scenarios if firstname empty . 2-second scenarios if firstname contains 1 character. 3-third scenrarios if firstname have 2 character. 4-four scenarios if firstname have 3 character. 5-other scenarios ... so here function : <?php $loginuser = $thirdpartycode .'_'. substr($firstname, 0, 1) .''. substr($lastname, 0, 1); echo 'login user generatedlogin:'. $loginuser; // $usercheck = new admin_model_dbtable_user(); // $iduser=$usercheck->checkuser($loginuser); $firstnamex = 0; $firstnamey = 1; $lastnamex = 0; $lastnamey = 1; $max = 4; { ++$firstnamey; ++$lastnamey; if (empty($firstname)) { $loginuser = $thirdpartycode .'_'. substr($lastname, $lastnamex, $lastnamey); } else { if (strlen($firstname) < $max) { $firstnamex = 0; $firstnamey = 1; $loginuser = $thirdpartycode .'_'. substr($firstname, $firstn...

c# - Linq Dynamic OR condition -

i having user table this, id(int) name(string), state_id(int64), country_id(int64), mobilenumber(string), email(string), identity(string) role_id disable(boolean) identity column have values comma separated example(,mole in hand, mole in face,). value pre-defined, now have request this, class userrequest { public string rolename{get;set;} public string countryname{get;set;} publi string statename{get;set;} publi ilist<string> identitylst{get;set;} } using request want form query. public ilist<user> getuser(userrequest req) { iqueryable<user> query=datacontext.user.where(a=>!a.isdisable) if(string.isnullorempty(req.rolename)) { query=from qu in query role in datacontext.role.where(a=>a.id==qu.role.id) role.name==req.rolename select qu; } if(string.isnullorempty(req.countryname)) { query=from qu in query country in datacontext.country.where(a=>a.id==qu.country.id) country.name==req.countryname select qu...