Posts

php - Drupal 7 commerce module billing country selection based on user -

i have problem drupal 7 commerce module. we have country drop-down in home page , user can select country proceed shopping. once in commerce billing section shows default country canada. want here based home page country selection have set same value country drop-down in billing section. please know how can implement this?. i new drupal same type of question can find here https://drupal.stackexchange.com/questions/120858/prepopulating-county-state-field-ajax-driven-field can't country selected on homepage? maybe appears on url , can use current_path to it? how deal when selected on homepage? edit: if can access anywhere, can use hook_widget_form_alter in custom module this: function your_module_field_widget_form_alter(&$element, &$form_state, $context) { $element['#address']['country'] = 'us'; } replace 'your_module' module name. , change 'us' iso of user's country. , should add conditional statement...

scala - play-cache -- memorize an Future with expiration which depends on the value of future -

given following functions val readv : string => future[v] val isexpired: v => boolean how memorize result of readv until isexpired by using play cache(or else) here how did: def getcached(k: string) = cache.getas[future[v]](k) def getorrefresh(k: string) = getcached(k).getorelse { this.synchronized { getcached(k).getorelse { val vfut = readv(k) cache.set(k, vfut) vfut } } } def get(k: string) = getorrefresh(k).flatmap { case v if !isexpired(v) => future.successful(v) case _ => cache.remove(k) getorrefresh(k) } this complicated ensure correctness is there simpler solution this. if it's possible change isexpired: v => boolean timetolive: v => duration , can use def refresh(k: string): future[v] = readv(k) andthen { case success(v) => cache.set(k, future.successful(v), timetolive(v)) } def get(k: string): future[v] = cache.getorelse(k)(refresh(k)) to co...

oracle - Java Class for retrieve all tables from database -

this question exact duplicate of: how tables , their's columns of specific schema using java? i wrote java class print tables of db2 database,but problem is: not print columns(i wrote hints in code). , every time print previous values too! public class automateexport { static string value; public static void main(string[] args) throws sqlexception, classnotfoundexception { string table_name; string column_name; string tablename = null; string columntype; int precision; stringbuilder sb = new stringbuilder(1024); connection db2 = getconnection(); string sql = "select tabschema,tabname,colname,typename,length syscat.columns tabschema not 'sys%' "; preparedstatement mainstmt = db2.preparestatement(sql); resultset rs = mainstmt.executequery(); resultsetmetadata rsmd = rs.getmetadata(); int columncount = rsmd.getcolumncount(); sb.append("c...

Insert the same data in two different tables using yii2: -

insert same data in 2 different tables using yii2: hello, using yii2 ,having 2 tables inbox , sent_items . inbox table contains fields: mail_id (pk), from,to,subject, content,date_time . sent_items table contains fields: mail_id (pk),from,to,subject,content,date_time . i need insert values through form in 2 tables in same time. answer please thanks. you can use $inbox->load($data) data form , use 2nd parameter load function load same data model: $sent_items->load($data,'inbox');

github - How to set up git to use ssh instead of https? -

$ git remote -v origin https://github.com/my-repo/site-web.git (fetch) origin https://github.com/my-repo/site-web.git (push) i have ssh set , shell script run this: ssh -t git@github.com git reset --hard ... git pull but still prompted password. assume remote needs git@github.com ssh work. i have 4 directories... a/ b/ c/ , d/ , of them point remote. want ssh work in a/ . i'm happy keep using https others. what do? you need add .ssh/id_rsa.pub github account.

java - How do you set About menu title in Oracle AppBundler for OSX? -

Image
i using oracle appbundler allow me package jre inside osx *.app. can't seems set menu liking, shown below. the menu still display main class name. part of build.xml . idea of might cause this? <target name="bundle"> <bundleapp outputdirectory="dist" name="my name eman" displayname="my name eman" identifier="my name eman" mainclassname="test.java.testjava" icon="auxes/icon.icns"> <runtime dir="${env.java_home}" /> <classpath file="lib/test-java.jar"/> <option value="-dapple.laf.usescreenmenubar=true"/> <option value="-dcom.apple.macos.usescreenmenubar=true"/> <option value="-dcom.apple.mrj.application.apple.menu.about.name=my name eman"/> </bundleapp> </target> finally, found here . supply -xdock:name=you...

java - Removing element from TreeMap -

i creating project allows users create, delete etc bank accounts. have been struggling case 3 (remove method). want user enter account id remove treemap. how should method laid out? package mainsample; import java.util.*; public class mainsample { public static void main(string[] args) { scanner scan = new scanner(system.in); bankprocess bankprocess = new bankprocess(); transactionprocess transactionprocess = new transactionprocess(); bank bank = new bank(); bankaccount bankaccount = new bankaccount(); int input; int selection; while (true) { system.out.println(""); system.out.println("######## menu ########"); system.out.println("[1] create account"); system.out.println("[2] print existing accounts"); system.out.println("[3] delete account"); system.out.println("[4] deposit"); system.out.println("[5] withdraw"); system.ou...