Posts

Showing posts from June, 2014

jquery - Kendo Grid Ajax Error Handling - Getting Grid Element ID -

i'm working on common method handle ajax errors kendo grids in app. part of js function, i'm displaying error , cancelling changes grid. there's got better way id grid i'm doing below - feels hack me (even though work in tests). have better way handle this? // common kendo grid ajax error handler function kendogridajaxerrorhandler(result) { var msg = result.xhr.status + ' ' + result.xhr.statustext + '\n' + result.xhr.responsetext; alert(msg); var id = result.sender.options.table[0].parentnode.parentnode.id; $('#' + id).data('kendogrid').cancelchanges(); }; the error event exposed datasource , not grid. result cannot grid within error handler. if possible can try distinguishing grid based on data source option e.g. read url: function kendogridajaxerrorhandler(result) { var datasource = this; var read = datasource.options.transport.read.url; if (readurl == "/customers/read") {

android - Using text from Google translate -

this regarding android application. as per analysis, translation google translate not perfect. will ok show non-english users dialog following content: this application has been translated using google translate , hence have translation issues. if see translation problems in language, please switch english locale on device. if possible, in fixing language translation problems noticed you this question perspective quality , usability of app non-english speakers have set locale non-english on android device. i try find can translate proper english. expensive: supertext cheap: mygengo but cheapest mygengo translations better google. if app professional, invest real professional translation. otherwise usability goes down drain.

javascript - Why are there "line terminators" at different max values for minified code? -

this question has answer here: why have newlines in minified javascript? 3 answers in particular google closure , uglify. uglify uses 32k lines https://github.com/mishoo/uglifyjs while google uses 500 lines. https://developers.google.com/closure/compiler/faq#linefeeds one of them seem addressing ghost issue. why such difference? true considerations regarding maximum length? from closure compiler docs : why there random line feeds in compiled scripts? the closure compiler intentionally adds line breaks every 500 characters or so. firewalls , proxies corrupt or ignore large javascript files long lines. adding line breaks every 500 characters prevents problem. removing line breaks has no effect on script's semantics. impact on code size small, , compiler optimizes line break placement code size penalty smaller when files gzipped.

javascript - How to close popups in another html -

i have radio on website openned in popup window, create page have song, want close popup when access page. the website link http://www.saproject.com.br/ when click in radio link in right of site, music starts, when u click in black banner popup needs close. i tried use window.opener.close(), dont works. the radio link open popup; use window.close(); instead of window.opener.close(); note : able close window if opened using javascript. and window.opener.close() closes parent window, not popup.

timer - Auto-refresh a ListView within a ViewPager? -

i'm having bit of trouble approaching auto-refresh design want implement. currently have titlepageindicator sets view pager pageradapter. each page in view pager listview constructed based on list of date strings. in instantiateitem() method, call asynctask load data based on date. works well, , loads way want. i changed listviews pulltorefresh list views , in order make sure user update data on date wished have up-to-date info on. (this works way desire). however want somehow refresh date in view pager (current date instance) - every 60 seconds. i'm not refreshing listivews in viewpager, i'm refreshing 1 want. i started making timer thread based on : update textview within custom listview but got stumped , i'm not sure next.. can point me in right direction?

ember.js - Ember: Using itemController in ArrayController doesn't work (TypeError: Cannot call method 'lookup' of null ) -

following examples on ember setting itemcontroller in arraycontroller definition causes blocking error message: typeerror: cannot call method 'lookup' of null jsfiddle: http://jsfiddle.net/jgillick/m4bvv/ // addresses array controller app.addressescontroller = ember.arraycontroller.extend({ itemcontroller: 'address' }); // address object controller app.addresscontroller = ember.objectcontroller.extend({ city: function(){ return "san francisco"; }.property() }); the way have found fix either... 1) pass itemcontroller in #each handler ( jsfiddle ): {{#each addresses itemcontroller="address"}} <li>{{line1}}, {{city}}</li> {{/each}} ...or... 2) add container property arraycontroller ( jsfiddle ): var addresses = app.addressescontroller.create({ container: indexcontroller.get('container'), content: [ app.address.create({'line1': '700 hansen wy'}), a

database design - Cassandra: Which schema for table-like mappings? -

i have tried different approaches can't find solution problem: data table-like, meaning have 1 data point (float) each combination of inputs set of strings: (a mapping of s × s → ℝ ) i want model schema can following lookups: all pairs of strings value in range for given input string, strings mapped value in range for given combination of input strings mapped value since mapping symmetrical ( m(x,y) == m(y,x) ), great if had store the n*(n+1) / 2 unique values instead of n^2 total mappings. what have tried far: s1+" "+s2 row key , value column name s1 row key , composite key of [s2:value] column name s1 row key, s2 column name, value column value. but unfortunately, these approaches don't let me queries need. possible in cassandra? cassandra not support first query --- all pairs of strings value in range --- since currently, cassandra allows range queries @ least 1 eq on where clause. however, second , third queries doable :)

html - Bootstrap 3 image gallery overrides -

Image
i using bootstrap 3 rc1, , having trouble getting image gallery set properly. problem 1 - ul adding padding-left or margin-left . need override remove it? problem 2 - each li spanning container instead of being limited span4 class. have 2 images per row. i added image below showing problems are. html <div class="container"> <div class="row"> <div class="col-lg-12"> <div id="allvideos"> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img src="<%= thumbnail_image %>"> <div class="caption"> <a data-attribute="<%= _id %>" class="delete">x</a> <h3><a class="video_item"><%= title %></h3></h3> </div>

javascript - Scroll a container on initial load in an Angular app -

i have container animates scrolltop bottom whenever new item added. markup looks this: <div class="scrolly"> <div class="item" ng-repeat="item in items" ng-animate=" 'scroll-to-bottom' "> {{item.value}} </div> </div> this works great when adding new items, on initial page load, container scrolled top. i'd figure out right way have scrolltop set bottom on initial page load. example jsfiddle: http://jsfiddle.net/bkad/jnwcp/ the trick add delay when populate data :) $timeout(function () { (var = 0; < 20; i++) $scope.items.push({ value: }) }, 10); demo

c++ - Why is unsigned integer overflow defined behavior but signed integer overflow isn't? -

unsigned integer overflow defined both c , c++ standards. example, c99 standard ( §6.2.5/9 ) states a computation involving unsigned operands can never overflow, because result cannot represented resulting unsigned integer type reduced modulo number 1 greater largest value can represented resulting type. however, both standards state signed integer overflow undefined behavior. again, c99 standard ( §3.4.3/1 ) an example of undefined behavior behavior on integer overflow is there historical or (even better!) technical reason discrepancy? the historical reason c implementations (compilers) used whatever overflow behaviour easiest implement integer representation used. c implementations used same representation used cpu - overflow behavior followed integer representation used cpu. in practice, representations signed values may differ according implementation: one's complement, two's complement, sign-magnitude. unsigned type there no reason stan

.net - Create an IObservable from a method and others -

is code below correctly written return iobservable in terms of rx library? seems work correct, wondering i'm using correctly. private iobservable<searchresult[]> search(string query) { return observable.create((iobserver<searchresult[]> observer)=> { list<searchresult> result = new list<searchresult>(); foreach (testsgroupmeta group in engine.groups) { string name = group.tostring(); if (name.indexof(query, stringcomparison.invariantcultureignorecase) != -1) { result.add(new searchresult{ name = name, type = "group"}); } foreach (testmethodmeta method in group.methods) { name = method.tostring(); if (name.indexof(query, stringcomparison.invariantcultureignorecase) != -1) { result.add(new searchr

Run a post-build script from brunch -

i need run system script after brunch build (either manually built or brunch watch). there way that? create plugin have oncompile method . see example plugin https://github.com/steffenmllr/imageoptmizer-brunch/blob/master/src/index.coffee

javascript - How to create a copy of a form with its DOM elements -

how 1 create copy of form of form elements copy can manipulated , original left unchanged? using plain javascript clonenode var dupnode = node.clonenode(deep); example var p = document.getelementbyid("para1"), var p_prime = p.clonenode(deep); //if "deep" set true clone child nodes too, //if set false node , not children here documentation . hope helps.

php - PHPMailer: Amazon SES returning "554 Transaction failed: Invalid email address undisclosed-recipients:;." -

when using phpmailer send email bcc'd addresses via amazon ses, ses returns error below. 554 transaction failed: invalid email address undisclosed-recipients:;. this happens when there no address specified in "to" field , filled "undisclosed-recipients:;". have tried sending email address specified in "to" field , works fine. when sending email address in "to" field , addresses bcc'd, works without error. this php code i'm using add each email address bcc, $addresses array containing email addresses, without keys. if(is_array($addresses)) { foreach ($addresses $email) { $mail->addbcc($email); } } this output phpmailer. invalid address: noreply client -> smtp: mail from:<*redacted*> smtp -> server:250 ok client -> smtp: rcpt to:<*redacted, bcc'd address*> smtp -> server:250 ok client -> smtp: rcpt to:<*redacted, bcc'd address*> smtp -

postgresql - How to get function return type's length, precision and scale? -

i function return type catalog table this.... select proname, pg_get_function_result(p.oid) pg_proc p join pg_namespace n on n.oid = p.pronamespace n.nspname = 'someschema' , p.proname = 'somefunction' i return type's a) length b) precision c) scale (if supported data type) is possible pg_catalog or have take information_schema columns? attention! precision , scale useless postgresql scalar functions, because ignored. type important. postgres=# create or replace function foo1() returns numeric(10,3) $$ begin return 10.0/3.0; end; $$ language plpgsql; create function time: 39.511 ms postgres=# select foo1(); foo1 ──────────────────── 3.3333333333333333 (1 row) time: 0.910 ms postgres=# create or replace function foo2() returns varchar(2) $$ begin return 'abcde'; end; $$ language plpgsql; create function time: 28.992 ms postgres=# select foo2(); foo2 ─────── abcde (1 row) time: 0.746 ms only domain, can

java - Jackson Custom Deserialization for Mapping Class Name String to Actual Class Definition -

i using jackson custom deserializers parse json file. in file there bunch of entries key "class" , value name of class (without full package name). deserializer knows bunch of predefined (hard) paths search class. custom deserializer should keyword "class" (while parsing json) , based on value (the class name string), search in predefined paths , instantiate object matching class name. i have implemented jackson deserializers interface , have overridden bunch of callbacks: findbeandeserializer , findbeandeserializer , findenumdeserializer ... not let me catch event when parser sees class:classname key-value pair , act differently based on that. any or pointers appreciated. an example json { "class": "x", "fieldname1": { "class": "y", } ... } i hope haven't spend time writing custom stuff. can use, out of box, annotation @jsontypeinfo (see javadoc ): makes jackson a

mysql - In a Rails 3.2.13 app, I'm generating an index incorrectly -

in rails 3.2.13 app using query_reviewer gem improve database performance. the code generating sql is: @seo_keywords = seokeyword.order("category, keyword") it generated following sql warning: msg: no index used here. in case, meant scanning 64 rows. sql: select sql_no_cache `seo_keywords`.* `seo_keywords` order category, keyword so generated following db migration: def add_index :seo_keywords, :category add_index :seo_keywords, :keyword end the migration added indices table indicated schema: add_index "seo_keywords", ["category"], :name => "index_seo_keywords_on_category" add_index "seo_keywords", ["keyword"], :name => "index_seo_keywords_on_keyword" i restarted server, loaded page , got same error. suppose i'm creating index incorrectly? thanks help. in cases (and doubtless in rdbmss), can more efficient purposes use index perform order instead of sorting r

Win32 QueueUserAPC API alternative in .NET -

what closest .net alternative queueuserapc ? should use synchronizationcontext.post that? modern .net tries abstract away raw threading, , replace higher level libraries such task parallel library (tpl) or reactive extensions. i not sure in .net there "alertable" state thread, can obtain sleepex , can use tpl queue work item on process thread pool. task.start( () => { /* work * }); this works particularly if you're doing sort of asynchronous io operation in there, allow same thread reused running queued task, while original task doing asynchronous operation.

iphone - JSON Image Parsing/Prefixed URL -

i have established successful parsing of text , images in table view using json/php/mysql. storing location of images in database , actual images stored in directory on server. thing stored related image in database name. example car.jpg. want prefix url of image location on server can parsed without me having go db , manually entering url. here of code... -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *identifier = @"studentscell"; studentscell *cell = (studentscell *)[tableview dequeuereusablecellwithidentifier:identifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"studentscell" owner:self options:nil]; cell = [nib objectatindex:0]; } nsdictionary *studentsdict = [students objectatindex:indexpath.row]; //i want prefix url key imagepath dont know , how it. nsurl *imageurl = [nsurl urlwithstring:[studentsdict o

mysql - How to update one table based on the count value of another table while matching ids? -

there 2 tables: articles , comments . there association between them: each comment holds article id belongs to. ----------------------------- articles ----+-------+---------------- id | title | comments_count ----+-------+---------------- 1 | aaa | 0 2 | bbb | 0 3 | ccc | 0 4 | ddd | 0 5 | eee | 0 6 | fff | 0 ... ------------------------------- comments ----+-------------+------------ id | text | article_id ----+-------------+------------ 1 | aaa comment | 1 2 | aaa comment | 1 3 | fff comment | 6 4 | bbb comment | 2 5 | ddd comment | 4 6 | bbb comment | 2 the articles table further has columns holds current count of associated comments . here sqlfiddle basic setup of described tables. after having imported bunch of articles , comments how can update comments_count on every article r

jquery - Why does this technique not work to enable my "editable:true" column to sort properly? -

question: how enable "editable:true" column sort properly? the following link seemed provide "onclick" handler function allow editable columns sorted. ( https://stackoverflow.com/a/9290716/652078 ) but, when using it, receive following error when click on column: 'handler' null or not object message when click on column below, i've provided column definition , "click" handler code borrowed above link. -is there out-of-date regarding solution prevent working? -or, column definition preclude such "onclick" handler working? thanks help! here column definition: { name: 'rectype', label: 'rectype', index: 'rectype', width: 100, fixed: true, keys: true, editable: true, edittype: "select", editoptions: {value: rectypelist},

android - GCM PHP to send all devices -

i have problem gcm , need topic. send message mobile devices php: $resultcoment = mysql_query("select * notificaciones"); while ($row = mysql_fetch_array($resultcoment)){ $result = '"' . $row['regid'] . '", '; //print_r($result); $registrationids = array($result); } $message = $_post['message']; $fields = array( 'registration_ids' => $registrationids, 'data' => array( "message" => $message ), ); result: "apa91bhmihsncsg_yvhyzmprrxmw-e_iy7bpa9bo934n67afw8hxjhzvm1mnhrpartn6xbkxvjz9t9yfh9qni0zm5b9cpgxdhrkhystxyrwtrld02lq- v_e4zwkigghqt4bph_zlnggaau6hwo8ny8mm2_d7glekwckkzdnhwfo5hxghwf4gbzm", "apa91bhmihsncsg_yvhyzmprrxmw-e_iy7bpa9bo934n67afw8hxjhzvm1mnhrpartn6xbkxvjz9t9yfh9qni0zm5b9cpgxdhrkhystxyrwtrld02lq-v_e4zwkigghqt4bph_zlnggaau6hwo8ny8mm2_d7glekwckkzdnhwfo5hxghwf4gbzm", &

php - Session variable not staying set -

warning: not duplicate, can't find problem. i'm testing , building website on localhost. have following code on login page, sending user profile page if have user id cookie, , ip same cookies says should be. if($_cookie["ipcookie"] == $_server['remote_addr']) { $cookieresult = mysqli_query($connection, 'select count(`id`) count users username="$_cookie["usercookie"]" , `active`="1"'); if($cookieresult == 0) { $loginquery = mysqli_query($connection, "select * users username=" .$_cookie['usercookie']); $row5 = mysqli_fetch_assoc($loginquery); $dbidlogin = $row5['id']; $_session['userid'] = $dbidlogin; header('location: /userprofile.php'); } however, when go user profile using these cookies, $_session['userid'] null . can't seem figure out why "sometimes" $_session goes null . can't seem find p

html - Menu disappears below certain screen width -

i'm having problems getting menu display correctly under 600px on development site of mine. top part of site (video area) responsive >1024px. should stay static width below that. menu fine until gets below 600px, , disappears completely. happens on front page (inner pages have different header). thanks help! edit: sorry didn't link site - http://dev.longviewsources.com/ thgat's because in style.css file on line 510 have @media screen , (max-width: 600px){ .main-navigation ul { display: none; } } you have found what's happening firefox inspector, it's great tool.

php - jQuery ajax mysql select doesn't work -

hello i'm trying mysql query ajax based on 2 select options in joomla component i'm working on. i don't want post whole html shortend it. checked values passed trough php nothing in return. so php , js: <html> <head> <!-- load necessary files here --> </head> <?php function firstquery(){ if(isset($_post['adr'])){ $one = $_post['adr']; //adr name of first select $two = $_post['toadr']; //toadr name of second select $db = jfactory::getdbo(); $query = $db->getquery(true); $query->select(array('range', 'time', 'cost')); $query->from('#__transfer_rang'); $query->where('from="'.$one.'" , to="'.$two.'"'); $db->setquery($query); $results = $db->loadobjectlist(); print_r($results); exit; } } firstquery(); ?> <body> <script> $(function=(){ $("#click").click(function () { $.aja

java - How do I refactor ArrayList<MyClass> into MyClassLIst? -

i have project in eclipse (kepler), , using using following in quite few places ararylist<person> person; and person = new arraylist<person>(); and methods return , take arraylist<person> is there easy way refactor arraylist in personarraylist extends arraylist? i able have methods like arraylist<people> getallwithphonenumber(string phonenumber) { } update: underlying reason question based on following need. maintaining list of people objects in arraylist, decided needed have functionality such being able search list , return 1 or more people based on properties. original plan create new class extends arraylist , add methods class. my current thinking create people class has arraylist rather extending arraylist i think right approach. please comment if going down bad path. thanks comments; helped me think thru (i amateur @ stuff, fun learning) class personarraylist extends arraylist<person>{}

android - MapView displays blank, but MapFragments work normally -

hello i'm using fragment based layout in application - goes fine - using 1 special mapfragment , other pagefragments display data. mapfragment works fine - map display no problems , able draw on etc. now wanted add small map view 1 of pagefragments. i tried like: <com.google.android.gms.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:clickable="true" map:uicompass="true" map:uizoomcontrols="true" map:zorderontop="true" > </com.google.android.gms.maps.mapview> no xml errors, etc. app working - pagefragment correctly displayed, map view remains blank. ideas? yo

PHP POST ARRAY to json_encode -

i want use json store value mysql cuz making quiz , there many answers. doesn't go well. please tell me what's wrong.thx! <form method="post" action="resultme.php"> <h4> q1 </h4> <input name="a[0][]" type="radio" value="1" /><span>yes</span> <input name="a[0][]" type="radio" value="2" /><span>maybe</span> <input name="a[0][]" type="radio" value="3" /><span>no</span> <h4> q2 </h4> <input name="a[1][]" type="radio" value="1" /><span>yes</span> <input name="a[1][]" type="radio" value="2" /><span>maybe</span> <input name="a[1][]" type="radio" value="3" /><span>no</span>

hudson - How can I pass values with spaces in them to the Execute Windows Batch command build step in Jenkins? -

my setup: mercurial dcvs (latest) , jenkins ci (1.509.2) on amazon ec2 windows 2008 r2 instance. i have jenkins build job needs create vpn link between build server , our production server can deploy build artifacts via ftp. i’m attempting use execute windows batch command build step execute command similar this: rasdial nameofconnection user@host.domain "password spaces in it" if execute command on server in console (i.e. rdc ec2 vm , execute command in console) works perfectly, no problems @ all. executing in using execute windows batch command build step fails completely. no amount of changing quote type i.e. double single, or mixing , matching pairs e.g. '"blah blah blah"' has effect. ... time passes ... i’ve tried moving commands separate batch file ("connectnameofconnectionvpn.bat") called execute windows batch command build step i.e. move, appears issue quotation marks outside of jenkins. unfortunately, seems have no impact,

ios - Updating uilabel in view controller underneath another -

i have 2 view controllers, firstviewcontroller , fourthviewcontroller. firstviewcontroller initial view controller. present fourthviewcontroller with uiviewcontroller *fourthcontroller = [self.storyboard instantiateviewcontrollerwithid:@"fourth"]; [self presentviewcontroller:fourthcontroller animated:yes completion:nil]; then, in fourthviewcontroller's .m i'd change text of uilabel in firstviewcontroller. use uiviewcontroller *firstcontroller = [self.storyboard instantiateviewcontrollerwithid:@"first"]; firstcontroller.mainlab.text = [nsmutablestring stringwithformat:@"new text"]; however, after use [self dismissviewcontrolleranimated:yes completion:nil]; i find mainlab's text has not updated. know why? when calling line fourthviewcontroller.m creating new instance of firstviewcontroller, rather using created one. uiviewcontroller *firstcontroller = [self.storyboard instantiateviewcontrol

how to call method in one application from another application in ruby on rails -

i want call method , response in application application in ruby on rails technology, here cross site scripting problem there. so, can resolve issue please me great. http://video_tok.com/courses/get_course def get_course @course = course.find(params[:id]) end now want call above method application running in edupdu.com domain http://edupdu.com/call_course_method def call_course_method @course = redirect_to "http://video_tak.com/courses/get_course/1" end but redirect video_tak.com application. want call get_course method , @course object internally without redirect site. thanks in advance. cross-domain ajax indeed problem, none not solved. in get_course method return course objects json response so: render json: @course from there on either retrieve course through javascript (ajax), here should use jsonp or inside rails issuing http request. ajax jsonp there jsonp (json padding), communication technique javascript programs provide metho

javascript - A self invoking anonymous function expression -

(function(){ ... })(); i have looked @ this post , understood bit it. there few more doubts, on how used. like static block! since acts static block ( self invoking! ), can used initializing(like make-believe constants)? but there no getter available fetch , use elsewhere! return, must? the solution above have return in function? can fetch whatever returns , use that. reference global object?! (function(window, undefined){})(this); the explanation above code in second answer of referenced post , couldn't understand it, if can explain more (or simpler me), great update: take @ code ↓ var myelement=document.getelemetbyid("myelementid"); (function(myelement){ /**'this' here 'myelement'???**/ }; })(this); a common metod following (called namespacing) - created encapsulated scope executing function , returning essential parts need variable: var yournamespace = (function(window, undefined){

dependency injection - What are good ways to reduce the number of dependencies? -

i using dependency injection quite time , technique, have problem of many dependencies should injected 4 - 5 seems much. but cannot find way make simpler. instance have class business logic sends messages, accepts 2 other business logic dependencies needed (one translate data messages sent, , 1 translate messages received). but apart needs "technical" dependencies ilogger , itimerfactory (because needs create timers inside), ikeygenerator (to generate unique keys). so whole list grows pretty big. there common ways reduce number of dependencies? one way handle refactor towards aggregates (or facades). mark seemann wrote article on it, check out (actually highly recommend his book well, saying). have following (as taken article): public orderprocessor(iordervalidator validator, iordershipper shipper, iaccountsreceivable receivable, irateexchange exchange, iusercontex

how redis ensure all request data can be readed into buffer by only one 'read' function call? -

i read redis source code recently, , i'm studying networking codes. redis use nonblock mode , epoll(or simliar) networking data read/write. when read data event arrived,"readqueryfromclient" function called, , in function request data readed buffer. in "readqueryfromclient" function, if there data arrived, data readed buffer through 1 'read' function, , request handled. nread = read(fd, c->querybuf+qblen, readlen); // **one read function** //... other codes check read function retuen value processinputbuffer(c);// **request handled in function** my question is: how redis ensure request data can readed buffer 1 'read' function call, maybe data gotten more 'read' function call? processinputbuffer(c);// request handled in function that part not true. redis protocol designed include length of every chunk of data passed around. server knows how data has read make complete request out of it. inside processinputbuf

regex - Pasting character vectors, removing NA's and separators between NAs -

i've got several character vectors want paste together. problem of character vectors pretty sparse. so, when paste them, na's , separators. how can efficiently remove na's , separators while still joining vectors? i've got like: n1 = c("goats", "goats", "spatula", na, "rectitude", "boink") n2 = c("forever", na, "...yes", na, na, na) cbind(paste(n1,n2, sep=", ")) which gives me: [1,] "goats, forever" [2,] "goats, na" [3,] "spatula, ...yes" [4,] "na, na" [5,] "rectitude, na" [6,] "boink, na" but want: [1,] "goats, forever" [2,] "goats" [3,] "spatula, ...yes" [4,] <na> [5,] "rectitude" [6,] "boink" there inefficient , tedious ways of doing lot of regular expressions , string splitting. quick/simple? not lot of rege

actionscript 3 - Turn image array images to buttons AS3 -

i'm creating app search function. display images loading array one's match search criteria. images loaded library. want able click on image though button. once click want goto frame 3 , change variable integer image clicked on can display information photo in frame 3. can using event listener say imagesarray[i].addeventlistener(mouseevent.click, imageclick); function imageclick(event:mouseevent):void { gotoandstop(3); current = i; } or similar, thanks yes, won't easy. first, bitmaps not process events, can't assign listener directly bitmap object. next, there no "i" available in such construction, have determine "i" yourself. that, parse event.target property, object that's been clicked. wrap each bitmap object separate sprite object, assign listeners these sprites, parse event.target relevant object reference out of it, grab index via indexof() call, , assign global current variable. for (i=0;i<imagearray.leng

Spring MVC + Spring Security login with a rest web service -

i have springmvc web application needs authenticate restful web service using spring security sending username , password. when user logged, cookie needs set user's browser , in subsequent calls user session validated restful web service using cookie. i've been looking everywhere, have not been able find example on how accomplish this, , attempts have been in vain. here have in mind: i can have 2 authentication-providers declared, first checks cookie, , if fails reason goes second 1 checks username , password (will fail if there no username , password in request). both services return authorities of user each time, , spring security "stateless". on other hand, have questioned myself if approach correct, since it's been difficult find example or else same problem. approach wrong? the reason why want instead of jdbc authentication because whole web application stateless , database accessed through restful web services wrap "petitions queue"

asp.net - Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on? -

i enabled impersonation , windows authentiaction. <authentication mode="windows" /> <identity impersonate="true" username="name" password="passord"/> but thread.currentprincipal.identity.name returnes name of authenticated user , windowsidentity.getcurrent() returns impersonated identity. shouldn't these identities same? and under wich credentials code run in case? as far can understand thread.currentprincipal contains information of conditions thread has been started with, including windowsidentity. that's why thread.currentprincipal.identity.name returns name of user started thread. contrary windowsidentity.getcurrent() returns windowsidentity object represents current windows user, has been changed via impersonation. i'm not 100% sure it, that's how think works.

android - Space in SQLite query -

where g.value '" + lookingfor + "%' i have edittext filters cursor sqlite database. want take 'value' 'g' table. example 1 of 'value' 'full stop'. when input 'stop', query should find full stop. if lookingfor "efg", nothing found. how find "abcd efgh" when "efg" typed? ps. not want "abcd edfh" when type "cd" try using where g.value '%" + lookingfor + "'

c# - Error with await operator -

there problem code. how can solve problem? problem in await operator. public mymodel() { httpclient client = new httpclient(); httpresponsemessage response = await client.getasync("https://api.vkontakte.ru/method/video.get?uid=219171498&access_token=d61b93dfded2a37dfcfa63779efdb149653292636cac442e53dae9ba6a049a75637143e318cc79e826149"); string googlesearchtext = await response.content.readasstringasync(); jobject googlesearch = jobject.parse(googlesearchtext); ilist<jtoken> results = googlesearch["response"].children().skip(1).tolist(); ilist<mainpage1> searchresults = new list<mainpage1>(); foreach (jtoken result in results) { mainpage1 searchresult = jsonconvert.deserializeobject<mainpage1>(result.tostring()); searchresults.add(searchresult); } you're trying use await within constructor. can't - constructors alw

asp.net mvc 4 - web api validation messages for one section display before application form is submitted -

Image
i try deal bug on 1 of sections application form developing in order explain issue screenshots below show workflow section: when first navigate section presented screen chose option dropdownlist , click next. when click next form values option selected generated below: the problem comes when change option, when new option form values generated errors previous option being generated shown below: to explain of logic when next or change button clicked posts actionresult in corresponding applycontroller in actionresult posts option value web api saves data database code below performing task: [httppost] [validateantiforgerytoken] public async task<actionresult> admissionstest(admissionstestviewmodel model, applyservice service, string programmedesc, int? programmeid, formcollection formcollection) { guid applicationid = (guid)tempdata["applicationid"]; tempdata["applicationid"] = applicationid; model.appli

javascript - force div height to nearest multiple of the background image height -

bit of tricky situation explain. overall image i'm trying lay under content div of website messy box grungy borders bend in , out. what i've got far (irrelevant code removed) <div class="content-top"><img src="content-top.png"></div> <div id="content"> <!-- wordpress loads content here --> </div> <div class="content-bottom"><img src="content-bottom.png"></div> css: #content { background: url("assets/images/content-bg.png") repeat-y scroll 0 0 transparent; } the content-bg.png image 300px high , repeatable image creating patterned border either side. the problem content-bottom.png image looks right when placed @ end of 1 of these 300px tiles. if page content of height causes half of last background tile displayed lines don't match up. typing doubt answer lies in css , instead i'll need javascript/jquery solution specifics of how i'm unsur

xml - Strange dotted (not regular) line on some Android devices -

Image
we have problem border on ex. layer. on devices (samsung galaxy s ii 4.1.2, samsung galaxy s+ 2.3, etc.) border rendered , on nexus 4.3 , samsung galaxy tab 4.0.4 instead of solid line got dashed (irregular) line. we got (see screenshot above) on nexus 7 (4.3) - left line dashed (wrong) , top line solid (ok, it? antialias?). know why happening? these lines? it's antialiasing problem? for example (code stackoverflow's post): <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#55111111" /> <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /> <corners android:radius="5dp&

java - Android Threading: This Handler class should be static or leaks might occur -

this question has answer here: this handler class should static or leaks might occur: incominghandler 6 answers i using handler object continue ui work after finished time consuming task in seperate thread. had problem of above lint warning , following approach. [ sample handler object type 1 ] -> handler responsehandler = new handler() { @override public void handlemessage(message msg) { super.handlemessage(msg); toast.maketext(mainactivity.this, "finished long running task in seperate thread...", toast.length_long).show(); } }; [ sample handler object type 2 ] -> handler responsehandler = new handler(new handler.callback() { @override public boolean handlemessage(message msg) { toast.maketext(mainactivity.this, "finished long running task in seperate thread...&quo

Why does the output in the C code start counting an array index from the number 1 and not 0? -

so i've got string in c code got book has quote in it, followed string has 1 word quote. when tell program find position of substring, starts counting number 1 , not 0. why this? here mean: #include <stdio.h> #include <string.h> int main() { char str[]="no time present"; char sub[]="time"; if (strstr(str, sub)== null) { printf("not found"); } else { printf("index number found @ %d",strstr(str,sub)-str); } return 0 } so it'll say: index found @ number 3 but shouldn't printing index found @ number 2, because start zero? or can start number 1??! yes starts @ 0, space counted character here output 3 , not 2.

variables - SSIS Script Task Debugging When Checking Value Comparison -

Image
i have code in script task: public sub main() ' ' add code here ' dim monthfromsql string dim lastmonth new date(datetime.today.year, datetime.today.month - 1, 1) dim rcnt integer dim msg string 'msgbox("month name sql " & cstr(dts.variables("monthnamefromsql").value)) rcnt = cint(dts.variables("rowcount").value) if rcnt = 0 msg = "job returned 0 rows month " & cstr(monthname(lastmonth.month, false)) & " - check database operator previous month's data has been loaded database." else msg = "job returned " & rcnt & " rows - job finished" end if 'pass message variable value out used in message dts.variables("emailmessage").value = msg dts.taskresult = dts.results.success end sub if modify if statement below able check month value sql db against system month value gives me d