Posts

Showing posts from September, 2011

php - Display ACF data as post title on 'publish' of Wordpress post? -

here code: function my_post_title_updater( $post_id ) { $my_post = array(); $my_post['id'] = $post_id; $brand = get_field('brand'); $asset = get_field('asset'); $language = get_field('language'); $countryfield = get_field_object('country'); $countryvalue = get_field('country'); $country = $countryfield['choices'][ $countryvalue ]; if ( get_post_type() == 'project' ) { $my_post['post_title'] = $brand . ' ' . $asset . ' ' . $country . ' ' . $language ; } wp_update_post( $my_post ); } add_action('acf/save_post', 'my_post_title_updater', 20); on publishing wordpress post function supposed create title based on few advanced custom fields. @ moment gets 'brand', 'asset' , 'language', not 'country'. however, upon clicking 'update' of post display country in title. any appreciated. try: $country = $countryfield[

Use onEdit() to run client function in Google Apps Script web-app -

i have google apps script i've published web app. it's working fine - getting , updating data in spreadsheet. i'd if spreadsheet edited while web app page open in browser can reload data (to changes.) how can call client-side javascript function onedit() event handler? or can display message user tell them reload page. (apparently can't reload them: google apps script location.reload in web app ) would need simple event handler, or installed? a hack-y way reload data every 20 minutes, i'd used on mobile devices, might use data!

jquery - dataTables : javascript not working while paging -

i using datatable creating table , working fine. table consists of checkbox (column1) , select (last column). javascript enable select when checkbox selected. while page next page, javascript of enabling/disabling not working. selects enabled. javascript <script> var update_selectopt=function(){ $("tr").each(function(){ if($("input[type='checkbox']", this).is(":checked")){ $('#select',this).removeattr('disabled'); } else { $('#select',this).attr('disabled','disabled'); } }); }; $(update_selectopt); $("input[type='checkbox']").on("click",update_selectopt); </script> how manage that? fire update_selectopt function after paging event has happened on table: $('#table_ws').on( 'page.dt', function () { update_selectopt(); }); edit try this: $('#table_ws').on( 'draw.dt',

Is it possible to feed the Soundcloud widget a list of song track IDs? -

is possible feed soundcloud widget list/array of song ids, or need listen specific events , load them in way? sure, can. next time, pls come code. docs: https://developers.soundcloud.com/docs/api/html5-widget playground: https://w.soundcloud.com/player/api_playground.html (i guess in playground example find list example, favs user id 1539950)

What is the minimum number of bits I need to express a n-bit, signed std_logic_vector in VHDL? -

i'm new vhdl , trying find way take n bit (stored generic) signed number , truncate form requires minimum number of bits. for example, if have 5 8 bit signed number (stored in std_logic_vector of length 8) 00000101, i'd make function return 0101 std_logic_vector. ideas on how can accomplish this? since have specified you're using signed value, may want use signed type (from numeric_std library) instead of more generic std_logic_vector . if number compile time constant, can write function starting leftmost bit (in loop example) counts how many identical bits sees, returns signed_input(8-result downto 0) . issue compile time constant, there isn't advantage in removing redundant bits. whole vector optimized away in synthesis. you might want include special cases make result @ least 1 bit (0 technically doesn't need bits represest) or 2 bits (-1 needs sign bit distinguish 0) depending on how want use signed type value. if number real signal (the v

debugging - Chrome Debugger Api Attach Extension Error -

task: debug other extensions using chrome debugger api . expected output: http request logs made other installed extensions. method: running chrome webdriver selenium in python setting flag chromeopts.add_argument('--silent-debugger-extension-api' ) . inside extension, on event chrome.management.oninstalled using following code chrome.debugger.attach({ extensionid: info.id }, version, onattach.bind(null, info.id)); chrome.debugger.sendcommand({ extensionid: info.id }, "network.enable"); chrome.debugger.onevent.addlistener(onevent); error: cannot access chrome-extension:// url of different extension to debug background page of extension, need set 2 flags: --silent-debugger-extension-api allow debugging of background pages. --extensions-on-chrome-urls allow debugging of other extensions.

android - Overlaying content AppBarLayout using new Material Design -

Image
i want achieve that. (not fab or snackbar). how can create layout, overlaying appbarlayout? this! v like play store! v my appbarlayout coordinatorlayout , nestedscrollview relativelayout content looks this! v <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rootlayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="@dimen/_118sdp" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsingtoolbarlayout" android:layout_width="match_parent

infopath - Limit number of words in the text box -

i new info path, know how limit no.of characters entered in text box using string-length function. there way can limit number of words entered in multiline text box. for example field asking enter 10 words lesser found answer , wanted share it set validation rule field(textbox). in condition select "the expression" , type below condition string-length(field)-string-length(translate(field," ","")) <10 here field name of textbox. , enter text in screen tip (eg: lesser 10 words) , click more option if want screentip , dialog box message. testing in preview type more 10 words , hit tab dialogue box lesser 10 words appear

javascript - Angularjs don't post hidden value -

i make $http.post call, hidden fields not posted form. code: <sf:form ng-submit="post(form)" id="respond" > <input type="hidden"name="form.replyto" ng-model="replyto" ng-value="1"> <input type="hidden" name="form.id" ng-model="id" ng-value="33" > <input class="diskafield" type="text" ng-model="form.name" > <input class="diskafield" type="text" ng-model="form.email" > <textarea class="diskafield" name="comments" ng-model="form.body" required=""></textarea> <input class="diskabtn" type="button" ng-click="post(form)" value="post comment"> </div> </sf:form> and controller :

javascript - How to add lang attribute to DataTables.js search box -

i using jquery plugin needs add attribute inputs in page. $("input").attr('lang', 'fa'); i have no problem adding inputs except datatables search box code doesn't affect. i tried code doesn't work: $(document).ready(function () { var table = $('#orderstable').datatable(); $('.datatables_filter input').attr('lang','fa'); $("input").attr('lang', 'fa'); }); edit: tried many things problem still exists. see problem @ this link , type numbers in search box , input box @ bottom of page. cause datatables uses <input type="search"> search box. reason applying lang attribute doesn't have effect on input type. solution changing input type <input type="text"> fixes issue. $('#example').datatable(); $('.datatables_filter input').attr({'lang': 'fa', 'type': 'text'});

angularjs - Programmatically collapse/expand bs-collapse in controller -

is there method collapse/expand angular-strap's collapse element in controller? i want collapse bs-collapse element when content clicked. need control state of bs-collapse element. expect $collapse service bs-modal has, angular-strap not provide that.

jquery - Blueimp - Not able to view uploaded files in IE -

when upload file using default settings blueimp jquery file upload on webserver, i'm unable view files in internet explorer 11. upload completes ie once upload completes, space filename/start/cancel disappears , appears though no files exist. when open page in chrome , firefox, can see of files including new 1 uploaded in ie. i'm using basic plus ui. i same results using demo site github https://blueimp.github.io/jquery-file-upload/index.html any appreciated!

python - How to refresh tkinter entry value? I get a 1-click lag -

i built interface user fills hierarchical form. past values displayed in ttk.treeview . allow user edit previous values clicking on tree. value gets filled on form can edited , overwriten. the problem: value insert on entry widget displayed next time user clicks it, 1 click lagging. please run sample code better understanding. gets confusing because if user clicks value , another, display clicked value. it must have event handling routine in tkinter, not find , answer. how can rid of lag? import tkinter tk tkinter import ttk root = tk.tk() def cb_clique(event): item = tree.selection()[0] entry1.delete(0, "end") entry1.insert(0, item) entry1 = tk.entry(root, width=15) entry1.grid(row=1,column=1) tree = ttk.treeview(root) tree.bind("<button-1>", cb_clique) tree["columns"]=("valor") tree.column("valor", width=200 ) tree.heading("valor", text="valor") tree.grid(row=3, column = 1, columns

r - Reshape2 dcast() function returning wrong values -

i have tick data equities in dow jones industrial average on course of day. here sample of data: > head(df) ts sym ask 1: 2015-03-24 14:00:00.000 ymm5 17956.00 2: 2015-03-24 14:00:00.002 aapl 126.91 3: 2015-03-24 14:00:00.005 unh 118.35 4: 2015-03-24 14:00:00.009 xom 84.64 5: 2015-03-24 14:00:00.014 axp 81.35 6: 2015-03-24 14:00:00.016 pg 84.19 i trying use dcast() function of reshape2 transform data wide format, like: ts aapl axp pg unh xom 1: 2015-03-24 14:00:00.000 126.91 81.35 84.19 118.35 84.64 when try following set of commands though, here get: tick <- data.table(read.csv("2015-3-24.csv")) df<- data.table(ts = tick$datetime, sym = tick$symbol, ask = tick$ask, bid = tick$bid) tmp <- dcast(data = df, formula = ts ~ sym) head(tmp) ts aapl axp ba cat csco cvx dd dis ge gs hd ibm intc jnj jpm ko mcd mmm mrk msft nke pfe pg trv unh utx v vz

Android custom horizontal drag tremble -

i created class should used allow user horizontally relocate view sliding finger on bar, code this public class dragger implements view.ontouchlistener { private view todrag; private point startdragpoint; private int offset; public dragger (view bar, view todragg){ todrag = todragg; dragging = false; bar.setontouchlistener(this); } public boolean ontouch(view v, motionevent evt) { switch (evt.getaction()) { case motionevent.action_down: startdragpoint = new point((int) evt.getx(), (int) evt.gety()); offset = startdragpoint.x - (int) todrag.getx(); break; case motionevent.action_move: int currentx = (int)evt.getx(); log.d("log","currentx=" + currentx); todrag.setx(currentx-offset); break; case motionevent.action_up: int difference = (startdragpoint.x-offset)-(int)todrag.getx(); if(difference<-125){ ((view

java - Creating possible combinations from Hashmap -

i have hashmap below { hhsize=[hhsize4+, hhsize1, hhsize2, hhsize3], aob=[aob<30, aob30_50, aob60plus, aob50_60], asp=[asp=n, asp=y]} i need generate possible combinations of value pairs. cartesian product example. [[hhsize4+,aob<30,asp=n], [hhsize4+,aob<30,asp=y], [hhsize4+,aob30_50,asp=n], [hhsize4+,aob30_50,asp=y], and on. how can go this? using guava sets : list<set<string>> values = map.values() .stream() .map(hashset::new) // set .collect(collectors.tolist()); set<list<string>> = sets.cartesianproduct(values);

php - How to add authentication to GuzzleHTTP Request Objects for asynchronous processing -

i creating multiple of following guzzlehttp\psr7\requests: use guzzlehttp\psr7\request; $myrequest = new request( 'get', $someuri ); and save them in array: $guzzlerequests i create pool simultaneously execute requests: use guzzlehttp\pool; $testpool = new pool($testclient = new \guzzlehttp\client(), $guzzlepromises, [ 'fulfilled' => function ($response, $index) { // delivered each successful response var_dump($response); }, 'rejected' => function ($reason, $index) { // delivered each failed request var_dump($reason); } ]); // initiate transfers , create promise $promise = $testpool->promise(); // force pool of requests complete. $promise->wait(); (taken doc: http://guzzle.readthedocs.org/en/latest/quickstart.html under "concurrent requests") this works requests uris don't need authentication , retu

http status code 404 - Symfony's createNotFoundException not returning 404 page -

Image
i have symfony action trying return 404 error when query returns null. i regular page's template returned , 200 http return code. i have checked , error logs show createnotfoundexception firing. i running symfony 2.7.1 any ideas why code not returning 404 page? <?php namespace example\groupbundle\controller; use symfony\bundle\frameworkbundle\controller\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\template; use sensio\bundle\frameworkextrabundle\configuration\method; use symfony\component\httpfoundation\request; use example\groupbundle\entity\group; /** * class supportgrouplandingcontroller * @package example\groupbundle\controller * * @route("/group") */ class supportgroupcontroller extends controller { /** * @route("/{name}", name="support_group_page") * @method("get") * @template("examplegroupbundle::group_page.

Visual Studio - How can I change the publisher name -

Image
after publishing project, program shows publisher name when installing. need change publisher name else. i've tried changing publisher name going project > properties > publish tab > , options, doesn't change anything. i've tried changing certificate information going project > properties > signing... i'm little stuck there too. doing wrong?

android :: show progress dialog till asynctask does not get complete -

i downloading zip file of 15 mb , unzip in sd card. using progress dialog show status. first time works perfectly, , when change db version number on server download new file , start app again progress dialog disappears in between , causes crash in app. below code. class checkinappupdatesasynctask extends asynctask<void, void, void> { dialog progress; @override protected void doinbackground(void... params) { try { downloaddb(); } catch (exception e) { } } @override protected void onpostexecute(final void result) { stopworking(); } @override protected void onpreexecute() { startworking(); } };5 private void startworking() { synchronized (this.diagsynch) { if (this.pdiag != null) { this.pdiag.dismiss(); } this.pdiag = progressdialog.show(browse.context, "working...", "please wait while load encyclope

c# - How to invert a System.Predicate<T> -

let's have predicate<t> , , want call method foo said predicate returning true, , want call method bar predicate returning false, how can this: predicate<int> p = => > 0 foo(p); bar(!p); // doesn't work if predicate func<int, bool> f , !f(i) you can create method return "inverted" predicate - make extension method: public static predicate<t> invert<t>(this predicate<t> predicate) { // todo: nullity checking return x => !predicate(x); } then: bar(p.invert()); basically it's you'd if had func<int, bool> - there's nothing "magic" either of delegate types.

java - Adding the output of Stack.pop() -

import java.util.random; import java.util.stack; public class blackjack { public static void main(string[] args) { int cardvalue; /* card value 2 11 */ stack player1 = new stack(); stack addition = new stack(); random r = new random(); int = 2 + r.nextint(11); system.out.println("welcome mitchell's blackjack program!"); (int = 1; <= 2; a++) { /* start's game assigning 2 cards each, players */ player1.push(i); } while (!player1.empty()) { system.out.print("you " + player1.pop()); system.out.print("and"); int sum = 0; (int n = 0; n < player1.size(); n++) { sum = sum + player1.pop(); system.out.print("your total " + sum); } } } } so started learning java , i'm trying accomplish blackjack project but, when try compile using javac output bad operand types binary operator '+' 'sum = sum + player1.pop();' the

Build failed when generate signed APK with Android Studio -

when try build project, error occurred: error: "mail_subtitle" translated here not found in default locale [extratranslation] error: "login_subtitle" translated here not found in default locale [extratranslation] error: "password_subtitle" translated here not found in default locale [extratranslation] ~~~~~~~~~~~~~~~~~~~~~ /xxxxxx/src/main/res/values-es/strings.xml:336: translated here explanation issues of type "extratranslation": if string appears in specific language translation file, there no corresponding string in default locale, string unused. (it's technically possible application intended run in specific locale, it's still idea provide fallback.). note these strings can lead crashes if string looked on locale not providing translation, it's important clean them up. > lint found fatal errors while assembling release target. proceed, either fix issues identifi

node.js - Why cant parse JSON from file? -

we have empty json file want write new json objects in file, , array of json objects (and after append new jsons array 'push') write file incoming json object: fs.writefilesync(tasks, updatedjsonstr, encoding='utf8'); where updatedjsonstr = json.stringify({"iscompleted":false,"task":"dfgdfg","date":"25.06.2015"}); so in file see added object. after file our json objects: tasksjsonobj = json.parse(fs.readfilesync("tasks.json", "utf-8")); append new json object string , write again: updatedjsonstr = json.stringify(tasksjsonobj) + ',' + json.stringify(newjsontask); fs.writefilesync(tasks, updatedjsonstr, encoding='utf8'); see 2 json objects in file. !but when try read file 2 json objects - got error when reading json file ([syntaxerror: unexpected token ,]): try{ tasksjsonobj = json.parse(fs.readfilesync(tasks, "utf-8")); console.log('aa

xamarin.ios - How to use AutoLayout in Xamarin iOS? -

i creating view without using storyboard or xib. using mvvmcross in project , binding controls this: using system; using system.drawing; using corefoundation; using uikit; using foundation; using cirrious.mvvmcross.touch.views; using cirrious.mvvmcross.binding.bindingcontext; namespace mobile.ios.views { /// <summary> /// home screen of iphone /// </summary> [register("homeview")] public class homeview : mvxviewcontroller { /// <summary> /// method load view /// </summary> public override void viewdidload() { view = new uiview() { backgroundcolor = uicolor.white }; this.title = "home"; base.viewdidload(); var lblhome = new uilabel(new rectanglef(80, 100, 300, 40)); lblhome.textcolor = uicolor.green; add(lblhome); var btnsignin = new uibutton(uibuttontype.roundedrect);

java - JavaCC Lexer Generator Integration the NetBeans Platform -

i new in using javacc. trying integrate editor our company defined language. need change keywords , modify syntax. follow this link procedure. testing change lines below code link. change keyword finally require . change following lines in code. javaparserconstants.java int false = 25; /** regularexpression id. */ int final = 26; /** regularexpression id. */ //int = 27; int require=27; /** regularexpression id. */ int float = 28; /** regularexpression id. */ * * string[] tokenimage = { * "\"false\"", "\"final\"", "\"require\"",//fınally "\"float\"", sjlanguagehierarchy.java private static void init() { tokens = arrays.<sjtokenid>aslist(new sjtokenid[]{ * * new sjtokenid("false", "keyword", 25), new sjtokenid("final", "keyword", 26), n

pandas - subtract two columns of different Dataframe with python -

i have 2 dataframes, df1: lat1 lon1 tp1 0 34.475000 349.835000 1 1 34.476920 349.862065 0.5 2 34.478833 349.889131 0 3 34.480739 349.916199 3 4 34.482639 349.943268 0 5 34.484532 349.970338 0 and df2: lat2 lon2 tp2 0 34.475000 349.835000 2 1 34.476920 349.862065 1 2 34.478833 349.889131 0 3 34.480739 349.916199 6 4 34.482639 349.943268 0 5 34.484532 349.970338 0 i want substract (tp1-tp2) columns , create new dataframe colums lat1,lon1,tp1-tp2. know how can it? import pandas pd df3 = df1[['lat1', 'lon1']] df3['tp1-tp2'] = df1.tp1 - df2.tp2 out[97]: lat1 lon1 tp1-tp2 0 34.4750 349.8350 -1.0 1 34.4769 349.8621 -0.5 2 34.4788 349.8891 0.0 3 34.4807 349.9162 -3.0 4 34.4826 349.9433 0.0 5 34.4845 349.9703 0.0

Passing Variable to 7zip from powershell -

i can see there have been similar question answered nothing seems have answers i'm looking for, have tried using solutions/modifying them suit needs unable correct outputs. my main question is: can pass powershell variables 7zip's command line. currently have script: ##########alias setting########## if (-not (test-path "$env:programfiles\7-zip\7z.exe")) {throw "$env:programfiles\7-zip\7z.exe needed"} set-alias sz "$env:programfiles\7-zip\7z.exe" ############################################ #### variables $filepath = "d:\logs\test\201310\" #location in $archive = "d:\logs\test\201310\" $extension = "*.log" #extensions $days = "30" #number of days past today's date archived $cutday = [datetime]::now.adddays($days) $log = get-childitem $filepath -include $extension -recurse | where-object {$_.lastwritetime -lt $cutday} ########### end of varables ################## foreach ($file in $lo

javascript - Canvas animation flickering under Firefox -

no matter do, can't fluent canvas animation under firefox. set simple test code absolutely nothing except calling empty draw function every 1/40 s , it's still flickering. var t = 0; function draw(time) { console.log(math.round(time - t)); t = time; } setinterval(function(){ requestanimationframe(draw); }, 25); delay between frames under firefox jumps on 150 ms noticable human eye. same thing happens when using simple setinterval call draw() , without requestanimationframe . runs under chrome , opera. i've tried getting rid of setinterval , results same: var t = 0; function draw(time) { requestanimationframe(draw); console.log(math.round(time - t)); t = time; } draw(); is known issue? there way work around it? turns out current implementation of requestanimationframe under firefox terrible , fails provide smooth animation when called timers or network events (even repeated @ constant interval). this makes hard redraw canvas when state u

javascript - What do these three dots in React do? -

what ... in react (using jsx) code , called? <modal {...this.props} title='modal heading' animation={false}> those jsx spread attributes : spread attributes if have props object, , want pass in jsx, can use ... "spread" operator pass whole props object. these 2 components equivalent: function app1() { return <greeting firstname="ben" lastname="hector" />; } function app2() { const props = {firstname: 'ben', lastname: 'hector'}; return <greeting {...props} />; } spread attributes can useful when building generic containers. however, can make code messy making easy pass lot of irrelevant props components don't care them. recommend use syntax sparingly. that documentation used mention although (for now) jsx thing, there's proposal add object rest , spread properties javascript itself. (javascript has had rest , spread arrays since es2015, not object properties.)

javascript - how to convert html into dynatable or datatable -

my php page returns html table data, need convert either datatable or dynatable, tried including required files (javascripts , css) page php return table , in javascript function used <script> $(document).ready(function() { $('#mytable').dynatable(); }); </script> it returns html table only, no dynatable features or paging. i have tried datatables not working you need include datatable.js , can function: $(document).ready(function() { $('#mytable').datatable(); });

python - Regular expression for a list of elements in patents -

given patent, how produce regular expression filter out element list in description? elements can identified by: 'a' or 'the' before element a digit after element for example, given paragraph: 'fig. 1 shows base 10 adjustable cord holding device according embodiment of present invention. base 10 may comprise base hole 16 allow cord pass through base 10. shape of base hole 16 depends on intended use of adjustable cord holding device. if cross section of cord round, base hole 16 may round. on other hand, when intended cord belt, cross section rounded rectangle, base hole 16 may rounded rectangle.' i use regular express spit out ['a base 10', 'the base 10', 'a base hole 16', 'the base 10', 'the base hole 16', 'the base hole 16', 'the base hole 16'] you can use re.findall() : >>> re.findall(r'((?:a|the)(?:(?!(?:\ba\b|\bthe\b)).)*\d+)',s,re.i) ['a base 10

ssh - Connect Remotely to Centos installed on Vmware -

i have centos7 installed on vmware, , i'm able access through ssh computer vmware installed. need access virtual machine computer. possible? , steps complete this? it possible. need bridge network adapter 1 on vm, , accessible same way pc is.

mysql - Multiple condition in a single SUMIF function -

select ifnull(sum(if(a=1 , b=2, 'correct', null)),0) table please using such function above in query. although works want know if right way of handling multiple conditions within 1 single query in mysql. thanks no. not correct. cannot sum string value. mysql convert number. because 'correct' starts letter, query return 0. i think intend: select sum(if(a=1 , b=2, 1, 0)) correct table note gets rid of outer ifnull() . suggest using coalesce() rather if() because ansi standard functionality. however, conditional not needed. the query can further simplified. in fact, best way write query is: select count(*) table = 1 , b = 2; in general, better write queries conditions in where clause rather in conditional statements (if possible). reduces number of rows rest of query needs process.

javascript - How can I sort array by a field inside a MongoDB document -

Image
i have document called question var questionschema = new schema({ title: { type: string, default: '', trim: true }, body: { type: string, default: '', trim: true }, user: { type: schema.objectid, ref: 'user' }, category: [], comments: [{ body: { type: string, default: '' }, root: { type: string, default: '' }, user: { type: schema.types.objectid, ref: 'user' }, createdat: { type: date, default: date.now } }], tags: { type: [], get: gettags, set: settags }, image: { cdnuri: string, files: [] }, createdat: { type: date, default: date.now } }); as result, need sort comments root field, i tried sor

qt - How can I get the first visible item/index from a ListView? -

how can first item / index visible in listview ? looked inside documentation , searched lot on internet couldn't find anything. know how that? thank you! you should use that: listview { id: contacts model: usersmodel oncontentychanged: { var currentindexattop = indexat(1, contenty) var currentpropfrommodel = usersmodel.get(currentindexattop).name } } if indexat return -1 means not found, check if need! contenty - property of listview, return current position top y-coord of viewlist window on flickable grid listview. see documentation more details http://doc.qt.io/qt-5/qml-qtquick-listview.html#indexat-method

dplyr - How can I split my sheet with 3 different dataset in R -

see sample data: link i split data above 3 different data following rule below. only have 'aid' (10 string starting "oa") only have 'cid' (14 numeric) have nothing ('-', na , etc) i tried use dplyr couldn't find right solution. change column char as.character(data3$aid) as.character(data3$cid) use dplyr filter library(dplyr) q1 <- data3 %>% filter(nchar(data3$aid) >= 10) q2 <- data3 %>% filter(nchar(data3$cid) >= 14) q3 <- data3 %>% filter(nchar(data3$aid) < 10 & nchar(data3$cid) < 14) okay, i'm done

extjs4 - ExtJS Paging toolbar with an ability to select items count per page -

im using extjs 4.2 ext.toolbar.paging , want have ability select items count on page, ie set pagesize of store. my solution extend existing ext.toolbar.paging, maybe there easier solution? or solution can improved? solution: ext.require([ 'ext.toolbar.paging' ]); ext.define('ext.lib.extensions.portalpagingtoolbar', { extend: 'ext.toolbar.paging', alias: 'widget.portalpagingtoolbar', alternateclassname: 'portal.pagingtoolbar', /** * objects per page default */ objectsperpagedefault: 25, /** * objects per page text */ objectsperpagetext: 'objects per page:', /** * gets paging items in toolbar * @private */ getpagingitems: function () { var me = this; return [ { itemid: 'first', tooltip: me.firsttext, overflowtext: me.firsttext, iconcls: ext.basecsspref

understanding assembly language lea instruction -

i don't understand why line 8 performed, can explain please? on line 10 strcpy called, 0x80482c4 doesn't contain reference 'hello world' (checked gdb). thinking esp pointing starting memory address of 'hello world' , esp being executed when strcpy called? guess @ line 9 is setting enough space 'hello world' char array in code initialized 20. 1. push ebp 2. mov ebp,esp 3. sub esp,0x38 // why happen? 4. , esp, 0xfffffff0 5. mov eax,0x0 6. sub esp,eax 7. mov dword ptr [esp+4],0x80484c4 //contains 'h' 8. lea eax,[ebp-40] // going on here? why ebp-40 bytes? 9. mov dword ptr [esp], eax 10. call 0x80482c4 <strcppy@plt> 11. lea eax,[ebp-40] 12. mov dword ptr [esp],eax 13. call 0x80482d4 <printf@plt> 14. leave 15. ret c equivalent: #include #include int main() { char str_a[20]; strcpy(str_a, "hello, world!\n"); printf(str_a); } 0x

Using "position: static" for pseudo classes for icon (CSS) -

i trying make hamburger menu, , succeeded accidentally below. i'd know why goes wrong if set position: static , default value of position , #hamburger:before , #hamburger:after . also, in setting above, shouldn't these 2 show in front , of #hamburger ? (so there 3 pieces of bread in row.) #hamburger, #hamburger:before, #hamburger:after { position: absolute; /* here! */ display: block; width: 35px; height: 5px; background-color: red; border-radius: 1px; content: ''; } #hamburger:before { top: -10px; } #hamburger:after { bottom: -10px; } <div id="hamburger"></div> here's js bin test. a element has position:static positioned normal flow of page. in addition this, html elements position:static default. position:static , default value position same value. the reason why things aren't working because static positioned elements unaffected top, bottom, right , left properties.

php - TYPO3 translate to NOT current language -

i have typo3 extension template: {namespace v=tx_vhs_viewhelpers} <f:translate id="lll:typo3conf/ext/my_ext/resources/private/language/fr.locallang.xlf:labelterms" /> <f:translate id="lll:typo3conf/ext/my_ext/resources/private/language/it.locallang.xlf:labelterms" /> if current language french, first label translated french, second displays in english (default). when switch current language italian, second label displays in italian first displays in english how can use 2 or more languages in same time on 1 page? thank in advance. basically, can not use 2 languages in same time on page. typo3 use current language , give asked for. what can render 'translations' outside typo3 translation scope, meaning can, ex, use source of translated terms not treated typo3 translation (can array somewhere , etc ...) or implement translations of other languages in xlif specific languages. make translation of fr, etc .. terms available in

Prestashop:Create a module that override another module? -

i create module , module should change module (mailalerts) , temporarily overridden module folder /override/ , wish in module. if have /modules/mymodule/override/modules/mailalerts/mailalerts.php , then file copied /override/modules/mailalerts/mailalerts.php , after mymodule installation. be aware making module overrides other modules not practice. should use module overrides own or client website , place them directly in /override/modules/ folder.

ranorex - Some 3rd party controls are not always accessable in UI Automation -

i using ranorex automation tests against our application, consists of several 3rd party controls, devexpress gridcontrol. in cases grid rows accessible. however, can happen grid rows not accessible (for 1 minute), if play ranorex spy time. do know problem be? that sounds strange. mean grid can recognized after 1 minute , happens ranorex spy. if run test? wrote happen sometimes, did find out when? is there difference when using external spy , spy integrated in ranorex studio?

ios - How to apply auto layout to a group of items in Xcode? -

Image
for example, add 1 label , 2 text fields main view. after that, want this group of items centered horizontally. is, center of group on center of superview. how achieve xcode or programmingly? here steps 1. add subviews container add constraints inside container labels , textfields add width / height constraint container align horisontally constraints should

javascript - Why my page gives me 404 -

i create new controller in codeigniter: class extends ci_controller{ public function up(){ $this->load->view('get_view.php'); } } and view executes javascript operation: <script src="/js/update.php" type="text/javascript"></script> <?php ?> <script> updatedb(); </script> now modify routes in way: $route['get']='get/up'; but when go link "localhost/get", gives me 404. can me? make sure url helper autoloaded your loading php in javascript think instead of update.php best update.js then try <script type="text/javascript" src="<?php echo base_url('assets/js/update.js');?>" ></script> assets folder in main directory. update: make sure class , file names of models , controllers make sure first letter uppercase example welcome.php , not welcome.php

c# - Entity framework 6 transaction -

i need insert new rows in 2 of tables first table's auto generated id field 1 of field of second table .currently i'm using transaction inserting data. current code given below using (var context = new applicationdatabaseentities()) { using (var transaction = context.database.begintransaction()) { try { foreach (var item in itemlist) { context.myfirstentity.add(item); context.savechanges(); mysecondentity.myfirstentityid = item.id; context.mysecondentity.add(mysecondentity.myfirstentityid ); context.savechanges(); } transaction.commit(); } catch (exception ex) { transaction.rollback(); console.writeline(ex); }

asp.net mvc - Force Angular function to complete -

i have angular function contained within angular controller on login page supposed set localstorage values here function $scope.setinfo = function () { getinfo.getfromserver($scope.username, $scope.password).then(function(response) { console.log("got here!"); localstorage["yat"] = response.data.access_token; localstorage["yrt"] = response.data.refresh_token; }, function() { console.log("error occured"); }); } the function executed on ng-click event of login button posting mvc controller authenticate user , redirect landing page. when looking @ console.log("got here!"); statement can see not reached, getinfo.getfromserver method never called, when restarting application in visual studio, can see statement reached. will redirect of mvc controller have affect on completion of angular function, or might possible application redirected before angular function got chance execute me

androidplot Get Y Value in Series From Touch -

so far can y value of touch on graph so. mspeedplot.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { pointf click = new pointf(event.getx(),event.gety()); if ( mspeedplot.getgraphwidget().containspoint( click )) { log.d("hof","plot x: "+distancevalue.frommetres(mspeedplot.getxval(click).doublevalue()).km()+"km "+" y: "+mspeedplot.getyval(click)+"km/h"); } return false; } }); what want instead of return y value of touch was, want y value of series plotted on graph corresponds x value. any way this? ok solved it. i use original number[] used populate simplexyseries . has x , y values interleaved i'm going need someway of finding index of x value in number[] have retrieved using code in question. so process data before add nu

foreach - How do I iterate over a stream in Java using for? -

this question has answer here: why stream<t> not implement iterable<t>? 7 answers i have code: list<string> strings = arrays.aslist("a", "b", "cc"); (string s : strings) { if (s.length() == 2) system.out.println(s); } i want write using filter , lambda: for (string s : strings.stream().filter(s->s.length() == 2)) { system.out.println(s); } i can iterate on array or instance of java.lang.iterable . i try: for (string s : strings.stream().filter(s->s.length() == 2).iterator()) { system.out.println(s); } and same error. possible? prefer not stream.foreach() , pass consumer. edit: it's important me not copy elements. you need iterable able use for-each loop, example collection or array: for (string s : strings.stream().filter(s->s.length() == 2).toarray(string[]::

.net - Unable to send required set of tags in response to a web method -

i trying call method service hosted @ client ip , 1 of method need response string . method needs response string following tags : <a> <user>abc</user> <userdetails>xyz</user details> <userdetails>asd</userdetails> <userdetails>qwe</userdetails> </a> i have created custom class generate response class a{ public string user{get;set;} public string [] userdetails {get; set} } i facing issue while populating user details every time convert object xml object userdetails modified <userdetails> <string>xyz</string> <string>qwe</string> </userdetails> kindly suggest solution how can output user details as <a> <user>abc</user> <userdetails>xyz</userdetails> <userdetails>qwe</userdetails> </a>

php - mysql - Query by interval and or returning nothing -

i need select emails users table weekly_mail (datetime) older 1 week or null , if user's points add more 10. it's not returning now. points_plus table structure id | user_id | points | date 1 62 5 2015-05-13 08:42:37 2 62 15 2015-05-14 03:12:32 query $q = "select u.email, u.weekly_mail, sum(p.points) points users u left join points_plus p on u.id = p.user_id points > 10 , u.weekly_mail < now() - interval 1 week or u.weekly_mail = null group p.user_id"; $result = $this->db->mysqli->query($q); if (!$result) { printf("query failed: %s\n", $this->db->mysqli->error); exit; } $rows = array(); while($row = $result->fetch_row()) { $rows[]=$row; } $result->close(); return $rows; check this: $q = "select u.email, u.weekly_mail, sum(p.points) points users u left join points_plus p on u.id = p.user_id u.weekly_m

Active directory syncronization -

i have situation. how synchronize active directoy created in 1 vm with, active directory created on vm, lying in same network. vms in azure. has nothing azure active directory. simple purpose replicate , synchronize. i think got way achieve this. create 2 vnets in azure. make sure ip ranges not overlap. create 2 local networks on azure. establish cross-site conectivity between vnet vnet. use linc https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-configure-vnet-to-vnet-connection/ create 2 vms, 1 in each vnet. install ad ds on them. also, install dns on them static ip. create users in active directory of 1 of vm. establish communictation between 2 vms. users created in 1 vm syced in vm.

string - Invalid user conversion from char error (converting postfix using stack) -

i'm working on project convert postfix infix using stack implemented through linked list. i'm trying take in line , pushing each character onto stack keep getting error. error: invalid user-defined conversion ‘char’ ‘const stack_element& {aka const std::basic_string&}’ here code: #include "stack.h" string convert(string expression) { stack c; string post = " "; (int =0; i<expression.length(); i++) { c.push(expression[i]); } } int main() { string expression; cout<<" enter post fix expression: "; getline(cin,expression); return 0; } and here push function written in .cpp file void stack::push(const stack_element & item) { cout<<"inside push \n"; stack_node *p = new stack_node; p->data = item; p->next = s_top; s_top = p; } do not use const parameter in push function void stack::push(stack_element & item)

php - session error in codeigniter? -

when want set session data in codeigniter 3 says error like: a php error encountered severity: warning message: mkdir(): invalid path filename: drivers/session_files_driver.php line number: 117 backtrace: file: c:\xampp\htdocs\ci-test\application\controllers\login.php line: 7 function: __construct file: c:\xampp\htdocs\ci-test\index.php line: 292 function: require_once here code want set session data. $sess_array = array( 'id' => 1, 'username' => 'bikramkc.kc@gmail.com' ); $this->session->set_userdata($sess_array); sharing solution helped me, try set config variable like: $config['sess_save_path'] = sys_get_temp_dir();

How to split a CSV file into multiple chunks and read those chunks in parallel in Java code -

i have big csv file (1gb+), has 100,000 line. i need write java program parse each line csv file create body http request send out. in other words, need send out 100,000 http requests corresponding lines in csv file. long if these in single thread. i'd create 1,000 threads i) read line csv file, ii) create http request body contains read line's content, , iii) send http request out , receive response. in way, need split csv file 1,000 chunks, , chunks should have no overlapped lines in each other. what's best way such splitting procedure? reading single file @ multiple positions concurrently wouldn't let go faster (but slow down considerably). instead of reading file multiple threads, read file single thread, , parallelize processing of these lines. singe thread should read csv line-by-line, , put each line in queue. multiple working threads should take next line queue, parse it, convert request, , process request concurrently needed. splitting

openedge - How to check if string is a palindrome in open edge progress 4gl -

how can check whether given string palindrome or not in open edge progress 4gl? there reverse string function built-in progress 4gl? function reversestring returns character ( input i_c character ): define variable cresult character no-undo. define variable ii integer no-undo. ii = length( i_c ) 1 -1: cresult = cresult + substring( i_c, ii, 1 ). end. return cresult. end function. display reversestring( "asdf" ). the complete openedge doc set can found here: https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1329.openedge-product-documentation-overview.aspx as can see, there no built-in reverse string function. a function 1 illustrate above need. to determine if string palindrome using function: mystring = "asdf". if mystring = reversestring( mystring ) message "yes," mystring "is palindrome". else message "no," mystring "is not pa

jquery - AJAX Post request from Javascript to Python (Django, views.py) -

i trying send post request javascript views.py using ajax. however, getting 403 error stating csrf token not present. in order resolve issue followed this link , included function in javascript. however, confused next step should be. any assistance appreciated. thanks! simply add somewhere in template: {% csrf_token %} then in js file should smth this: var csrf_token; var sendsomeajax = function(target) { var requesturl = $(target).data('url'); return $.ajax({ url: requesturl, type: 'post', headers: { 'x-csrftoken': csrf_token }, datatype: 'json' // can pass 'data: ' here }) }; $(function() { csrf_token = $('input[name="csrfmiddlewaretoken"]').val(); var target = $('.someselectorwhereyouhavepasseddataurltoyourview'); // example in template <a href="#" data-url="{% url 'app_url_namespace:vi

selenium - Spaces in CSS Selector-Webdriver -

when trying locate below div class name,i unable find, <div class="large 20 columns">..</div> i tried dr.findelement(by.cssselector("div.large.20.columns']")); but unable locate. please let me know, there way locate class name space using css selector. relying on layout-oriented class names large not idea in general. use just: div.columns if not enough uniquely identify element, additionally check other attributes, specific parent, child or adjacent elements.

sql server - How Change the '23:00:00' time to something like '11:00PM' in sql query? -

i have been trying calculation date. want '23:00:00' display '11:00pm' does know on how this?i know might simple one. thanks can try this select convert(varchar,convert(time,getdate()),100)

webrtc - Webm (VP8 / Opus) file read and write back -

i trying develop webrtc simulator in c/c++. media handling, plan use libav . thinking of below steps realize media exchange between 2 webrtc simulator. have 2 webrtc simulators a , b . read media @ input webm file using av_read_frame api. i assume encoded media (audio / video) data, am correct here? send encoded media data simulator b on udp socket. simulator b receives media data in udp socket rtp packets. simulator b extracts audio/video data received rtp packet. i assume extracted media data @ simulator b encoded data ( am correct here ). not want decode it. want write file. later play file check if have done right. to simplify problem lets take out udp socket part. question reduces read data webm input file, encoded media, prepare packet , write output file using av_interleaved_write_frame or other appropriate api. these things want using libav. is there example code can refer. or can please guide me develop it. i trying test program. first step, aim read