Posts

Showing posts from June, 2011

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...

c# - show distinct item in a dropdownlistfor in mvc -

i using following code bind dropdownlist. foliodividentlist can have multiple values. want bind unique values not able wrong please help. @html.dropdownlistfor(model => model.buymorelist[i].foliono, new selectlist(model.buymorelist[i].foliodividendlist.select(x => new selectlistitem { value = x.foliono.tostring(), text = x.foliono }).distinct(), "value", "text") try this:- @html.dropdownlistfor(model => model.buymorelist[i].foliono, new selectlist(model.buymorelist[i].foliodividendlist.groupby(x => x.foliono) .select(x => { var firstset = x.first(); return new selectlistitem { value = firstset.foliono.tostring(), text = firstset.foliono }; } ),"value...

CakePHP design url -

in cakephp environment have reuqest form method 'get'. when send form, controller goes to http://www.example.com/circles/index?searchterm=something indstead of (cakestyle) http://www.example.com/circles/index/searchterm:something i don't know have search for. url redirecting working properly. it's if send request 'get' method. thank help. ivo its because of request params goes url query string. if want these value named params. have jquery work. ex : should change submit method post , field values on submit , make url want can submit through jquery.

Rails 4 scope with multiple conditions -

i want show active users within 1 day. the member model , scope: time_range = (time.now - 1.day)..time.now scope :active, -> { where(created_at: time_range, gold_member: true, registered: true) } however, when call @member = user.active the below error rendered: nomethoderror: undefined method `call' #<user::activerecord_relation:0x07fe068> please advise. the backtrace: /users/jason/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.7/lib/active_record/relation/delegation.rb:136:in `method_missing' /users/jason/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.7/lib/active_record/relation/delegation.rb:99:in `method_missing' /users/jason/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.7/lib/active_record/scoping/named.rb:151:in `block (2 levels) in scope' /users/jason/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.7/lib/active_record/relation.rb:292:in `scoping' /use...

c++ - scrolling graphicsWidget using mouse -

Image
im adding qgraphicslayoutitem in qgraphicswidget in run time using qgraphicslinearlayout. i have add more items layout exceeds height of viewport height , items shown outside viewport area.so possible pan or scroll in qgraphicswidget qgraphicsview. qgraphicsview can pan using centeron , showing visible rect. the normal view and when more item added

How to access Linux Global variables using Java program -

thank assistance, i have shell script program export value. here shell script program #! /bin/sh export test=35 echo "echo $test" i have executed shell script using command ./test.sh source ./test.sh (test.sh - shell script program name) have tried print value in command prompt make sure test variable export-ed , prints test value 35. test variable exported expected. now have piece of java access test - linux global variable. sample code follows, import java.util.map; public class hello { public static void main(string[] args) { system.out.println(system.getproperty("test")); system.out.println("hello world"); } } } now issue when execute java program getting test value null. question doing write way access global variable java. if not how can access linux global variable java program. use system.getenv api below string test = system.getenv().get("test") getenv ret...

regex - mod rewrite is not working and not giving any error -

we want change links "www.example.com/page/login/" "www.example.com/sayfa/giris". tried this: rewriterule ^page/^(.+[^/])$/ /sayfa/^(.+[^/])$ [l] nothing change. there error? thank response @geert3 , @anubhava. trying failed. here .htaccess content: rewriteengine on rewritebase / rewritecond %{request_uri} ^(.*)/{2,}(.*)$ rewriterule . %1/%2 [r=301,l] rewritecond %{request_uri} /+[^\.]+$ rewriterule ^(.+[^/])$ %{request_uri}/ [r=301,l] rewriterule /(uploads/.*) $1 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ page.php?url=$1 [qsa,l] you can use code in document_root/.htaccess file: rewriteengine on rewritebase / rewritecond %{request_uri} ^(.*)/{2,}(.*)$ rewriterule . %1/%2 [r=301,l] rewritecond %{request_uri} /+[^\.]+$ rewriterule ^(.+[^/])$ %{request_uri}/ [r=301,l] rewriterule /(uploads/.*) $1 [r=301,l] rewriterule ^sayfa/giris/?$ /page/login [l,nc] rewritecond %{request_filenam...

php - Check If string contains any of the words -

i need check if string contains 1 of banned words. requirements are: case insensitive why used stripos() word should separated spaces, example if banned word "poker", "poker game" or "game poker match" should come under banned string , "trainpokering great" should come under string. i have tried below $string = "poker park great"; if (stripos($string, 'poker||casino') === false) { echo "banned words found"; } else { echo $string; } you use array , join it $arr = array('poker','casino','some','other', 'word', 'regex+++*much/escaping()'); $string = 'cool guy'; for($i = 0, $l = count($arr); $i < $l; $i++) { $arr[$i] = preg_quote($arr[$i], '/'); // automagically escape regex tokens (think quantifiers +*, [], () delimiters etc...) } //print_r($arr); // check results after escaping if(preg_match('/\b(?:' . join(...

javascript - Using wijmo event calender with angularjs -

hell, i'm trying use wijmo event calender angularjs liabry, appointments binding isn't working correctly. html: <html> <head> <title>control tests</title> <script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.min.js" type="text/javascript"></script> <link href="http://cdn.wijmo.com/themes/rocket/jquery-wijmo.css" rel="stylesheet" title="metro-jqueryui" type="text/css" /> <link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20131.7.min.css" rel="stylesheet" type="text/css" /> <script src="http://cdn.wijmo.com/jquery.wijmo-open.all.3.20131.7.min.js" type="text/javascript"></script> <script src="http:...

linux - Splice an array ref -

if have array reference how can a: splice($array, 0, $num); since splice should not used on array refs according documentation? update: problem splice on array ref pass in function on exit array not modified. update if splice(@$array, 0 ,$num) break recommendation not use array ref in splice? confused on this. snippet works me (for array ref pass in function , splice) not sure if @$array against docs use on derefenced arrayref instead: my $arr = [1,2,3]; splice @$arr, 0, 1, 3, 4; print join '-', @$arr; # 3-4-2-3 it's same approach join here - when used on arrayref, dereference it. it works same way inside sub obviously: sub splice_it { splice @{$_[0]}, 0, 1, 3, 4; } $arr_ref = [1,2,3]; splice_it $arr_ref; print join '-', @$arr_ref; # still 3-4-2-3 demo . oh, , there's big chance able splice arrayrefs directly (without derefencing) - please just don't : starting perl 5.14, splice can take scalar expr, must hold r...

Java EE 7 JSF Facelet h:commandButton action redirect to page -

this question has answer here: how navigate in jsf? how make url reflect current page (and not previous one) 1 answer hi have java ee 7 application in netbeans 8.0.2 running on glassfish 4.01 i use @managedbean @sessionscoped controller usercontroller.java i have index.xhtml facelet , signup.xhtml facelet in index.xhtml facelet have <h:commandbutton value="sign up" action="#{usercontroller.signup()}"></h:commandbutton> which calls function public string signup() { in usercontroller.java in function return return pages.sign_up_page; renders face let signup.xhtml there have form fill in user data such user name email , password. the first thing when return pages.sign_up_page; page signup.xhtml gets rendered in url still stands .../faces/index.xhtml in signup.xhtml have the <h:commandbutton value="crea...

how to handle this array in ruby? -

there array this: arr = [ {id: 1, status: 3}, {id: 2, status: 5}, {id: 3, status: 5}, {id: 4, status: 5}, {id: 5, status: 5}, ] in array, if status of hash 3, change 2, , others change 1. if each hash status not 3, array not change. i hope output should be: arr = [ {id: 1, status: 2}, {id: 2, status: 1}, {id: 3, status: 1}, {id: 4, status: 1}, {id: 5, status: 1}, ] if array this: arr = [ {id: 1, status: 2}, {id: 2, status: 5}, {id: 3, status: 5}, {id: 4, status: 5}, {id: 5, status: 5}, ] each hash status not 3, array doesn't change. i can make this: tmp = false arr.each |e| if e[:status].to_i == 3 e[:status] = 2 tmp = true break end end // note: if tmp == false, array not change if tmp == true arr.each |e| e[:status] = 1 if e[:sta...

Does PHP script Stay alive after it is invoked using cURL? -

consider situation, have huge data process, want break parts, using cronjobs invoke script checks if new data processed available, if then, script invokes few other scripts using curl, question is, the script might take couple of minutes execute, hence if invoking parent dies after assigning jobs individual scripts before individual scripts, indiviual scripts die ?, all have invoke script pass key script request , output of script stored in database itself. ps: script refers php script. you can run command in background without waiting response using "&" command for example suppose want run job.php index.php without waiting response. in index.php instead writing shell_exec('php job.php'); i shell_exec('php job.php > /dev/null 2>/dev/null &'); and puts command in background , free terminal immediately.

c# - Multiple certificates with HttpClient -

Image
i building windows phone 8.1 app allows azure users view subscription/services using azure service management api. authentication done using management certificate , certificate attached requests api. works fine single user. problem arises when try include feature multiple subscriptions. able install certificate in certificate store , retrieve it. problem arises when send request api. though attaching correct certificate, 403 forbidden error. here code i've used. public async task<certificate> getcertificate() { await certificateenrollmentmanager.importpfxdataasync(certificate, "", exportoption.exportable, keyprotectionlevel.noconsent, installoptions.none, subscriptionid); certificatequery query = new certificatequery(); query.friendlyname = subscriptionid; var c = await certificatestores.findallasync(query); return c[0]; } public async task<httpresponsemessage> sendrequest(string url,string version) { ...

C# .NET - How can I split string with a tab separator? -

Image
i have string in code: string test = @"aaaaa aaaaa aaaaa bbbb ttttt tttttt 33333 44444 777777 77777 88888 8888 8888 88888 88888 wwwww wwwww wwwwww wwwww wwwww wwwwww"; and here code spliting string new line character , tab. foreach (var line in test.split(new string[] { environment.newline }, stringsplitoptions.none)) { foreach (var lineitem in line.split('\t')) { } } in first interation of first loop line variable "aaaaa aaaaa aaaaa bbbb ttttt tttttt" , correct, in seconds loop first interation variable lineitem same, doesn't split string tab separator. why it's happening? the reason not work because tabs not tabs in string test - see this: first line generated myself ms excel. use regex correctly represent whitespace char (even unicode escape sequences) regex regex = new regex(@"\s"); string[] bits = regex.split(line); ...

awk - Deleting duplicated fields within record -

enter code here i want delete duplicate instances of key (the first 2 fields) in each record. specific duplicates appear reversed. so given a b b stuff1 b stuff2 stuff3 b where each space tab i want: a b stuff1 stuff2 stuff3 and thought it: awk 'begin {fs=ofs="\t"} {gsub($2 "\t" $1,"")} 1' file alternative solutions welcome particularly interested in why not work (i have tried dynamic regexp , gensub btw). per previous question aware may/will end duplicate tabs , take care of outside awk . edit solutions far don't work here real data. ^ read tab character 1874 ^passage de venus^ <directors> ^passage de venus^ 1874^ janssen, p.j.c.^ <keywords>^ passage de venus^ 1874^ astronomy^ astrophotography^ <genres>^ short what want 1874^ passage de venus^ <directors>^ janssen, p.j.c.^ <keywords>^ astronomy^ astrophotography^ <genres>^ short ...

powershell - "File not found" Can not use Invoke-SCScriptCommand with anything but cmd.exe + args -

i have made plugin microsoft system center virtual machine manager executes powershell script on host machine through powershell script called c# code of plugin. (shellception :p) since allways got error decided test manually in scvmm right clicking on host , entering powershell.exe or powershell for executable , export-v -name [name] -path [path] -force - copystate -wait . tells me there no such file. strangely works cmd ( .exe ) , echo test . shouldn't powershell installed on windows server 2012? also, if remotecontroll host, works fine in console. missing? i figured out need provide full path when using powershell.exe executable. issue not hosts have system variable path includes path powershell.exe executable. you can run powershell.exe providing full path: %windir%\system32\windowspowershell\v1.0\powershell.exe or can run cmd.exe executable , run powershell.exe cmd: executable: cmd.exe parameters: /c powershell.exe echo 1; return 0;

python - Inserted tabs not showing in QTabWidget despite show() called -

i have qtabwidget in pyqt provides possibility tear off tabs , re-attach them when closed. works except newly attached tabs aren't showing. blank widget showing , widget shown after current tab has been changed , changed back. i've searched stackoverflow , answers similar problems have pointed out added widget's show() -method needs called after new tab added. tried newly added tab still not showing. slimmed down example code: from pyqt4 import qtgui, qtcore class detachabletabwidget(qtgui.qtabwidget): """ subclass of qtabwidget provides ability detach tabs , making floating windows them can reattached. """ def __init__(self, *args, **kwargs): super(detachabletabwidget, self).__init__(*args, **kwargs) self.settabbar(_detachabletabbar()) def detach_tab(self, i): """ make floating window of tab. :param i: index of tab detach """ teare...

python - How can I define scope for plotting graph in Pandas? -

Image
i trying plot dataframe pandas. don't know how can define y , x-axis scales. example, in following, want show graph 1.0 0.0 in terms of y-axis scale instead of 0.0 0.7. here code above graph. in [90]: df out[90]: history lit science social accuracy 2014-11-18 0.680851 0.634146 0.452381 0.595745 0.01 2014-12-10 0.680851 0.634146 0.452381 0.595745 0.01 in [91]: df.plot() out[91]: <matplotlib.axes._subplots.axessubplot @ 0x7f9f3e7c9410> additionally want show marker 'x' each point. example, dataframe df has 2 row want mark 'x' or 'o' each point on graph. updated: after applied ffisegydd's great solution, got following graph want. in [6]: df.plot(ylim=(0,1), marker='x') pandas.dataframe.plot() return matplotlib axes object. can used modify things y-limits using ax.set_ylim() . alternatively, when call df.plot() can pass in arguments style, 1 of these arguments can yli...

svn - TortoiseSVN: add change to previous revision -

i've been wondering quite while , far haven't found information pretty sure must possible. sometimes when check in tortoisesvn notice afterwards there still anothing change should have been committed check-in. instance file wasn't added although belonged changes or maybe minor error has been overlooked. i'd commit pending change committed revision. way each revision contains related changes. so question is: if there's easy way this? not there not easy way this, there no way this, unless have access administer repository, , unless don't mind potentially breaking other people's working copies (if they've updated incomplete revision). need strip out incomplete version repository via dump , reload, , re-commit changes including file. just commit "oops" revision. if it's enabled on server, consider updating commit message of incomplete commit alert people there change wasn't included.

Magento 1.9.1 - Swatch Size Selection Displays Wrong Main Image -

can me understand why when select size second colour version of product shows first products colour image unless reselect colour again. although right colour attribute label shown , right colour size combination added basket? have reinstalled start files , new database. can set first product ok. after that, doing nothing different, unable construct working configurable product. product has 2 colour images version loaded each label matching correct attribute colour(lower-case) first set default. other selectable attribute size. seems if select size second colour "falls back" base default image(wrong). i know can around adding correct image each , every simple size variant of colour. seems hack me know can work without need assign individual size variant per simple product size. http://www.clickmasters.co.uk/womens-boots.html shown first products works expected(emu) fly not * fixed bit* wrong image used in basket.*** system > configuration > checkout > sho...

mysql - How to mysqldump some tables without data? -

i have 1 solution here: first, dump structure data of tables excluding tables; then, dump structure of excluded tables without data. for example: mysqldump -uroot -ppassword database_name --ignore-table=sils.zone > test.sql; mysqldump database_name table_name -d >> test.sql; but there better way solve 1 dump statement?

javascript - MVC jquery dialog not working properly -

when click delete button, popup dialog shows , disappears. not stay here code: .cshtml: @html.actionlink("delete", "deleteorder", "order", new { id = item.orderid }, new { @class = "btn btn-primary btn-delete"} ); <div id="dialog-confirm" title="confirmation dialog" style="display:none">delete order? confirm </div> <script> $(document).ready(function () { $(".btn-delete").click(function () { var result; $("#dialog-confirm").dialog({ resizable: false, height: 140, modal: true, buttons: { "yes": function () { $(this).dialog("close"); }, "no": function () { $(this).dialog("close"); ...

android - How can I position control at end of activity? -

Image
i want add control @ end of activity, there activity xml file, need note_date @ end of activity. thank all. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <edittext android:id="@+id/note_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/note_title_hint" /> <edittext android:id="@+id/note_body" android:layout_width="match_parent" android:layout_height="401dp" android:gravity="top" android:hint="@string/note_body_hint" android:inputtype="textmultiline" > <requestfocus /> </edittext> <edittext android:id="@+id/note_date" android:layout_width="match_parent...

ruby on rails - Parse hash for value from a table -

i writing aws-federation proxy in rails. means grab groups using net-ldap on our local activedirectory , want compare list , matches. netldap-searchresult hash: [#<net::ldap::entry:0x000000048cfdd0 @myhash={:dn=>["cn=username,ou=support,ou=mycompany ,ou=organisation,dc=mycompany,dc=com"], :memberof=>["cn=my aws groupname,cn=receiver,cn=users,dc=mycompany,dc=com"]}>] now want parse hash , matches in local "groups" table. looks that: name aws-role aws-groupname group aws-othergroup other-group i have group-model. best practices approach? i've never done before. use regex here? loop groups through tables? what's rails way this? edited more information i'm going assume few things here, since don't know ldap search results from, assuming hash looks this: edit : based on additional information: // example require 'net-ldap' entry = net::ldap::entry.new entry.dn = ["cn=usern...

php - Cannot select entity through identification variables in repository -

i have following query. query inside instagramshoppicture $querybuilder = $this->createquerybuilder('p') ->select('p.id, p.caption, p.price, p.lowresimageurl, p.medresimageurl, p.highresimageurl, p.numberoflikes, p.numberofdislikes, shop.id, shop.username, shop.fullname, contact, category') ->leftjoin('p.shop', 'shop') ->leftjoin('shop.contact', 'contact') ->leftjoin('p.category', 'category') ->leftjoin('category.picturetopcategory', 'picturetopcategory') ->leftjoin('category.picturefirstlevelcategory', 'picturefirstlevelcategory') ->leftjoin('category.picturesecondlevelcategory', 'picturesecondlevelcategory') ->where('p.islocked = false') ->andwhere('...

sql server - PDO_ODBC and unixODBC cannot connect MSSQL with non-default port -

i have connect 2 mssql servers on php/linux environment. decide use unixodbc , pdo_odbc. mssql on server1: 10.10.10.5:1433 mssql on server2: 10.10.10.8:14233 (non-default port number) i think there port problem of pdo_odbc or unixodbc. tried code below. this code works fine. connected successfully. $db = new pdo('odbc:driver=sql server native client 11.0; server=10.10.10.5; port=1433; database=dbname; uid=uid; pwd=pwd'); this code didn't work. connect failed. $db = new pdo('odbc:driver=sql server native client 11.0; server=10.10.10.8; port=14233; database=dbname; uid=uid; pwd=pwd'); strangely, code works fine wrong value. :( $db = new pdo('odbc:driver=sql server native client 11.0; server=10.10.10.5; port=14233; database=dbname; uid=uid; pwd=pwd'); i concluded ignore port setting on dsn of pdo. i tried other setting using /etc/odbc.ini [odbc-erp] driver=sql server native client 11.0 description=mssql trace=yes server=10.10.10.8 ...

Java 8 Streams, perform part of the work as parallel stream and the other as sequential stream -

i have stream performing series of operations in parallel, have write results file, need writing operation sequential, needs performed stream, have lots of data write, cannot use intermediate collection. there way that? i thought solution doesn't seem clean, make writing method synchronized. approach possible? there other way? thank you. there no need turn stream sequential in order perform sequential terminal operation. see, example, documentation of stream.foreachordered : this operation processes elements 1 @ time, in encounter order if 1 exists. performing action 1 element happens-before performing action subsequent elements, given element, action may performed in whatever thread library chooses. in other words, action may called different threads result of parallel processing of previous steps, guaranteed thread safe, not call action concurrently , maintains order if stream ordered . so there no need additional synchronization if use foreachordere...

Ruby %w empty value -

how add empty string select option %w(mr ms mrs miss) ? i can ['', 'mr', 'ms', 'mrs', 'miss'] use %w . thx! use unshift prepended object front: => %w(mr ms mrs miss).unshift "" #> ["", "mr", "ms", "mrs", "miss"] pretty version without brackets. ok update: => %w(#{} mr ms mrs miss) #> ["", "mr", "ms", "mrs", "miss"] explain: %w - allow interpolation %w - not allow interpolation #{} - empty string

objective c - iOS Bonjour not removing service when stopped -

i using bonjour ios application. when use [self.netservice stop]; service not stop publishing. when turn off wifi - (void)netservicebrowser:(nsnetservicebrowser *) servicebrowser didremoveservice:(nsnetservice *) service morecoming:(bool) morecoming this method not getting called. wifi turn off want event bonjour can stop other things in app. 1 have solution this. in advance. service not stop publishing. you can try following: [self.netservice stop]; [self.netservice removefromrunloop:[nsrunloop currentrunloop] formode:nsrunloopcommonmodes]; self.netservice = nil; calling stop method should invoke delegate method netservicedidstop , can implement see if gets called on stopping. for wifi turn off want event bonjour can stop other things in app. there seems no programmatic event detect when wifi disabled or enabled, it's not possible detect if wifi enabled or not. try check reachability of internet in loop detect...

php - Jquery Selector for dynamically created elements -

i creating html in php here <?php while(){ ?> <a id="click_to_expand-1" class="btn btn-default btn-sm "> more</a> <div id="expand_content-1" class="row extra-detail-gist" style="display: none;"> <ul class="extra-feature-gist"> <li> <p><strong>baths :</strong><span class="text-success"> <?php echo $rw["baths"]; ?></span></p> </li> </ul> <?php } ?> here jquery code $(function(){ $('.row.extra-detail-gist').css('display','none'); $('.btn.btn-default.btn-sm').click(function(){ $('.row.extra-detail-gist').slidetoggle('slow'); $(this).toggleclass('slidesign'); return false; }); }); this code apply div created , divs showing @ click.how can di...

javascript - Is it possible to remove landmarks from google map with JS or CSS? -

i have question, possible remove landmarks google map, change scale of map without landmarks shown? feed below styles map - styles: [{"stylers":[{"visibility":"off"}]},{"featuretype":"road","stylers":[{"visibility":"on"},{"color":"#ffffff"}]},{"featuretype":"road.arterial","stylers":[{"visibility":"on"},{"color":"#fee379"}]},{"featuretype":"road.highway","stylers":[{"visibility":"on"},{"color":"#fee379"}]},{"featuretype":"landscape","stylers":[{"visibility":"on"},{"color":"#f3f4f4"}]},{"featuretype":"water","stylers":[{"visibility":"on"},{"color":"#7fc8ed"}]},{},{"featuretype":"road...

forms - Input data into a table using DLookUp in Access -

i using data entry continuous form input data table named 'order_history'. fields input data table except one. have text box uses dlookup value combo box on form , use select data in hopes of entering table. dlookup getting data different table named 'postcodes'. assume reason others work because control source linked columns in table. is there way can link text box (drop_number) specific column in order_history table while still using dlookup values? my dlookup code: =dlookup("drop_number", "postcodes", "postcode = [forms]![order_form]![postcode_cb]")

php - jQuery validate remote message -

this question has answer here: jquery validate remote method usage check if username exists 2 answers i try display error message when email used jquery validation. unfortunately there no error message, when email used. tried following: javascript $('#registerform').validate({ rules: { registeremail: { required: true, remote: 'ajax/ajax.validateemail.php' } }, messages: { registeremail: { remote: 'e-mail taken' } } }); php <?php header('content-type: application/json'); $stmt = $mysqli->prepare("select * members m memail = ? limit 1"); $stmt->bind_param('s', $_post['registeremail']); $stmt->execute(); $stmt->store_result(); $stmt->fetch(); if ($stmt->num_rows == 1) { echo false; }else{ echo...

ios - Email keyboard in alternative mode (when digits are visible) -

Image
i have uitextfield sip connection data can entered. example: 2342452@somedomain.com in general problem looks email, 90% of cases user enter numbers first. i've set email keyboard, activate alternative keyboard mode, digits visible when keyboard shown (see picture): is possible?

ajax - It's a good idea to use error HTTP response codes different to 200 when an error occurs in server side? -

i understand restful api must return http codes according client request , server processing, when processing ajax request json response (form processing/validation, page status, etc...) should return specific http error code or 200 http code error message json? some browsers have extensions catch http response code header , times overwrite server response custom error pages (like worlderror.org). avoid this, 200 response server sends. it's method response error codes server when client browser? i know ajax success , error methods catch errors javascript, there man-in-the-middle changes response. i have read lot of stackoverflow questions http responses, focused how manage error responses , not if it's idea use http codes when response can altered. others is considered practice return code different 200 controllers, in order trigger ajax error? not explained response practice. restful api: client --> server --> client ajax request: client --> browser ...

Rolling updates for websites hosted on Amazon's Elastic Beanstalk -

i've deployed application elastic beanstalk, , configured rolling updates feature. sounds pretty cool because keeps number of servers in farm @ times while others swapped out upgrades - seems outage-less upgrade achievable. but reasoning isn't going work - @ point during rolling update there servers v1 on , servers v2 on. if js or css different between v1 , v2 there v1 page loaded sends request load balancer , gets v2 js/css , vice versa. i can't think of easy way avoid this, , i'm struggling see point of rolling upgrades @ all. am missing something? there better way achieve outage-less upgrade website? thinking set complete parallel elastic beanstalk environment v2 on it, , switch them on in 1 go - seems more time consuming. as described, use rolling deployments , have continuous deployments on same environment, need guarantee version n compatible version n+1. "compatible" meaning can run simultaneously, can challenging in cases such differ...

Google+ Sign-In on Android Studio- GoogleAuthException: BadUsername -

after sign-in succeeds can't retrieve profile information , keep getting error on googleauthutil.gettoken() method. the error: com.google.android.gms.auth.googleauthexception: badusername on android client id inferred automatically combination of android package name, , sha-1 fingerprint of signing key in developers console project. matched package name , tried of debug.keystore have on workstation. nothing worked. *the consent screen set (!) does't appear. the whole working fragment: public class googleplusactivity extends fragment implements connectioncallbacks, onconnectionfailedlistener { private static final string tag = "signinactivity"; // magic number use know sign-in error // resolution activity has completed. private static final int request_resolve_error = 9000; // core google+ client. private googleapiclient mgoogleapiclient; // flag stop multiple dialogues appearing user. private boolean mresolvingerror; //token protected string mtok...

javascript - Bootstrap menu not working in wordpress -

i'm having problem collapsible bootstrap menu. i'm in process of redesigning home page of wordpress website. made custom header, footer , template file that. i'm using bootstrap design. i enqueue required bootstrap css , js files; else seems fine collapsible bootstrap menu not working. think bootstrap js conflicting existing js of current theme. tried loading script in custom header also, did not needful. what should next step? here's a test page . if view console, browser returning error: uncaught error: bootstrap's javascript requires jquery version 1.9.1 or higher this theme using v1.7.2 source: http://test.thedigitalmarketingonline.com/wp-content/themes/theme1887/js/jquery-1.7.2.min.js?ver=1.7.2

oracle - Query returning -> ORA-19011: Character string buffer too small -

i'm running query below, , oracle returning following message: query returning -> ora-19011: character string buffer small when uncomment last line, works. think thats why return few results. how solve this? select substr(xmlagg(xmlelement (e, str||',')).extract ('//text()'),1,(length(trim(xmlagg (xmlelement (e, str||',')).extract ('//text()')))-2)) motivos ( select to_char(lo_valor) str editor_layout el, editor_versao_documento ev, editor_documento ed, editor_layout_campo elc, editor_campo ec, editor_registro er, editor_registro_campo erc, pw_editor_clinico pec, pw_documento_clinico pdc pec.cd_editor_registro = er.cd_registro , pdc.cd_documento_clinico = pec.cd_documento_clinico , ed.cd_documento = ev.cd_documento ...

file upload - Conversion of complex DOCXs to PDFs in a PHP web environment -

i working on php web application programatically generates docx files . want these files to converted pdf , layout complex not php-pdf generator library (dompdf, tcpdf, etc.) works well. result in poorly formatted pdf in each case. in situation, have decided let google drive conversion. this, have to: upload docx files gdrive and export them in pdf... i have seen of gdrive api documentation, poorly documented. want execute 1 single php script which: uploads file gdrive downloads exported pdf version lets pdf downloaded when script finished... i searching optimal way achieve behaviour... (with or without gdrive, since libreoffice/openffice cli command not option because on web hosting , can't install software...). have considered using file conversion service ? for complete transparency work zamzar (an online file conversion website), have released developer api - https://developers.zamzar.com/ allow convert docx files pdf little or no loss of forma...

c - Shared library for Cortex-M0 device -

i ask if knows how create shared library accessed 2 projects. projects bootloader , application, both located @ same cortex-m0 chip , should compile , work under arm gcc , arm mdk. library quite big (about ~70k). language c. i using extern declarations, "symdefs" file symbols+addresses (for mdk) , list of provides: symbols+addresses (for gcc) let linker know shared functionality. the main questions how compile shared library(what options should use) , how instruct linker use library. maybe there relative documentation creating , using shared library of compilers (for chip applications, not desktop ones). i grateful if point me out on documentation.

python - Using return in a while loop -

in continuing quest more control, need put interrupt based on end stop gpio pin switch event. i using return make sure controller change picked when sent, thinking pin 11 event same. pin event not stopping motor. gpio.setup(gpio_sw1, gpio.in, pull_up_down=gpio.pud_up) gpio.add_event_detect(11, gpio.rising) def motorcontrol(direction,fspeed,bspeed): print "motor control: bspeed: " + str(bspeed) +"% : fspeed: " + str(fspeed) + " %" while not gpio.event_detected(11): if direction == "fwd": print "i forward" bck.changedutycycle(0) fwd.changedutycycle(fspeed) time.sleep(0.01) return if direction == "bwd": print "iam backwards" bck.changedutycycle(bspeed) fwd.changedutycycle(0) time.sleep(0.01) return else: bck.changedutycycle(0) fwd.changedutycycle(0) return

php - Generate incremental id of numbers, Upper and Lower letters -

how can generate incremental id in php mixing numbers, lower , upper letters? for example, tried: $hello = "aaa0"; ($i=0; $i < 10000; $i++) { echo $hello++; echo "<br>"; } then, returns; aaa0 aaa1 aaa2 ... aaa9 aab0 aab1 i generate strings as: aaa0 aaa1 aaa2 ... aaaa aaab aaac ... aaaz aaaa first numbers 0 9, chars z, chars z. each positional char should go in range. how can it? edit: want every character in string varies within range. want go 0 9, z, z. when ends, char go 0, , char in left increments in one. example: 0000 0001 0002 ... 0009 000a 000b ... 000y 000z 000a 000b ... 000x 000z 0010 0011 0012 .... 0019 001a using 0,1-9, a-z , a-z "base 62". converting base 10, base 62 easy in php. <?php echo base_convert(10123, 10,26), "\n"; // outputs: 'ep9' echo base_convert('ep9', 26, 10), "\n"; // output 10123

javascript - Get class name of the element in selenium web driver java -

i new selenium web driver right facing issue while getting class name of element html of element <input id="filter-colour-0237739001"><div class="detailbox detailbox-pattern unavailable-colour"><span></span><img src="//lp2.hm.com/hmprod?set=source[/fabric/2014/9b57a69a-fd8d-4d79-9e92-8f5448566c51.jpg],type[fabricswatch]&hmver=0&call=url[file:/product/main]" alt="" title=""> so want extract class name class="detailbox detailbox-pattern unavailable-colour" using selenium web driver. got element below code webelement ele=driver.findelement(by.id("filter-colour-0237739001")); now want class can please me on , okay java script also simply use getattribute() webelement ele=driver.findelement(by.xpath("//*[@id='filter-colour-0237739001']/../div")); ele.getattribute("class") edit guess wanted class of div should using selector ...

Matlab xml parsing delivers empty elements -

i have xml file following structure <?xml version='1.0' encoding='us-ascii'?> <config_paramters name="model"> <joint name = "number_1"> <parameter> <joint param = "minnumber1" value = "-1*m_pi/180" units = "in rad" desc = "max ang 1"/> <joint param = "maxnumber1" value = "-2*m_pi/180" units = "in rad" desc = "min ang 1"/> </parameter> </joint> <joint name = "number_2"> <parameter> <joint param = "minnumber2" value = "1*m_pi/180" units = "in rad" desc = "max ang 2"/> <joint param = "maxnumber2" value = "0*m_pi/180" units = "in rad" desc = "min ang 2" /> </parameter> </joint> </config_paramters> and access nodes, following code retur...

jquery - KnockoutJS event binding on disabled Bootstrap 3 button with tooltip -

i need show dynamic bootstrap tooltip on button explains why button disabled (ie. "fill out name/address/phone", or variation). i'm using bootstrap/jquery/knockoutjs project. i having problems showing bootstrap tooltip on disabled button , found through googling due fact underlying button events not being fired (since button disabled, bootstrap tooltip doesn't work. d'oh!). i'm using knockoutjs click bindings handle button events. issue : know of clean/succinct way disable button click events when button enabled and contains specific css class (ie. btn-disabled ) - knockoutjs click event not called, tooltip still shows up? sample of non-working code: note enable:false data-bind attribute, tooltip not show up. trying recreate behavior style/event handling, not disable control: html: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link rel="stylesheet...