Posts

Showing posts from June, 2012

asp.net mvc - jQuery issue with identical call when triggered from tab and button -

i have mvc page jquery-ui tabs. when user selects relevant tab jquery ajax call executed load select list. works fine. user can reload list clicking button perform same call once again. when called button ajax call fails!! tried swap order , skip call on tab display, in order make button load first event. still gave same error. the ajax call isolated in same function being called. how can different when called different events? this related code: $("#tabs").tabs({ show: function (event, ui) { var tabname = $(ui.tab).attr("href"); if (tabname == "#tabresult") loadresults(); } }); $("#btnloadresults").click(function () { loadresults(); }); function loadresults() { var testcaseid = $("#testcase_id").val(); $.getjson("api/testsapi/getresults", { testcaseid: testcaseid }) .done(function (data) { $("#lstresults").empty();

How can I get the all the tag data with each task from the asana api? -

currently can tag id through opt_fields when getting list of tasks, not listed option, question is, there anyway more id back? thanks use more value tags in opt_fields: get id - tags, name - tags.name, color - tags.color , etc. simple: ?opt_fields=tags,tags.name,tags.color

handlebars.js - Meteor: Preserving ClassName Flags -

i'm having trouble using preserve method in meteor. doesn't seem want do. basically, have 3 nested templates which, when rendered, in closed state : <div class="dropdown"><!--from template1--> <div class="group"><!--from template2--> <div class="subgroup"><!--from template3--> i'm subgroup's content! </div> </div> </div> to view content in .subgroup node, template wrappers need bear .open class name. done on click event. here's looks in open state : <div class="dropdown open"><!--from template1--> <div class="group open"><!--from template2--> <div class="subgroup open"><!--from template3--> i'm subgroup's content! </div> </div> </div> the issue is, when events fire , alter database within .subgroup's cont

c - gstreamer sample documentation code not running -

trying compile , run sample appsrc code after having executed several tutorials. documentation code, supposed run ... the command used compile gcc appguideappsrc.c -o appguide `pkg-config --cflags --libs gstreamer-0.10 gstreamer-app-0.10` got following error after appguideappsrc.c: in function ‘cb_need_data’: appguideappsrc.c:14:8: warning: assignment makes pointer integer without cast [enabled default] appguideappsrc.c:18:25: error: lvalue required left operand of assignment ok, warning fine line throws error seems ok gst_buffer_pts (buffer) = timestamp; based on answer below @michal, changed timestmap , got following error (appguide:11043): glib-gobject-critical **: g_object_set: assertion `g_is_object (object)' failed (appguide:11043): gstreamer-critical **: gst_bin_add_many: assertion `gst_is_element (element_1)' failed (appguide:11043): gstreamer-critical **: gst_element_link_many: assertion `gst_is_element (element_1)' failed

java - Order of request parameters for content-type application/x-www-form-urlencoded in Spring MVC -

i working on web service consumes requests of type application/x-www-form-urlencoded . here example of such request body: loginid=tester&action=add&requestid=987654321&data=somedata the request signed (with sha1withrsa ) client , signature sent http header. the thing parameters in different order, example: action=add&loginid=tester&requestid=987654321&data=somedata therefor verifying signature fails. interesting occurs if content-type application/x-www-form-urlencoded , if switch content-type text/plain works perfectly. i've used different types of clients (even monitored traffic using tcp monitor) , sure issue not caused client app. here part of custom message converter (note directly printing incoming request console): @override protected object readinternal(class<?> clazz, httpinputmessage inputmessage) throws ioexception, httpmessagenotreadableexception { log.debug("> readinternal - message object&qu

How do I find out if a class and a method exist in .NET dll, from powershell? -

i'm writing powershell script remove redundant entries globalsuppressions.cs file. 1 of techniques want use check whether class , method entry refers exist. suppression entry looks this [assembly: system.diagnostics.codeanalysis.suppressmessage("...", "...", scope = "member", target = "mynamespace.myclass#mymethod(namespace.parametertype1,... namespace.parametertypen)... from can extract qualified name of class, , method signature. can load dll powershell. can't figure out how ask "does class exist?" , "if does, contain method exact signature?" guess somehow achieved through reflection, far have no idea how. have 1 additional limitation, if possible, need perform check without instantiating class. script needs universal, run on many projects. there's no telling classes checked, code default constructors execute, or if have default constructor no parameters. oh, , if know solution in c#, please share it, there

jquery - Hide/show all DIV but the one picked -

see have html code: <form method="post" id="product_create" action=""> <ul> <li id="tab1"><a href="#">step 1</a></li> <li id="tab2"><a href="#">step 2</a></li> <li id="tab3"><a href="#">step 3</a></li> <li id="tab4"><a href="#">step 4</a></li> </ul> <div id="categories-picker"></div> <div style="display:none" id="product-select"></div> <div style="display:none" id="product-details"></div> <div style="display:none" id="product-stock"></div> </form> i need show/hide div others picked one. in case if click in li#tab1 div#categories-picker should show , others should hide no matter

json - How to delete a specific element from an array of JavaScript objects? -

i receiving json output php file, number of objects so: [ { "home_content" : "nam feugiat sem diam, ut fermentum orci hendrerit sit amet.", "home_id" : 2, "home_img" : "tech.png", "home_title" : "latest technologies development" }, { "home_content" : "לורם לורם", "home_id" : 239, "home_img" : "http://placehold.it/400", "home_title" : "שוק פירות וירקות" }, { "home_content" : "new item content", "home_id" : 259, "home_img" : "http://www.placehold.it/100", "home_title" : "new home item" } ] in app want delete object, there way recieve position home_id ? or let me differentiate object list what have there array of objects, can loop through array until find 1 desired home_id : var index; (index = 0; index < array.l

video.js.map throwing a 404 (Not Found) -

playing around newest video.js today, i'm noticing video.js.map showing 404 when putting video.js script site i'm working on. i don't see source map file in initial distribution, doesn't throw error locally, when put on server. ideas solving? you have few options when don't have access source map : ignore message. generaly gets thrown when dev tools open. remove reference in original file. these last characters (comments) @ end of file. generate source map when have access source code. video.js , can generated video.dev.js . use public cdn version might not link source map. there discussion on github topic.

c - GCC doesn't produce line number information even with -g option -

i have built , installed gcc 4.8.1 source: $ gcc -v using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper target: x86_64-unknown-linux-gnu configured with: ./configure --disable-multilib thread model: posix gcc version 4.8.1 (gcc) and i've written simple useless program: $ cat hw.c #include <stdio.h> void foo() { int a; scanf("%d", &a); /* can press ctrl+c here. */ printf("hello world!\n"); } int main() { foo(); } now compile this: $ gcc -g -o0 hw.c -o hw then started debugging gdb: $ gdb hw gnu gdb (ubuntu/linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 copyright (c) 2012 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb confi

python - why my url routing isn't working? -

class respondersapi(methodview): # class based view restful services ... #now have url maps here users_api = respondersapi.as_view('users_api', userlevel=1) admin_mod.add_url_rule("/user/uid/<objectid:user_id>", view_func = users_api, methods=["put", "delete"]) admin_mod.add_url_rule("/user", defaults={'page': 1}, view_func = users_api, methods=["get"]) admin_mod.add_url_rule("/user/page/<int:page>", view_func = users_api, methods=["get"]) admin_mod.add_url_rule("/user/new", view_func = users_api, methods=["post"],) as can see above, problem 1 can't reach 4th routing rule. objectid converter here's whats going on: >>> url_for(&#

java - Rounding Up To The Nearest Hundred -

i came part in java program need round nearest hundred , thought there way guess not. searched net examples or answers , i've yet find since examples appear to nearest hundred. want , round up. maybe there's simple solution i'm overlooking. have tried math.ceil , other functions have not found answer of yet. if me issue appreciate it. if number 203, want result rounded 300. point. 801->900 99->100 14->100 452->500 take advantage of integer division, truncates decimal portion of quotient. make it's rounding up, add 99 first. int rounded = ((num + 99) / 100 ) * 100; examples: 801: ((801 + 99) / 100) * 100 → 900 / 100 * 100 → 9 * 100 = 900 99 : ((99 + 99) / 100) * 100 → 198 / 100 * 100 → 1 * 100 = 100 14 : ((14 + 99) / 100) * 100 → 113 / 100 * 100 → 1 * 100 = 100 452: ((452 + 99) / 100) * 100 → 551 / 100 * 100 → 5 * 100 = 500 203: ((203 + 99) / 100) * 100 → 302 / 100 * 100 → 3 * 100 = 300 200: ((200 + 99) / 100) * 100 → 299 / 100 *

database - What are the additional expenses in jdbc in addition to the time taken by the db to run the query? -

i wanted know additional expenses in running query using jdbc in addition actual time taken database run query , how expensive they. some time used, create object (strings, etc.) ~some nano seconds network-overhead. ~10-50 mili seconds at startup (before first query), there time, loading jdbc driver , creating connection.

Unit testing Burstly Activity (Android) -

i've tried following 2 approaches unit testing custom activity extends burstlyactivity: using robolectric. fails @ multiple places looking burstly related layouts , burstly specific classes, may not present in robolectric framework using android unit testing. gives error: java: myactivitytest.java:14: cannot access com.burstly.lib.conveniencelayer.burstlyactivity class file com.burstly.lib.conveniencelayer.burstlyactivity not found my question is: how can unit test app uses/extends burstly? if have done such thing in past experiences , learnings useful.

Variables in Python -

here little script: class any(object): def __init__(self,x): self.x=x l = [any(2),any(3),any(7),any(9),any(10)] print(len(l)) l2=[ind ind in l] l3=l print(set(l2).difference(l3)) print(l2[1]==l[1]) print(l3[1]==l[1]) del l2[1] print(len(l)) del l3[1] print(len(l)) why deleting instance of any in l2 doesn't change l , deleting in l3 changes l although seems not have difference between l2 , l3? thanks lot! l2 different object created l l3 refers same object l . changing in l or l3 affect object , therefore affect l , l3 .

zend framework2 - ZF2 redirect on public dir -

hello dont know best way redirect on public. i'm doing on server, not on local. on local can make vhost , editd host file when put ftp on server www.example.com cant make vhost. how can redirection on public ? on www.example.com list me directory structure : config/ data/ init_autoloader.php module/ public/ vendor/ i don't know apache .htaccess example how redirection. thanks. you don’t need yourself. it’s done web hosting provider. can point public_html folder instead of public doesn’t matter. can add other folders siblings public_html , it’s done.

c# - Xml attributes to string array -

how "cc" attribute values below xml string array <dd a="1" b="2" c="3"> <d aa="11" bb="22" cc="33"/> <d aa="11" bb="22" cc="33"/> <d aa="11" bb="22" cc="33"/> </dd> cases tried: foreach (xmlnode xd in dd) { xmlelement getfdd = (xmlelement)dd; (int x = 0; x < dd.childnodes.count; x++) { xmlelement xmlfv = (xmlelement)dd.childnodes[x]; stringarr[x] = xmlfv.getattribute("cc"); } } and (int u = 0; u < dd.count; u++) { getfdd = (xmlelement)dd[u].firstchild; xmlelement getfdd1 = (xmlelement)getfdd; stringarr

class - Simply creating a toolbar in Ext JS -

so have panel top , bottom toolbar created within dockeditems config: dockeditems: [ ext.create('am.view.toptoolbar',{}), // //this line alone breaks app { //toolbars xtype: 'toolbar', dock: 'bottom', items: [ { text: 'about', itemid: 'about' }, '-', { text: 'legal', itemid: 'legal' }, ... the code works fine in ff, breaks in ie9. think has syntax of create statement, cannot find solution on forums. here's toptoolbar class: ext.define('am.view.toptoolbar', { extend: 'ext.toolbar.toolbar', alias: 'widget.toptoolbar', defaults: { arrowcls: '' }, //removing black arrow toolbar items items: [ { text : 'tools', menu : { items: [ //rest of toolbar items , menus all file structures correct , working. namespace 'am'

c# - NUnit TestCaseSource returns the same data for different yields -

i have issue nunit framework , testcasesourse. have test data: public testdata[] data = new testdatabuilder() .add("inputfile", "132jointest.xml") .addrange("delimiter", ";", "") .addallsubsets("sectionnames", new string[] { "headline", "byline", "summary" }).gettestdata(); also have data testcasesource: public ienumerable<testcasedata> reducetagsnumber { { yield return new testcasedata(data[0]); yield return new testcasedata(data[1]); } } [testcasesource("reducetagsnumber")] public void execute_forinputthatcouldbejoined_reducetagsnumber(testdata data) { //some code here } i double check, data[0] , data[1] contains different data. when run nunit tests both of them runned data[0]. try implement in different ways, same result. note: if use testdata structure instead testdata class nunit doesn&

sockets - How to inject a "Broken pipe" error? -

i running test network program uses tcp sockets. verify bug fix, need reproduce "broken pipe" error @ socket layer, don't know how. idea? lot. 'broken pipe' means have written connection has been closed peer. so, have peer close connection.

c# - Infer interface by type at compile time -

is there way infer interface object based on type. instance if had following object: public class person { public string firstname { get; set; } public string lastname { get; set; } } i able infer interface: public interface iperson { string firstname { get; set; } string lastname { get; set; } } what able create generic proxy factory, using reflection.emit, adheres inferred interface @ compile time. know instead return dynamic object object's properties, handled @ runtime vs. compilation. edit a little more explanation i'm trying achieve. want create proxy class has method signature this: public t getproxyfor<u>(u someobject); that way user can call getproxyfor(people) , peopleproxy object implement properties of people object (or other object). way, using code call peopleproxy.lastname , compile, call peopleproxy.age result in error when compiled since doesn't exist. i'm new reflection , emitting, i'm wanting may n

class - Extending JavaScript Classes for use on Canvas -

i working on project me gain better understanding of javascript , building applications it. making game utilizing createjs. i'd extend shape "class" adding additional methods can't seem head around issue. i not getting runtime errors approach, think it's failing silently @ particular point. my subclass: shipgfx.prototype = new createjs.shape(); function shipgfx() { createjs.shape.apply( ); this.draw = function() { var g = this.graphics; g.clear(); g.setstrokestyle( 1 ); g.beginstroke( createjs.graphics.getrgb( 0x00ff00 ) ); g.beginfill( createjs.graphics.getrgb( 0x00ff00, 0.5 ) ); g.moveto( 0, 0 ); g.lineto( -5, -5 ); g.lineto( 10, 0 ); g.lineto( -5, 5 ); g.lineto( 0, 0 ); g.endfill(); } } where it's used: var shape = new shipgfx(); shape.draw(); so console logs no er

php - Cant understand what's happening -

i'm trying zend framework, i've got 2 folders in e:\archivos de programa\zend\zendserver\share , une zendserver , other 1 zendserver2 can't recall if ever install 2 version dont think problem i'm using netbeans ide ando i'm trying make abm of users using blockcipher here code <?php use zend\crypt\blockcipher; class application_model_dbtable_usuarios extends zend_db_table_abstract { protected $_name = 'usuario'; public function getusuario($usuario) { $usuario = (string)$usuario; $row = $this->fetchrow('usuario = ' . $usuario); if (!$row) { throw new exception("could not find row $usuario"); } return $row->toarray(); } public function addusuario($usuario, $clave) { $blockcipher = zend\crypt\blockcipher::factory('mcrypt',array('algo'=>'aes')); $blockcipher->setkey('encryption key'); $result =

android - simulate onOptionsItemSelected inside method call -

i have imageview inside xml layout. imageview has onclick method. android:onclick="onhomeclicked" when user clicks image, want in turn call onoptionsitemselected inside activity. how that? the following code gives null homemenuitem : menuitem homemenuitem; @override public boolean onprepareoptionsmenu(menu menu) { homemenuitem = menu.finditem(android.r.id.home); super.onprepareoptionsmenu(menu); return true; } public void onhomeclicked(view view) { onoptionsitemselected(homemenuitem); } possible have declare method , call onoptionsitemselected , onhomeclicked onoptionsitemselected(menuitem item){ switch(item.getitemid()) { case r.id.btn: younewmethod(); break; } } public void onhomeclicked() { younewmethod(); } private void younewmethod(){ // write code here }

php - Wordpress display name string manipulation -

i have set display name show both first name , last name using function below. how manipulate last name pull first letter of string? example, if sign john doe (first name= john, last name= doe), want display name john d. thanks function force_pretty_displaynames($user_login, $user) { $outcome = trim(get_user_meta($user->id, 'first_name', true) . " " . get_user_meta($user->id, 'last_name', true)); if (!empty($outcome) && ($user->data->display_name!=$outcome)) { wp_update_user( array ('id' => $user->id, 'display_name' => $outcome)); } } add_action('wp_login','force_pretty_displaynames',10,2); this how solved using php's substr() function: $outcome = trim( get_user_meta( $user->id, 'first_name', true ) . ' ' . substr( get_user_meta( $user->id, 'last_name', true ), 0, 1 ) . '.' ); above code pat j full code display first name

php - split() deprecated. How to convert? -

this question has answer here: deprecated: function split() deprecated. how rewrite statement? 4 answers i have piece of code that's using split() function. php complaining function deprecated. how can converted non deprecated split? if(!empty($vis_settings['url']['urls'])){ $split_urls=split("[\n ]+",(string)$vis_settings['url']['urls']); you can use preg_split . $split_urls = preg_split("/[\n ]+/",(string) $vis_settings['url']['urls']);

How public members of a class causes havoc in java? -

how public members of class causes havoc in java? can please explain example? tried create such situation couldn't succeed. found them equivalent 'protected' access modifier. it allows invalid values, breaking encapsulation. public class clock { public int hours; public int minutes; } then, in unrelated code... clock clock = new clock(); clock.hours = 42; clock.minutes = 99; having them private setter , getter methods allows encapsulation enforce proper values. public class clock { private int hours; private int minutes; public void sethours(int hours) { if (hours < 0 || hours > 23) throw new illegalargumentexception("bad range"); this.hours = hours; } // likewise "setminutes" method. } here's tutorial page on encapsulation in java on encapsulation's benefits. quoting: the fields of class can made read-only or write-only. a class can have total control on stor

Java - InvocationTargetException when casting List to ArrayList -

say class defined like: public class foodfactory{ protected elist<food> basket; public list<food> getbasket(){ return basket; } } the following throws exeption when try run it: foodfactory factory = new foodfactory(); arraylist<food> foodbasket; foodbasket = (arraylist<food>)getbasket(); and i'm not seeing why. did not cast properly? well, long elist ot derived arraylist , there must classcastexception. list<food> foodbasket = (list<food>) factory.getbasket(); don't use arraylist , use interface list . by way, should use java naming conventions . classnames start uppercase. valiables lowercase.

google app engine - Request for Request Token from Intuit IPP gives permission denied -

i doing on local development site without problems. when try setup new connection quickbooks file live site, permission denied error. here error returned: "post https://oauth.intuit.com/oauth/v1/get_request_token : permission denied" here request headers content-type application/x-www-form-urlencoded authorization oauth oauth_consumer_key="my_key", oauth_nonce="my_nonce", oauth_signature="my_sig", oauth_signature_method="hmac-sha1", oauth_timestamp="1377287041", oauth_version="1.0" here request body: oauth_callback=http%3a%2f%2fwww.intheloop-notes.com%2fqb%2fconnect%2freturn%2f ---- edit ---- the response nil altogether, getting error go code on: response, err := client.do(request) which why have added couple of tags question (go , google-app-engine) try , broaden audience. pretty sure error in way oauth library sending request. using library: https://github.com/kurrik/oauth1a

svn - Viewing and Removing multiple commits at once? -

is there quick way remove multiple commits @ once svn on remote repo? and on seeing file list of modified, e mean? you can't remove commits in deleting commit, though can reverse merge , commit that. details on how can found in svnbook | undoing changes . you can specify list of commits, non-consequitive commits doing: svn merge -c -1234,-1271,-1285 . to second question, there no such status code 'e'. see list svn status .

How to use knockout.js with ASP.NET MVC ViewModels? -

Image
bounty it's been awhile , still have couple outstanding questions. hope adding bounty maybe these questions answered. how use html helpers knockout.js why document ready needed make work(see first edit more information) how do if using knockout mapping view models? not have function due mapping. function appviewmodel() { // ... leave firstname, lastname, , fullname unchanged here ... this.capitalizelastname = function() { var currentval = this.lastname(); // read current value this.lastname(currentval.touppercase()); // write modified value }; i want use plugins instance want able rollback observables if user cancels request want able go last value. research seems achieved people making plugins editables how use if using mapping? don’t want go method have in view manual mapping map each mvc viewmode field ko model field want little inline javascript possible , seems double work , that’s why mapping. i concerned make work easy (by using m

Excel VBA: How do I add an item to a collection within a class? -

i have class contains collection of itself. (the top level class contains summary versions of detailed instances in collection.) currently collection public variable because haven't figured out details of working private variables yet. can fix later. how add items collection? getting error 91 missing object variables. thanks prior help. have been retooling code use classes more extensively, , it's great how things cleaning up. class cpe public pe_details collection ' collection of cpe public pe_id integer public pe_id_index integer ' add detailed list of pe's public function addpedetail(byref cpe_detail cpe) pe_details.add cpe_detail ' error: object variable or ' block variable not set end function the module code calls follows: dim clspe cpe ' summary version of pe dim clspe_detail cpe ' detailed pe dim integer set clspe = new cpe ' pe contain list of detai

c# - How to use JQuery "datatable" plugin server side processing with large data in .NET MVC3 razor views -

i have datatable displays list of employees. works fine when number of employees in 0-2000 range after there serious lag time when loading page. not surprizing since loading massive amount of data on page load. looked everywhere , couldnt find example shows how server side processing. projects found on git hub not working in computer(i got lot of "missing references" errors). code have working right now the employees.cshtml @model employeelist @{ layout = null; viewbag.title = "employees"; } <html> <head> <head/> <body> <table id="employees_gridview"> <thead> <tr> <th name </th> <th> username </th> <th> job category </th> &l

oracle - SQL*PLUS Concatenation Issues -

this question has answer here: concatenation issues 3 answers this sql*plus i have table "patient" has 5 fields. create table patient (pat_id char (4) primary key, pat_name varchar (7), admitted date, room char (3), doctor varchar (7)); insert patient values (1001, 'fred', '30-mar-07', 101, 'payne'); i want create view output this: patient doctor room admitted "-----------------------------------------------" 1001 fred payne 101 march 31, 2007 the problem want concatenate pat_name , pat_id own separate "patient" column also have other 3 fields concatenated it(notice there no separation in 'dashes'). basically, have 5 fields. simplicity's sake, let's call them fields "1, 2, 3, 4, 5". i want com

cocoa touch - iOS [ARC] app not releasing memory -

Image
my application, during process i've written, rising in memory , seems not releasing it. the first thing i'd mention basic outline of i've written this: - request url (fetching data using nsdata -initwithcontentsofurl) - parse nsdata nsarray of nsdictionarys using nsjsonserialization +jsonobjectwithstream - loop through decoded nsarray inserting/updating/deleting records in sqlite database using fmdb framework data decoded the application above, in loop undetermined period of time, in application displays "loading" hud. thought may worth mentioning this, although find insignificant how many times process, shouldn't affect memory usage if releasing properly. if wrong here, please advise me. my code works fine, well, it's intended do. however, when profile application code, memory seems keep rising. drop in segments throughout, overall keeps rising (ie doesn't release in full used). i have, stated, profiled application allocations, leaks

java - Why Syntax error appears on the following if condition -

hi have following if condition in java if ((i%3)==0) work else if ((i%3 || i%5)==0)----syntax error appears on line work and showing me following syntax error... multiple markers @ line - operator || undefined argument type(s) int, int - syntax error on token "or", . expected - cannot resolved or not field can 1 please tell me how can fix 1 ?? you have have comparison every part of condition. in case else if should this else if (i%3 == 0 || i%5 == 0)

java - Using mutual SSL for secure proxying of requests -

i'm working on website (a) that's going proxy requests to/from other websites (b) plugged-in (a). both , b internal user needs authenticated in order access them. moreover, specific users can use specific websites (b). i'm looking best way of passing credentials of user accessed (a) service (b) service (b) can authenticate same user. i thought using mutual ssl ensuring secure connection between (a) , (b). i'm complete newbie in world of network security, i'd appreciate opinions it. also, libraries use? , how feasible passing certificate of given user through website (a) (b) if use mutual ssl authenticating between user , website (a) too?

mysql - Laravel - How to paginate here? -

i have code , want paginate $shares. how can archive this? $level = share::join('follows', 'shares.user_id', '=', 'follows.user_id') ->where('follows.follower_id', auth::user()->id) ->where('follows.level', 1) ->get(array('shares.*')); //get 10% of shares $count = share::count()/10; $count = round($count); $top10 = share::orderby('positive', 'desc') ->take($count) ->get(); $shares = $top10->merge($level); //get unique shares $unique = array(); $uniqueshares = $shares->filter(function($item) use (&$unique) { if (!in_array($item->id, $unique)) { $unique[] = $item->id; return true; } else { return false; } }); //order id $shares = $uniqueshares->sortby(function($share) { return -($share->id); }); return view::make('layout/main') ->with('shares', $shares); lots

Android: SeekBar onProgressChanged-event doesn't get fired when setting progress programmatically -

my onprogresschanged()-event doesn't fired when set progress of seekbar programmatically, fired fine when physically move seekbar slider. i'd expect event fire when using setprogress() - android developer reference states that: public abstract void onprogresschanged (seekbar seekbar, int progress, boolean fromuser) notification progress level has changed. clients can use fromuser parameter distinguish user-initiated changes occurred programmatically. some code snippets project: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_activity); final seekbar myseekbar = ((seekbar) findviewbyid(r.id.myseekbar)); myseekbar.setonseekbarchangelistener(new onseekbarchangelistener(){ @override public void onprogresschanged(seekbar arg0, int arg1, boolean arg2) { // stuff } } } @override protected void onresume() { su

javascript - recursive ajax calls not executing script included inbetween the recursion -

i have recursive ajax call work (php script called job, recursion working, fine) except in between ajax calls try update input text value show progress , updates once whole loop done. why line $('#start_'+code_regional).val(msg); not executing ? function addleads(code_regional, phone_numbers_start) { var databases = []; var file = document.getelementbyid('file_'+code_regional).files[0]; var formdata = new formdata(); formdata.append('selecteddatabases', json.stringify(databases)); formdata.append('code_regional', code_regional); formdata.append('phone_numbers_start', phone_numbers_start); formdata.append('phone_numbers_end', $('#end_'+code_regional).val()); formdata.append('filepath', file); $.ajax({ type: 'post', url: 'execute.php', data: formdata, processdata: false,

php - How can I efficiently search a field for flipped word order? -

i have following array. $arr = array('foo','bar','foo-bar','abc','def','abc-def','ghi','abc-def-ghi'); i'm given new string decide add array or not. if string in array, don't add it. if not in array in current form, in flipped word form found, don't add it. how should accomplish this? examples: 'foo' —-> n - not add, found 'xyz' —-> y - add, new 'bar-foo' —-> n - not add, found in flipped form 'foo-bar' 'ghi-jkl' —-> y - add, new what recommend? if want exclude items elements ('abc','ghi', etc.) contained in order , not reversed, do: $arr = array('foo','bar','foo-bar','abc','def','abc-def','ghi','abc-def-ghi'); function split_and_sort($str) { $partsa = explode('-', $str); sort($partsa); return $partsa; } $arr_parts =

javascript - Textbox is not taking the value that I assign -

i have page 10 inputs (textbox). set each input value in page_load with txtcolor.text = "#ffffff" each input color picker. when user pick color, hexa-name set in textbox javascript piece of code: document.getelementbyid(txtcolor).setattribute("value", newcolor); buuuuuuut when try save changes dont know why values saved old ones. if @ first value "ffffff" user chose "000000" program ignores , save "ffffff" in db. i'm working vb.net i appreciate kind of help! edit: oh god, of course thing tim medora say. put 'not ispostback' , works fine. thanks lot, wasnt able see error. you you're using vb script, post tagged javascript. it's not clear you're working with, in javascript i'd this: colorpicker = document.getelementbyid("color-picker"); colorpicker.addeventlistener("change", function () { updatetextbox(); }); textbox = document.getelementbyid("text-box&q

java - How to make not generate a number twice? -

this question has answer here: choose unique random numbers specific range 3 answers in program using random generator. random random = new random(); //how use int = random.nextint(numberneeded); the problem is, need find way each number gets generated once. guess not complete random....for example....when number 1 generated, dont want called again, instead call 1 of other numbers...like 2,3, or 4...then when 4 call can call 2 or 3.. then next time numbers shuffled , repeats process... the numbers need range 4 16 it easier use collections.shuffle on list of elements want select from: arraylist<integer> numbers = new arraylist<integer>(); (int i=4; i<=16; i++) numbers.add(i); collections.shuffle(numbers); // numbers in random order , contain numbers 4 through 16