Posts

Showing posts from January, 2014

How to get Action and Controller name in ASP.Net Core MVC app? -

how action , controller names in asp.net mvc core rc1 application in startup.cs ? i want create middleware , log information (i want log detailed response database, need action , controller info.) after following code in configure method of startup.cs - app.usemvc(routes => { routes.maproute( name: "default", template: "{controller=user}/{action=index}/{id?}"); }); //want action , controller names here.. you'll want inject iactiondescriptorcollectionprovider service middleware. that, can use property actiondescriptors.items list of actiondescriptor , has route values action. if cast controlleractiondescriptor , you'll have access controllername , actionname .

c# - Need Help getting a specific value from a JSON key/value pair -

i pulling data 3rd party api , have myself code looks this... public partial class form1 : form { int playsystem = 2; string playid = ""; public form1() { initializecomponent(); } private void xbox_checkedchanged(object sender, eventargs e) { playsystem = 1; } public void playstation_checkedchanged(object sender, eventargs e) { playsystem = 2; } private async void searchbutton_click(object sender, eventargs e) { statdisplay.clear(); var username = namebox.text; using (var client = new httpclient()) { client.defaultrequestheaders.add("x-api-key", "xxxxxxxxxxxxxxxx"); var response = await client.getasync("https://bungie.net/platform/destiny/searchdestinyplayer/" + playsystem + "/" + username); var content = await response.content.readasstringasync(); dynamic item = newtons...

android - How to programmatically animate shifting fragments? -

i want click button , have view containers change size smoothly/transitionally. can done in android? if view container mean viewgroup can use valueanimator. it's simple timing engine can use animation. for example if want animate change of height relativelayout rl finalheight startheight in 400ms can : valueanimator va = valueanimator.offloat(0f, 1f); va.setduration(400); va.addupdatelistener(new valueanimator.animatorupdatelistener() { public void onanimationupdate(valueanimator animation) { float value = (float) animation.getanimatedvalue(); rl.height = (int) (startheight + (finalheight - startheight) * value); rl.requestlayout(); } }); you can use different interpolator , customize valueanimator nice effect. http://developer.android.com/reference/android/animation/valueanimator.html

install4j 6.1.1 Linux installer issue that worked in 6.0.3 -

i have installer set if installer run in terminal/cmd parameter, runs script in 'finish' section after installation uses class , resource main program jar. code in class uses obj.getclass().getresourceasstream('relative path') resource. this worked in install4j 6.0.3. in 6.1.1 still works in windows installer, in linux installer, code run can't find necessary resource. any advice? let me know if need clarify more, in head sounds necessary information, i'm not great @ abstracting myself situation.

rubygems - Error while installing neo4j ruby gem -

when run 'gem install neo4j' i error: while executing gem ... (argumenterror) malformed format string - %) what mean?? there problem source of gem? happen else? installed rvm today, it? jruby -s gem install neo4j worked me, https://github.com/jruby/jruby/wiki/gettingstarted#installing-and-using-ruby-gems

wpf - Need a label to output a number. C# -

i trying have label output monthly rate after has been calculated through formula. keep getting error when try output number. double top = _principal * _interestrate / 1200.00; double bottom =( 1 - math.pow(1.0 + _interestrate / 1200.0, -12.0 _numberofyears)); double _monthlyrate = top / bottom; lblmonthlyrate = _monthlyrate ("c"); thanks help! lblmonthlyrate = _monthlyrate ("c"); should (this windows forms): lblmonthlyrate.text = _monthlyrate.tostring("c"); edit per update answer: did lose reference system.web.ui.webcontrols? edit 2: i'm dummy. wpf? need (this wpf): lblmonthlyrate.content = _montlyrate.tostring("c");

doctrine2 - What is the preferred Zend Framework 2 (ZF2) way to communicate back end job status to front end? -

jobs implemented using slmqueuedoctrine. considering web sockets or comet uncertain if there zf2 approach or zf2 module should using? there component/module zendqueue it's unkempt. last status on aug 23, 2012 there no stable version package ... i recommend search on packagist.org better solutions. there lot packages slmqueue. eg. https://packagist.org/packages/slm/queue

python - How to save each element of a list to an independent new file? -

i have function pos-tag number of documents , prints each pos-tagged document in list follows: [u'i\tpp\ti', u'am\tvbp\tbe', u'an\tdt\tan', u'amateur\tjj\tamateur'] .... [u'good\tjj\tgood', u'camera\tnn\tcamera', u'for\tin\tfor', u'a\tdt\ta', u'good\tjj\tgood'] how can save or write each list new .txt document in new directory?, example: new_directory ---->list1.txt .... ---->listn.txt now, if inside each new file this: good jj camera nn camera in dt jj thanks in advance guys. as 1 way can iterate on lists (i assumed they're in nested list here) , open file , write contents of list file. you hardcode path appropriate seperators, used os.path.join here it's typically use this. how you're specifying new directory wasn't mentioned. take in sys.argv, file dialog, input, or other numerous options. import os nested_list=[ [u'i\tpp\ti', ...

c++ - How can i select A-Z without having typing an expression for every letter? -

this question has answer here: how test string letters only 5 answers i have while statement here says if user input z show corresponding telephone digit, else if enter letters a-z program exit. how can set expression a-z instead of typing multiple || statement every letter. know there library lets select a-z forgot name. p.s want enable user select uppercase of these letter , still result. sorry bad formatting of while. should scroll left , right see complete while (letter == 'a' || letter == 'b' || letter == 'c' || letter == 'd' || letter == 'e' || letter == 'f' || letter == 'g' || letter == 'h' || letter == 'i' || letter == 'j' || letter == 'k' || letter == 'l' || letter == 'm' || letter ==...

xml schema and java objects -

i have received xml schema third party vendor. xml schema , xml don't seem match atleast guess. using intellij , use jaxb plugin java objects. my code never returns field values i.e. never returns "my string value" xml <field type="address"> <value type="value">my string value</value> </field> i data 0 = {fieldtype@1372} characters = null value = {fieldtypetype@1381} "address" value = {string@1383} "address" data = null name = {string@1382} "address" ordinal = 8 1 = {fieldtype@1373} characters = null value = {fieldtypetype@1387} "card_number" 2 = {fieldtype@1374} characters = null value = {fieldtypetype@1389} "date" 3 = {fieldtype@1375} i have xml (part of it) <field type="address"> <value type="value">my string value</value> </field> <field ty...

python 3.x - PyGObject GTK+ GLib.Date strftime() -

a method call in poppler returns gdate object in python code. cannot find way how nicely print object. following python gi api reference , came following: gdate_object = annot_mapping.annot.get_date() destination_buffer = '.' * 50 print('output:', glib.date.strftime(destination_buffer, 50, '%c', gdate_object)) print('buffer:', annot_time) however, places nothing in buffer, while does output written buffer size. how access destination buffer? looks nobody documented api broken introspection bindings. i made simple patch seems pygobject doesn't allocating string buffers, talk upstream it. diff --git a/glib/gdate.c b/glib/gdate.c index bea2448..bacdb93 100644 --- a/glib/gdate.c +++ b/glib/gdate.c @@ -2418,8 +2418,8 @@ win32_strftime_helper (const gdate *d, /** * g_date_strftime: - * @s: destination buffer - * @slen: buffer size + * @s: (out caller-allocates) (array length=slen): destination buffer + * @slen: (in): buff...

How to hide console window of a Go program on Windows -

Image
this question has answer here: how create executable golang doesn't open command (cmd) window when run? 3 answers i tried various ways of creating go program displays either messagebox or standalone gui window. if write in c / c++ define winmain , leave out main , go. seems me define main function console window created automatically. , main function compulsory. package main func main() { ... } to avoid tried example creates winmain func winmain(wproc uintptr) { hinstance := getmodulehandle(nil) ... } but effect same: empty console window and gui window: add -ldflags -h=windowsgui go build/install command line. you'll see console window absent:

react native - Flow saying "Required module not found" for <Image> sources -

we have existing react native project (version 0.22.2) , i'm trying set flow type checker (version 0.23) on files. however, flow giving lot of errors require() s calls we're using <image> sources. example, have code in 1 of our components in header.js: <image source={require('./images/nav.png')} style={styles.navicon} /> which react native handles fine , works. however, flow seems trying treat require() regular module require , not finding it, , giving errors this: header.js:30 30: <image source={require('./images/nav.png')} style={styles.navicon} /> ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./images/nav.png. required module not found how can tell flow stop giving these errors? i've tried adding .*/images/.* [ignore] section of .flowconfig , doesn't change anything. you can use module.name_mapper.extension option in .flowconfig. example, [options] module.name_mapper.extension= 'png' -> '...

php - Smarty Template: printing 2 columns in every iteration -

i have php script populates , assing smarty array. want print 2 columns in 1 row start row. {section name=customer loop=$custid} <tr> // love start loop here loop 2 times <td>$custid<td> // , end loop here </tr> {/section} you can use mod operator current loop index, (not tested) work: {section name=customer loop=$custid} {assign var="column" value=$smarty.section.customer.index%2} {if $column==0}<tr>{/if} <td>$custid<td> {if $column==1 || $smarty.section.customer.last}</tr>{/if} {/section}

php - Using POST to get select option value from HTML form -

i have form different information. have select multiple options , want able send database in 1 or 0 / true or false. not working. code far: <select name="multipleselect[]" multiple> <option value="" disabled selected>choose option</option> <option name="esea" value="esea">esea</option> <option name="faceit" value="faceit">faceit</option> <option name="matchmaking" value="matchmaking">matchmaking</option> </select> <label>what looking play?</label> and php: $esea = 0; $faceit = 0; $matchmaking = 0; foreach ( $_post['multipleselect'] $value ) { if ( $value == 'esea' ) { $esea = 1; } if ( $value == 'faceit' ) { $faceit= 1; } if ( $value == 'matchmaking' ) { $m...

reactjs - Storing json web token -

i'm learning reactjs, redux , json web token. i'm new on of them. in sample application user sends information login page. if information true jwt created , set in state , sent client side. set localstorage . when other request sent client, token in localstorage sent server via redux action verifying. i read samples , tutorials. of them have sent jwt in http header. do have sent header ? localstorage , state enough ? do have sent header? you must send server in request somehow. whether header or part of request's payload, doesn't matter, more convenient , considered better practice send part of authorization header. using authorization header allow avoid moving jwt between request's body , query parameters depending on type (post / etc.). are localstorage , state enough? no. storing jwt locally on client not inform server of client's authenticated state. must send jwt server each request requires user authorisation. do read...

memory - What applications require 1GB pages? -

x86 , x64 processors allow 1gb pages when pdpe flag set on cpu. in application practical or required , reason? hugepage in cases have large memory footprint , memory access pattern spans large distance (across 4k pages). it not reduces tlb miss saves os mm system page tables size. a example packet processing. in high throughput network applications (1gbps or more), packets stored in packet buffer pool (i.e. pooling technique). example, every packet buffer 2kb in size , pool contains 512 buffers. access pattern of packet buffer pool might not sequential (buffer indexed @ 1,2,3,4,5...) rather random on time (1,104,407,45,905...). since normal page size 4k, normal tlb won't here since each packet access incur tlb miss , there lot of different buffers sitting on different pages. in contrast, if put pool in 1gb hugepage, packet buffers share same hugepagetlb entry avoiding misses. this used in dpdk (data plane development kit) packet rate high cycles wasted on tlb m...

javascript - Change class after hovering for a second over svg polygon -

i have svg polygon displayed, want is: when mouse hovered on object, wait 1 second , change class. if user hovers out, before 1 second nothing happens. what achieve http://codepen.io/jdsteinbach/pen/csypf svg element must glow after second. what have far is: $("#firstobject").stop().hover( function() { //hovered in //delay , add new class console.log("hovered in"); settimeout(function() { console.log("hovered in in"); $("#firstobject").attr("class", "svgovervideo1 hoveredobject"); }, 1000); }, function() { //hovered out //remove class $("#firstobject").attr("class", "svgovervideo1"); console.log("hovered out"); } ); .svgovervideo1 { fill: transparent; stroke: purple; stroke-width: 2; position: absolute; z-index: 1; top: 0%; left: 0%; } .hoveredobject { border: dou...

Magento CE 1.7 get the user ip included with the contact form -

one of magento ce 1.7 sites contact form being spammed human spam farms bypassing google recaptcha implemented on such forms. rate of spam received exorbitant 300 emails day have verified captcha. as contact form being used, no sender ip address being emanated email, hence i need , guidance on how obtain user ip , have included spam contact email receive. the idea ban ips being used spamming. the php call user ip echo mage::helper('core/http')->getremoteaddr(true); how can use within contact form , have ip submitted contact form contact. i appreciate help. with best regards fab andrew, thanks lot. the correct ip showed adjustment on code: public function postaction() { $post = $this->getrequest()->getpost(); if ( $post ) { $translate = mage::getsingleton('core/translate'); /* @var $translate mage_core_model_translate */ $translate->settranslateinline(false); try { $postobject = new varien_object(); ...

How to mock LDAP Laravel auth for unit testing -

in laravel project use ldap-connector package authenticate users against ldap auth works fine out of box. in /app/providers/authserviceprovider.php have policy defined manage ldap user access, example: public function boot(gatecontract $gate) { $this->registerpolicies($gate); $gate->define('rewards', function ($user) { return ($user->getadldap()->ingroup('admin') || $user->getadldap()->ingroup('marketing')) ? true : false; }); // other policies // ... } in controller check policy logged in user like: class rewardcontroller extends controller { public function __construct($handler = null) { $this->authorize('rewards'); } // other methods // ... } everything works fine , if logged in user doesn't have marketing or admin group, controller throw 403 exception. now, phpunit tests need mock ldap auth , provide access controller tests it's methods, otherwi...

python - Function for every a django-model -

i have django-models , made function, example: def function(django-model): return django-model.objects.order_by('-date') i want execute function models, don't know how works. function(django-model-1()) or function(django-model-2) return: attributeerror: manager isn't accessible via django-model-1 instances thanks , sorry english. upd: sorry, maybe poorly explained. i need universal function manipulating models. from django-model-1.models import django-model-1 django-model-2.models import django-model-2 def function(django-model): return django-model.objects.order_by('-date') # example function(django-model-1) function(django-model-2) but it's don't work. if make without function, it's work. django-model-1.objects.order_by('-date') django model definitions define tables store records , define instance of object looks , how behaves. objects special attribute on model class (not on...

c++ - C4716 function must return a value thown despite returning a value -

the problem compiler (mingw32) insists there compilier error @ line 21 in "util.h". #ifndef util_h #define util_h #include <string> #include <list> #include "treeitem.h" using namespace std; #include <algorithm> #include <functional> #include <cctype> #include <locale> #include <qlist> static inline string &ltrim(string &s){} static inline string &rtrim(string &s){} static inline string &trim(string &s){} static inline string func_1(string txt,size_t start, size_t end){} static inline size_t func_2(string txt, size_t index){} static inline string replace(string& str, const string& from, const string& to){} vector<treeitem *> parse(string dat){} #endif // util_h line 21 placeholder function in "util.cpp". (snippet of util.cpp) vector<treeitem *> parse(string dat) { vector<treeitem *> final {}; while (dat.find("{") <= dat.length...

c# - Search for RSS Feeds on Google -

i hope not chasing red herring here. have seen websites able search rss feeds typing in sort of term "technology news" , return number of different feeds can chose from. searching own curated database fine , dandy, there 1 looks uses google search them. http://ctrlq.org/rss/ does know how done , point me in right direction learn how done bugging life out of me? have done lot of searching seem point depreciated google feed api no longer works or using google alerts create rss feed not wanting do. ideally in c# can deal results , save relevant selected option in database. it doesn't need google done in, if there other options available great :) cheers. i kinda intrigue question , i've find out. first of went site http://ctrlq.org/rss/ , checked done after click on search button: function findfeeds() { var q = $.trim($('#feedquery').val()); if(q == "") { resetfeeds(); return false; } ...

css - Listview separator JQuery Mobile -

Image
i'm using jquery mobile flat ui theme. it's great want add separator between each listview . here listview : which code have add in .css file ? if want list style css separate each list. check demo http://jsfiddle.net/2qgta/1/ add css. ul li.ui-li { border-top:1px solid #ccc !important; } ul li.ui-li-divider{ border-top:none !important; }

javascript - How can I accept uppercase letters in my prompt? JS -

i know how accept uppercase b, o, , h newbase prompt. know .touppercase wondering add or if uppercase me in case. know can manually place capital letters in while test code. thanks, hope hear soon. var integer = prompt("enter unsigned base 10 number:"); while (!(integer > 0 )){ var integer = prompt("enter unsigned base 10 number:"); } var newbase = prompt("enter b binary, o octal, or h hexadecimal:"); while (!(newbase === "b" || newbase === "o" || newbase === "h")) { var newbase = prompt("enter b binary, o octal, or h hexadecimal:") } alert("aye"); </script> how regex : /^[boh]$/i.test("b") //returns true both b or b , false other letter for example: /^[boh]$/i.test(newbase) [boh] accepted letters i modifier make them case insensitive update: @oka correctly pointed out better add ^ $ indicate expression accept 1 character...

javascript - (Angular + Bootstrap) How to stop two datepickers from being opened by the same button -

i have web page needs 2 datepickers, start date , end date. problem is, whenever click on glyph open date selector, both date picker opens @ same time. here template, directive, controller , how it's being used. appreciated. template : <div class="input-group"> <input type="text" class="form-control" uib-datepicker-popup="dd/mm/yyyy" ng-model="start_date" is-open="popup.opened" datepicker-options="dateoptions" ng-required="true" close-text="close" /> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="open()"> <i class="glyphicon glyphicon-calendar"></i> </button> </span> </div> directive : 'use strict'; /*global angular*/ angular.module("myapp") .directive("datepicker", func...

c# - Removing the TaxonomyField in the Migration -

as have been creating own orchard module decided needed couple of taxonomies via alterpartdefinition method in contentdefinitionmanager(i've been following advanced orchard course on pluralsight) class. later decided didn't need 3 taxonomies , wish remove couple of them. below code how added them. public int updatefrom10() { contentdefinitionmanager.alterpartdefinition("exercisepart", builder => builder.withfield("category", lvl => lvl.oftype("taxonomyfield") .withsetting("displayname", "category") .withsetting("taxonomyfieldsettings.taxonomy", "category") .withsetting("taxonomyfieldsettings.leavesonly", "false") .withsetting("taxonomyfieldsettings.singlechoice", "false") .withsetting("taxonomyfieldsettings.hint", "select category") )...

php - Laravel 5.0: How to update an array of data: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array -

i absolute beginner of laravel. dealing error "preg_replace(): parameter mismatch, pattern string while replacement array" when try update array of data. does know way solve error? if need more information, please leave comments. any advice appreciated. in advance! logscontroller.php public function update(createlogrequest $request, $course_id){ $count = count($request->input('weeks')); $input = $request->all(); $logs = array(); ($i = 0; $i < $count; $i++){ if($input['weeks'][$i]){ array_push($logs, array( 'user_id' => \auth::user()->id, 'course_id' => $course_id, 'weeks' => $i + 1, 'work_description' => $input['work_description'][$i], 'instructor_comments' => $input['instructor_comments'][$i], 'status' => $input['statu...

file - Issue with code not running after user provides input -

i in first year of coding. writing program school having issues with. assignment create trivia game using files. code won't continue after ask user input determine how many points question asked worth. section of code problem posted directly below. entire program below in case needs see whole thing. record entire program not finished yet. p.s new @ if missed obvious apologize. while repeat3==true: #identifying point value player wants print "what point value want question have?" print "your options are:200,400,600,800,1000" desiredvalue=input() print 'testing' if desiredvalue==200: questionvalue=random.randint(1,5) repeat3=false elif desiredvalue==400: repeat3=false questionvalue=random.randint(5,9) elif desiredvalue==600: repeat3=false questionvalue=random.randint(8,13) elif desiredvalue==800: repeat3=false questionvalue=random.randint(13,...

memory management - Swift NSBlockOperation() Leak: cannot make NSBlockOperation() weak -

to avoid memory leak when using nsblockoperation in objective-c, have declare variable weak able reference block operation inside block (to cancel if needed), typically this: __weak nsblockoperation *blockop = [nsblockoperation blockoperationwithblock:^{ if (blockop.cancelled) { ... } }]; but in swift, when try declare nsblockopeartion weak, nil. weak var blockop = nsblockoperation() without weak reference, fine except leaking little bit of memory each time. how can reference block inside block without leaking memory in swift? you can use explicit capture list capture unowned reference operation. (this 1 of times i'd suggest using unowned references, since operation retained long block executing. if you're still uncomfortable guarantee, use weak instead.) let op = nsblockoperation() op.addexecutionblock { [unowned op] in print("hi") if op.cancelled { ... } } note has split 2 lines, because variable can't refe...

base64 - Passing big files to server using HttpPost in android -

so there's lot of question subject, non of them seemed answer question i have filename, want encode base64 , http post server the file's sending & receiving works great but can't encode big files, because string large hold in memory , end getting outofmemoryexception when encode chunks, still end rebuilding encoded string big one so please, if can me somehow (not in base64), pass big file server using httppost, great p.s: tried using multipartentity's filebody server didn't receive correctly

php - Please, do I need to protect password before entry into my server provider mysql -

i designing small social community site before came across "password hashing" when researching. hosted site on hosting site, so, don't know if it's job protect users' passwords or job secure databases. please if don't understand question, ask can explain it. short answer: both. it both job , job secure database. should plan 1 or both of failing @ this. access control your job in securing database starts can manage: credentials use, both , application making. everything gives kind of "privileged access" should set require login, , should involve strong password (i recommend using random password generators and/or password manager). may include not limited to: the database login, both , application ftp ssh (consider looking key based authentication this) admin accounts on website you're building the database should require password connected to, , password should strong (i recommend random password generator this). s...

fpga - Process pipelining in VHDL? -

Image
for past few days have been searching method of writing bit of vhdl project allow me trigger processing of set of data , transmit results. device using can begin collect second set of data while simultaneously serving complete first set fpga transmit, , want take advantage of via pipelining haven't been successful. to trigger collection need send specific set of signals in specific order. after few clock cycles , signal fpga, complete set output on several ports device. goal whole process started simple input pulse, , possible second pulse occur while assignments first pulse still occuring. there way me send first set of signals, , later signal output data while simultaneously sending first set of signals second collection, if makes sense? here's picture of mean. (clickable) as can see, data integration 1 sent during second , third integration stage. load_pulse signal requests data output on data , , can occur later while second set of signals integration 2 sent. ...

javascript - AngularJS - Pagination not rendering on $scope.Watch change (CodePen included) -

question background: i'm learning angularjs. have created simple app takes in 3 form inputs, , on submission of form paginated list should rendered. have dependancy on ui-bootstrap. plnkr showing pagination example i'm attempting incorporate app: http://plnkr.co/edit/81fpzxpnoqnihqgp957q?p=preview the issue & demo: this link code far on codepen: http://codepen.io/daveharris/pen/nnmqyy i have list of 1000 items populating on searchingservice model injected , shared between 2 controllers. i cannot paginated ng-repeat populate when searchingservice.searchlist list on searchingservice model changed, if $scope.watch not being triggered. any getting bottom of appreciated. as bchemy pointed out, $watch should changed $watchcollection . change won't enough have app working correctly current code, since pagination looks broken. you should add watcher control pagination 1 in example want replicate: $scope.$watch('currentpage + numperpage...

assembly - Spinlock with XCHG -

the example implementation wikipedia provides spinlock x86 xchg command is: ; intel syntax locked: ; lock variable. 1 = locked, 0 = unlocked. dd 0 spin_lock: mov eax, 1 ; set eax register 1. xchg eax, [locked] ; atomically swap eax register ; lock variable. ; store 1 lock, leaving ; previous value in eax register. test eax, eax ; test eax itself. among other things, ; set processor's 0 flag if eax 0. ; if eax 0, lock unlocked , ; locked it. ; otherwise, eax 1 , didn't acquire lock. jnz spin_lock ; jump mov instruction if 0 flag ; not set; lock locked, , ; need spin until becomes unlocked. ret ...

regex - Python re.search Patterns -

i have bunch of strings consist of q, d or t. below examples. aa= "qddddqdtdqtd" bb = "qdt" cc = "tdqdqqdtqdq" i new re.search, each string, possible patterns length start q, , ends d or q, , there no t in between first q , last d or q. so aa, find "qddddqd" for bb, find "qd" for cc, find "qdqqd" , "qdq" i understand basic forms of using re.search like: re.search(pattern, my_string, flags=0) just having trouble how set patterns mentioned above, how find patterns start q, or ends q, etc. appreciated! use pattern follows describe: start q , t [^t]* , d or q [dq] : >>> import re >>> aa = "qddddqdtdqtd" >>> bb = "qdt" >>> cc = "tdqdqqdtqdq" >>> print(*(re.findall(r'q[^t]*[dq]', st) st in (aa,bb,cc)), sep='\n') ['qddddqd'] ['qd'] [...

smartsheet api - Get sheets belonging to a specific group -

how tell if sheet belongs group? for example, have group called rpr , when create sheets share them other users in our organization applying group sheet. // sheets modified within last day smartsheetlist = smartsheet .sheetresources .listsheets(new sheetinclusion[] { sheetinclusion.owner_info }, new paginationparameters(true, null, null)) .data .where(d => d.modifiedat.value.date >= datetime.now.adddays(-1).date) .tolist(); // organization sheets var orgusersheets = smartsheet.userresources.sheetresources.listsheets(true).data.tolist(); // specific group var group = smartsheet.groupresources.listgroups(null).data.where(grp => grp.id == some-id-here).first(); with code above can see if sheet belongs organization can't tell if sheet belongs group. appreciated. you need 1 more api request each sheet retrieve list of shares on sheet. keep in mind, sheets can shared directly on sheet or via workspace. to sheets ...

html - Modifying TextArea with Scrolling, and positioning placeholder. -

so, i'm working trying create input bar, allow user input list of account numbers, can sent query web service. input bar long, , extends bottom of page ( user can input 100 account numbers @ time), , within nav tags keep securely on lefthand side of view. at moment, placeholder runs across middle,rather top want it, doesn't scroll (vertically), , need able press enter , create new line within input bar - not submit. know, that's lot. currently, code looks so: <div id = “input”> <form> <input type = “text” id = “actinput” class = “form-control” placeholder = “paste/import here” required style = “ display : table; height : 45h; resize: none; border-radius: 0px; overflow-y: scroll”> </form> </div> any appreciated everyone. thanks. you use <textarea> instead of <input type="text"> .

html - Conflict on ng-view while loading materialize javascript files -

Image
i have following layout page: <body scroll-spy="" class="theme-template-dark theme-amber alert-open alert-with-mat-grow-top-right solar-custom"> <main> <div class="main-container"> <div class="main-content" autoscroll="true" bs-affix-target="" init-ripples=""> <section class="forms-basic"> <div ng-view class="view-animate view-fade"> </div> </section> </div> </div> </main> </body> i have ng-view here in order html files on code , place it's content inside here. problem noticed following: have various textboxes materialize should have animation kicks in on focus , blur. however, noticed animation not occur on elements inside ng-view. one thing noticed there function on js file runs when page...

html - Refencing a file in a parent directory -

this silly question but, have project set on desktop at: ~/desktop/composer/ inside directory have folders: css , templates inside templates folder have index.html file, , need reference css file in css folder, can figure out how have tried: /../css/style.css , /../../css/style.css , neither of them work. thanks help. you need remove leading / , since denotes root of filesystem. try ../css/style.css .

c# - Bind a collection inside a collection in WPF combobox -

observablecollection<a> work = new observablecollection<a>(); class { int a; int b; observablecollection<string> c; } i need bind" work" itemsource of combobox , selecteditem a. need display strings(c) of class in combobox. how display strings c in combobox. idea.? well if need each comboboxitem display collection of strings, use itemscontrol in itemtemplate of combobox . <combobox itemssource="{binding work}"> <combobox.itemtemplate> <datatemplate> <stackpanel> <textblock text={binding a} /> <textblock text={binding b} /> <itemscontrol itemssource="{binding c}" /> </stackpanel> </datatemplate> </combobox.itemtemplate> </combobox>

git - How to setup .gitignore for Windows? -

i setting first project in git. how setup git-ignore file in windows? i creating first rails project using vagrant , trying configure .gitignore in windows easy. make file .gitignore using text editor in there, write file name you'd want ignore you can use wildcard like: *.pyc ignoring file extension .pyc if use tortoisegit or other git software, easier. there add ignore list menu when right click file.

Android webview in marshmallow -

a recent update marshmallow has caused problem app's webview. layout xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/errorlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <webview android:id="@+id/web" android:layout_width="match_parent" android:layout_height="wrap_content" /> <button android:id="@+id/dialogbuttonok" android:layout_gravity="center" android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/ok" android:layout_margintop="5dp" android:layout_marginend="5dp" /> </linearlayout...

associations - Rails: How do I reset models and migrations? -

i've been working rails , of course have learned quite bit since started. i'm wanting keep lot of files i've made i'm wanting recreate many of models. since wasn't concerned losing information in database, ran rake db:drop:all rid of tables , data. noticed still have migration files in folder db\migrate . how should handle these? leave them , make changes models or should delete them in way. finally, there other files might still lingering around need delete/attend to? running rake db:drop:all clean database. if plan on changing models , think migrations not reflect data model anymore, delete them. you might want clean file db/schema.rb too you might want checkout rails migration guide http://guides.rubyonrails.org/migrations.html

java - Throwing an exception after retrying a block of code -

is correct, safe , sane throw exception after successful retry? programming principle violated in example? class b { private int total; public void add(int amount) throws exception { if (amount < 0) { throw new exception("amount negative"); } total += amount; } } class { public b b = new b(); public void addtob(int amount) throws exception { try { b.add(amount); } catch (exception ex) { try { b.add(-amount); } catch (exception ex2) { } throw new exception("amount negative. inverted , added."); } } } your code working since calling addtob() method throws exception inside catch block must implement try-catch block within try-catch block . , @ end throwing exception after having many try-catch blocks not since exceptions if not handled can cause problems , bad practise throw exce...

Using quil.core/ellipse to draw an 8 pattern in clojure -

i want draw sketch 8 pattern. know how draw circles in counterclockwise , clockwise directions. not know how combine them. (defn draw-state [state] (let [x (* 150 (quil.core/cos angle)) y (* 150 (quil.core/sin angle))] (quil.core/ellipse x y 100 100) (quil.core/ellipse y x 100 100))) this function draw 2 circles in opposite directions. how draw sketch 8 pattern? a polar equation 8-type of curve = r^2 = cos[2t] (sec[t])^4 where r = radius, t = angle you start this.

Modifying the Google Drive menu interface -

so i'm working on web-app google marketplace that's going involve integration google drive. part of want able app involves along lines of adding menu option drive menu interface. instance, editing document in drive , browse file->"my new fancy option." know if possible? or if not, there way of adding sort of custom action functionality able perform non drive standard actions on files within drive interface? yes. possible so. see documentation @ https://developers.google.com/drive/

driver - How to get manfid of SD card from linux? -

normal case. (sd card <-> sd card socket <-> sdio <-> chip) linux create /dev/mmcblk0p1 , can these information below: /sys/block/mmcblk0/device/manfid /sys/block/mmcblk0/device/oemid /sys/block/mmcblk0/device/name my case. (sd card <-> sd card socket <-> usb hub <-> usb host <-> chip) add usb hub connecting usb host sd socket. usb hub 1 side link usb socket , sd socket, , other side link usb host. when plug sd card, linux auto create /dev/sda. final, find no manfid , oemid , name @ below: /sys/block/sda/device/ so, @ case. how manfid(and oemid , name) of sd card linux? linux 3.0.8 udevinfo version 100 thank reading (my english poor). you can't. most usb sd card readers expose card usb mass storage device. don't provide way pass raw sd commands directly card, or read sd-specific registers such ones including manufacturer id.

c++ - Can I build this special rounding function with Standard Library components? -

is there, in c++ standard library, way obtain func function behaviour : takes double num input; returns highest integer strictly inferior num . i emphasize strictly , because if read ‘inferior or equal’ of course ceil function job. what want : func(3.1) equals 3, func(3.9) equals 3, importantly func(4) equals 3 well, , not 4. idea implementation ? ceil(x)-1.0 should work. when x not integer, ceil(x)-floor(x)=1 , , when x integer, ceil(x)=x , ceil(x)-1 want.

python - yum install package "Error unpacking rpm package xxxxx cpio:xxxx" -

since send ctrl+c command line yum update running on server(centos6.7), yum cannot install packages days. i suggested run yum-complete-transaction , not install package yum-utils same error. someone told me check **attrs of /usr/bin , /usr/local/bin , know upper meanning? attrs lsattr /usr -------------e- /usr/src ----------i--e- /usr/include -------------e- /usr/libexec -------------e- /usr/local ----------i--e- /usr/lib -------------e- /usr/share -------------e- /usr/. ----------i--e- /usr/bin -------------e- /usr/etc yum error [root@localhost ~]# yum install supervisor loaded plugins: fastestmirror loading mirror speeds cached hostfile epel/metalink | 12 kb 00:00 * base: mirror.lax.hugeserver.com * epel: linux.mirrors.es.net * extras: mirror.keystealth.org * updates: mirror.spro.net base ...