Posts

Showing posts from August, 2011

mysql - error c# System.NullReferenceException -

i have code: public ordertotalmodel getordertotalmodelbyagentid(string agentids = null, datetime? fromdate = null, datetime? todate = null) { var session = sessionmanager.currentsession; truncateamount truncateamount = new truncateamount(); string sql = @" select sum(o.totalquantity) totalquantity,sum(o.totalamount) totalamount orders o join workflows w on w.step = o.status inner join agents on a.id = o.agentid w.step = o.status , w.external = true , w.inactive = false , o.agentid in (:agentids) , o.approved = true"; //tu ngay if (fromdate.hasvalue) { sql += " , date(o.created) >= date(:fromdate)"; } // den ngay if (todate.hasvalue) { sql += " , date(o.created) <= date(:todate)"; ...

c# - how do i disable key repeat in Windows mobile or MC67 -

i'm using motorola mc67 windows mobile 6.0 , writing in c# compact framework. i want disable key repeats, if press long "enter" example, won't more 1 "enter" press. i've searched motorola manual, , tried advice given here , doing: registry.setvalue(@"hkcu\controlpanel\keybd", "repeatrate", "1000000"); but no use. can me? just clear: have access change registry code, after change rate max possible, ignore value in registry. if key software button, can disable button: private void btnok_clicked(object sender, eventargs e) { btnok.enabled = false; try { // code here } { btnok.enabled = true; } } if physical key on device, don't know how go in , set "click rate" (or whatever called), try adding lock around routine. private object m_lock = new object(); private void textbox_changed(object sender, eventargs e) { lock (m_lock) { // code here } } i don't kno...

c# - Duplicate clicks on xx_Tap() happening in separate class -

the scenario: want tap on textblock , run method add item cart. no, don't prefer buttons textblocks, thank :) the code (shoppingcart.cs) using system; using system.collections.generic; using system.linq; using system.text; using system.diagnostics; using system.threading.tasks; namespace m_pos { public class shoppingcart { int cartnum; int duplicate=0; int num_of_items; int counter=1; list<item> items = new list<item>(); //constructor public shoppingcart() { this.cartnum = counter; counter += 1; this.num_of_items = 0; this.items = new list<item>(); init_items(); } //return item list of tapped/purchased items public list<item> getitems(){ return this.items; } //returns number of items tapped/purchased public int get_num_of_items() { return this.num_of_items;...

oop - Java: Forcing Not to Override -

i have super class final method public final void foo(){ ... } no cannot it. overriding method in subclass superclass method marked final not possible . can add method different signature the purpose of final keyword applied method doesn't allow subclass method override it.

Special Case to Replace String Using Python with Regex -

i'd replace decimal point not period in 1 content. for example: original content: this cake. 1.45 dollars , 2.38 kg. replaced content: this cake. cost 1<replace>45 dollars , 2<replace>38 kg. how can use python regex ? thank much. use re.sub lookaround assertions: >>> import re >>> s = 'this cake. 1.45 dollars , 2.38 kg.' >>> re.sub(r'(?<=\d)\.(?=\d)', '<replace>', s) 'this cake. 1<replace>45 dollars , 2<replace>38 kg.'

google maps - Markerclusterer hide markers that aren't clustered -

is there way hide marker isn't clustered? appreciated. though checking mark value after clustering setting null or maybe if zoom level isn't 4. not sure how go it. set visible -property of markers false

Ruby On Rails - Reusing the error message partial view -

problem i trying reuse error message block in views. below block written in positions/_error_messages.html.erb <% if @position.errors.any? %> <div id="error_explanation"> <div class="alert alert-error"> form contains <%= pluralize(@position.errors.count, "error") %>. </div> <ul> <% @position.errors.full_messages.each |msg| %> <li>* <%= msg %></li> <% end %> </ul> </div> <% end %> the problem have created similar partial view in every model kind of repeating same code different object i.e. @user, @client etc. remedy i have created 1 erb in shared folder shared/_error_messages.html.erb , wrote below code. <% def error_message(active_object) %> <% if active_object.errors.any? %> <div id="error_explanation"> <div class="alert alert-error"> form contains <%= pluralize(active...

android - How is it possible for the user to receive notifications even when the app is not running -

so trying make app when row in sql database changes, user receives notification though app not running. i'm pretty sure possible because facebook can send mobile notifications when app isn't running, i'm not sure how go this. you need use service runs in background. within service can start notification. not clear 'notification' talking about? if talking notification in google cloud messaging notification , need go different way. but, using gcmintentservice extends service class. you want send notification when when row in sql database changes . row changing on server side? assuming yes because first talking android database, have mentioned sqlite instead of sql. secondly gave example of facebook. so, if answer question yes, using gcm push services can send push message user. when user receives message, can show notification proper data. in onreceive method of gcmintentservice , receive content in intent. there can extract message , create notif...

c++ - How to use Initializer list in objective C -

i have worked on c++, there used initializer list below initialize constructor of base class. derived::derived(int x):base(x) { cout << "b's constructor called"; } how acheive same action in objective c. how pass value base (super) class while initlizing. possible? thanx. we use [super init]; initialize super classes. require.

serialization - C# testable serialize class -

i have big solution many count of serializers/deserializers +interfaces. i'd reduce files count keep testability , readability of code. i'm searching serializer provider (not factory), example: interface iserializable { string serialize<t>(t obj); t deserialize<t>(string xml); } class serializable : iserializable { public string serialize<t>(t obj) { return this.toxml(obj); } public t deserialize<t>(string xml) { throw new system.notimplementedexception(); } } internal static class serializers { public static string toxml(this serializable s, int value) { } public static string toxml(this serializable s, sometype value) { } } in case i'll need add new extension serialize type. common interface stay: iserializable provider; provider.serialize<sometype>(obj); ...

angularjs - Create custom angular-bootstrap typeahead data -

i having trouble creating list bootstrap's ui-typeahead directive: an $http-call returns following json: [{"title":"foo", "equipment":[{"model":"model 1"}, {"model":"model 2"}], "combine":"true"}] what need : concatenate title "foo" input user has typed in input field , create list of equipments : "model 1" , "model 2" (the actual dropdown-data) either 2 separate drop-down items or concatenate "model 1" , "model 2" if "combine" set "true" yield 1 drop-down item. upon clicking on 1 of "equipment" entries in drop-down need call function sets chosen model in service object , calls $location's url function. is possible? here's template using via "typeahead-template-url": <input typeahead="val val in autocomplete($viewvalue)" typeahead-template-url="searchaut...

WPF - Why does the Visual studio design surface stop databinding when using a button ControlTemplate defined in a different assembly? -

i've been working on current project on year, , i'm trying retro fit design time data views. application has base resource dictionary contains default styles controls. application able load plugin can override or of default styles, hence why resource dictionary contained in external assembly in following example. note: isn't such big problem supplied demo project, causing headaches in actual application highlighted problem in first place. the view: <usercontrol x:class="designtimedata.usercontrol1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:designtimedata" mc:ignorable="d" ...

javascript - Horizontally scrolling treeview on mouseover -

i have treeview space limited, such treeview items can end going outside container. around have made container overflow hidden , set javascript auto scrolls horizontally user mouses on various parts of treeview. this almost works there odd behaviour if move 1 li another. if move mouse fast down tree behaves expected if go , , forth treeview bounces horizontally left right. to test out try move folder 2 folder 3 , again. happening here? my js code below , can see happening in fiddle made $(function () { $("#addresspanel ul.treeview").on("mouseover", "li", function (e) { e.stoppropagation(); console.log("mouseover", this, $(this).first().offset().left); $('#addresspanel ul:first').stop().animate({ scrollleft: $(this).first().offset().left }, 400); //$('#addresspanel ul:first').stop().animate({ "margin-left": -($(this).first().offset().left) }, 400); ...

jquery - Inverse of Next Siblings Selector -

so came across next sibling selector on jquery docs today: $("label + input") and wondering - there inverse of selector? i.e. select previous sibling? i use: $("label + input").prev() for example in this fiddle , labels in label followed input, want, way it? you can use array provided sibling() check out: http://api.jquery.com/category/traversing/tree-traversal/

sql - Oracle - calculate number of rows before some condition is applied -

i know how many rows returned without rownum condition in given query: select columns , [number of rows before applying rownum] numberofrows tables conditions , rownum < 100 is possible without using subquery? you can use analytic version of count() in nested query, e.g.: select * ( select table_name, count(*) over() numberofrows all_tables owner = 'sys' order table_name ) rownum < 10; you need nest anyway apply order-by before rownum filter consistent results, otherwise random(ish) set of rows. you can replace rownum analytic row_number() function: select table_name, cnt ( select table_name, count(*) on () numberofrows, row_number() on (order table_name) rn all_tables owner = 'sys' ) rn < 10;

iphone - how to show facebook Events in application -

Image
i want show users event page in app i tried graph api not helps. i want this got answer: i did: nsurl *url=[nsurl urlwithstring:@"https://www.facebook.com/events/list"]; [[uiapplication sharedapplication] openurl:url]; its done thanks tried me. this shows users events had loggedin - in device

asp.net - What does the <#= symbol mean? -

what <# symbol means in asp.net inside html tag. <td><#= userinfo.observerresponsekey != null ? (userinfo.observerstatus == '<%= enum.getname(typeof(status), status.draft) %>' ? "draft shared " + userinfo.observerdatesubmittedstring : userinfo.observerstatus == '<%= enum.getname(typeof(status), status.private) %>' ? "in progress" : "completed " + userinfo.observerdatesubmittedstring) + " " + userinfo.observername : "not started" #></td> i want add img td if result "in progress" or "completed". i tried adding <td><#= userinfo.observerresponsekey != null ? (userinfo.observerstatus == '<%= enum.getname(typeof(status), status.draft) %>' ? "draft shared " + userinfo.observerdatesubmittedstring : userinfo.observerstatus == '<%= enum.getname(typeof(status), status.private) %>' ? "in progress" : ...

javascript - Why webkit notification event does not trigger? -

i have wrote webkit notification script on web app pull notifications database. code seen below function checknotifications() { if (window.webkitnotifications.checkpermission() == 1) { window.webkitnotifications.requestpermission(); } else { $.ajax({ type: "get", datatype: 'json', url: '/check_notifications', success: function(data){ if (data){ var ticketid = data.ticket_id; console.log(data); var comment = data.comment; var createddate = data.created_at; var notificationcomment = data.comment; var notificationid = data.notifcation_id; var notification = window.webkitnotifications.createnotification('/pt_logo_small.png', 'project ticket '+...

php - Codeigniter modular extensions HMVC won't load view -

i using modular extensions hmvc add on codeigniter. my structure looks follows: modules/ -manager/ --controllers/ ---manager.php --views/ ---index.php the manager.php controller: class manager extends mx_controller { function __construct(){ parent::__construct(); } function index(){ $data['newsletter'] = newsletter::all(); $this->load->view('index',$data); } } routing , printing inside controller works fine, can't seem load view, codeigniter error saying view file can't found /modules/manager/config/routes.php: <?php $route['module_name'] = 'manager'; it seems views still being called ci's main view folder, not sure why not calling modules folder because controller extending mx class try this: $this->load->view('manager/index',$data); structure folders: apllication modules manager config routes.php controllers ...

android - App not getting minimized on home button click -

i want write code on home button clicked user in app. i written following code: @override public void onattachedtowindow() { super.onattachedtowindow(); this.getwindow().settype(windowmanager.layoutparams.type_keyguard); } @override public boolean onkeydown(int keycode, keyevent event) { if(keycode == keyevent.keycode_home) { //the code want perform. toast.maketext(getapplicationcontext(), flag+"in here", toast.length_short).show(); } return true; } this code gives me toast message, not minize app. once remove following code: @override public void onattachedtowindow() { super.onattachedtowindow(); this.getwindow().settype(windowmanager.layoutparams.type_keyguard); } and keep only: @override public boolean onkeydown(int ...

c++ - Null pointer sqlite3 handle after passed to function call -

when use function in c++ init sqlite3, when comes out of function handle null. idea might cause this? hand pointer on parameter. if move open main function works fine. happens causes this? hidden , going out of scope? #include <iostream> #include "sqlite3.h" using namespace std; int init_table(sqlite3 *dbh, string db_name) { if (sqlite3_open(db_name.c_str(), &dbh) != sqlite_ok) { cout << "failed open db : " << sqlite3_errmsg(dbh) << endl; abort(); } else { cout << "opened database: " << db_name << endl; } if (sqlite3_exec(dbh, "pragma synchronous = off", null, null, null) != sqlite_ok) { cout << "failed set synchronous: " << sqlite3_errmsg(dbh) << endl; } if (sqlite3_exec(dbh, "pragma journal_mode = wal", null, null, null) != sqlite_ok) { cout << "failed set journal mode: ...

python - Trying to query SQL Server from django running on Linux - Can't open lib '/path/to/libtdsodbc.so' -

i have django site running on postgresql , i'm attempting pull data sql server in order populate form fields. i can connect sql server , query database linux server using python pyodbc , freetds , under impression use same connection string in django view when tried got following error: ('01000', "[01000] [unixodbc][driver manager]can't open lib '/path/to/libtdsodbc.so' : file not found (0) (sqldriverconnect)") i've tried changing file , folder permissions it's not got me anywhere, can connect via python not django. i can connect command line in django applications folder using manage.py shell any appreciated. update: the file exists, both django , python using same odbc , freetds config files. i don't use virtualenv. i did see few references /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so when performing initial set under impression issues solve prevent python connecting also, not case? update 2: i've trie...

r - Projecting point into existing PCOA -

i'm trying project point existing pcoa space (in r). under impression must possible, can't figure out how go it. here's how far i've gotten (a toy example): x <- c(1:10) y <- c(10:1) z <- c(rnorm(10,mean=0,sd=2),rnorm(10,mean=10,sd=2)) m <- cbind(x,y,z) d <- dist(m) r <- pcoa(d) biplot(r,m) the biplot generates representation want. now, given new point p=(x,y,z) project above space. reason need , can't add point original matrix new point going outlier , change projection of original space. want know point ends relative untainted representation. also note don't use euclidean distance in reality, doing pca not option.

java - Swing - JavaFX integration -

i have bit of weird problem. have swing application has windows built javafx (don't ask why did this, had due project delivery time restrictions). app 50% swing , 50% javafx. anyway found when started deploying application customers of javafx jfxpanels using don't display properly to more precise jfxpanels have in main window, crested application starts, showing fine. other jfxpanels include in other windows popup while using application don't display correctly. jframe opens empty of javafx components. weird thing when enable java console (java-settings -> advanced -> show console) working fine. the same problem have in operating systems deployed application. 32 , 64 bit. using jre 7u25 in machines. any clues anybody? maybe it's related bug 8021381 ? i appears fixed in java 7u40-b38 according release notes so suggest try out java 7u40 access release ( download ).

html - My Website displays properly in every browser except Firefox -

chrome, safari , opera display website without trouble, though firefox removes top section including menu. center of section entirely removed , replaced white. i'm not @ sure issue is. any suggestions? website under development , can found: http://www.jw.potatomou.se/ thanks in advance your .row has height of 1% , set overflow:hidden. need clear floats them take presentational space. should it: .row { height: auto; margin: 0.5em; min-height: 1%; overflow: visible; padding: 2% 1em 0; } .row:after { clear: both; content: ""; display: table; }

javascript - $.on() performs multiple times. Why? -

i discovered strange thing in code: drawing.activeobjects = new array(); $(".svgobjects").on("mousedown", function(){ console.log("clicked" + $(this).attr('id')); drawing.activeobjects.push(findobjinarray($(this).attr('id'))); console.log("ao: " + json.stringify(drawing.activeobjects)); }); when click on object 1 time, ok. when click again runs 2 times. , after 7 clicks, can see 7 times "clicked" in console , 7 objects in array. i don't know why. have 1 object on site, , clear array before check clicks. yet see many objects in array number of clicks make. the code not magically know want listen 1 click on element , no more. need program behaves way. if expect called 1 time, need remove code click or can @ jquery's one()

Change listbox selected item color in xaml Windows 8 -

i developing windows 8 xaml application , want change color of selected text of textblock contained in datatemplate of listbox dynamically, had tried lot solve problem.please me find solution. here code <style x:key="listboxstyle" targettype="listbox"> <setter property="foreground" value="{staticresource listboxforegroundthemebrush}"/> <setter property="background" value="{staticresource listboxbackgroundthemebrush}"/> <setter property="borderbrush" value="{staticresource listboxborderthemebrush}"/> <setter property="borderthickness" value="{staticresource listboxborderthemethickness}"/> <setter property="scrollviewer.horizontalscrollbarvisibility" value="disabled"/> <setter property="scrollviewer.verticalscrollbarvisibility" value=...

Overflow hidden not working with jQuery .css click event -

i'm assigning overflow: hidden not seem work jsfiddle html <ul class="list-container"> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> <li>items items</li> </ul> <a href="#" class="hide_list">hide list</a> jquery $('.hide_list').click(function() { $('.list-container').animate({width: "2px"}); $('.list-container').css("overflow","hidden"); }); i trying achieve slide shut effect on div. if there way it, i'm not sure why isn't working though. try swap them. $('.hide_list').click(function() { $('.list-container').css("overflow","hi...

Python add numbers up in loop -

i have list of numbers: list1 = [33, 11, 42, 53, 12, 67, 74, 34, 78, 10, 23] what need calculate total amount of numbers in list, divide 360 work out portions of circle. example 32. have done below: def heading(): heading_loop in range(len(list1)): heading_deg = (360 / len(list1)) return heading_deg the problem have need have number (heading_deg) append last number everytime runs throught loop. e.g. run 1: 32 run 2: 64 run 3: 96 run 4: 128 etc etc any ideas?? @ moment return 32, 11 times. thanks!! i'm sorry i've posted answer think wanna different show in code. have if want: def heading(): result=[] #create void list numbersum=sum(list1) #"calculate total amount of numbers in list" # e.g. if list=[1,1,2] sum(list) return 1+1+2. in range(len(list1)): result.append(((list1[i])/float(numbersum))*360) # calculate portion of circle ("then divide 360 work out portions of circle") #in case if...

html - child with 100% width in padding applied parent -

Image
i have div css specifications: width:200px; padding:5px border:1px solid and div it's child css: width:100% border:1px solid and these divs has rendered in ff , ie this: but seems right padding less left one! can 1 tell me why behavior causes? this happens because borders of inner div not part of definition of width itself, inner div 100% + 2px wide. you should specify box-sizing: border-box; inner div, width include borders see mdn documentation further information (and browser support) property.

objective c - NSLog - Write word in singular if condition is met -

i'm writing single command line program in objective-c after writing in java. in 1 sentence need change word depending on number, if number 1, word must in singular otherwise, should in plural. in java can system.out.println"hello" + (num = 1 ? "singular" : "plural"); how can similar in objective-c? you can use same exact trick in objective c: nslog(@"hello %@", num == 1 ? @"singular" : @"plural");

ios - How to convert UIColor RGB Color to uint32_t Value -

how convert uicolor object uint32_t value. please let me know if 1 aware of this? here code: const cgfloat *components = cgcolorgetcomponents([uicolor redcolor].cgcolor); cgfloat r = components[0]; cgfloat g = components[1]; cgfloat b = components[2]; const uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b); how pass 0xffffffff value in uint32_t? const uint32_t white = 0xffffffff, black = 0xff000000, transp = 0x00ffffff; if want convert hex-string integer value, should try this: unsigned int outval; nsscanner* scanner = [nsscanner scannerwithstring:@"0xff000000"]; [scanner scanhexint:&outval];

php - Can't get the double quotes right -

i have following works fine: header("location: /index.php", true, 300); but want filename dynamic, i.e. header("location: /" . $_session['initiating_url']); this works fine, however, still need , true, 300 @ end, can't seem figure out: header("location: /" . $_session['initiating_url'] . "\"", true, 300); header("location: /" . $_session['initiating_url'] . """, true, 300); but don't seem work correctly. bottom 1 gives me syntax error in editor. , second last example doesn't redirect @ all. you don't need add explicit closing " when concatenating strings : header("location: /" . $_session['initiating_url'], true, 300); for clarity: $path = 'home'; echo "location: /" . $path; // location: /home echo "location: /home"; // location: /home echo "location: /" . $path...

java - Invoking asynchronous method from servlet -

context: i have done alot of reading, found this semi-relevant. i have servlet calls method java class, while passing session-sensitive data. running on tomcat server. it looks this: @webservlet(urlpatterns = {"/myservlet", "/"}) public class myservlet extends httpservlet { protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception{ httpsession session = request.getsession(true); //start session string userid = session.getid(); //get unique user id myclass cls = new myclass(); //initialize class string shortid = cls.newid(userid); //call method class system.out.println("your short id is: " + shortid); //print result } } and class i'm calling looks this: public class myclass { public string newid(string userid){ string shortid; ... //method shortening userid return(s...

java - Create an individual integer for each ArrayList element? -

i'm developing kind of "score tracker" app game. user adds amount of players (the number unlimited) , player names added arraylist. on next activity, user must choose playername spinner , enter amount of "points" or let's "score" player. this current code this: public void submitscore(view v){ linearlayout llayout = (linearlayout) findviewbyid (r.id.linearlayout); final int position = playerlist.getselecteditemposition(); edittext input = (edittext) findviewbyid(r.id.edittext1); final linearlayout.layoutparams lparams = new linearlayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); final textview newtextview = new textview(this); string enteredtext = input.gettext().tostring(); if (enteredtext.matches("")) { emptytexterror(); } else { //new textview newtextview.setlayoutparams(lparams); newtextview.settext(players.get(position) + ...

c# - How to test approximate values in Fitnesse -

Image
i'm using fitnesse fitsharp run integration tests. i'm using rowfixture test table of numerical results , need able test approximate value 3 decimal places. how can achieve this? read somewhere using ~= not appear work on tables yes, slim test system in fitnesse offers approximately equals operator ( ~= ) point out agree not available in fitsharp. 2 possibilities consider: first (though have not had occasion use them) fitsharp offers variety of cell operators --see, in particular, compare foating point on list. second, 1 technique have used this: that is, math fixture lets specify precision (defaulting 2 places if unspecified). code-behind quite simple: private double docalculation() { . . . return math.round(_result, precision); }

Losing order of sorted queryset With Django-Endless-Pagination -

i've got few sorted querysets im passing template. multiple paginations shown per page. problem after first series of paginated items, subsequent ones lose sort. here's code: views.py def entry_index(request, parent_cat, child_cat, template='entry_index.html', page_template='entry_index_page.html'): context = { 'items_by_percentage_saved': item.objects.filter(category=category).order_by('-percentage_saved'), } if request.is_ajax(): template = page_template return render_to_response(template, context, context_instance=requestcontext(request)) by_percentage_saved.html {% load endless %} {% paginate items_by_percentage_saved %} {% item in items_by_percentage_saved %} <div class="large-4 small-6 columns"> <a class="th" href=""...

c# - Nullable object must have a value, Linq to SQL, MVC issues -

i've taken on project developer has left company , not overly familiar mvc. when running program error "nullable object must have value". one of cells in table populated following: <td>@sra_acquire.models.auth.users.getusernamebyid((int)issue.userid)</td> which populated following: public static string getusernamebyid(int userid) { return getuserbyid(userid).name; } internal static userprofile getuserbyid(int userid) { var db = new userscontext(); return db.userprofiles.where(c => c.userid == userid).single(); } when stepping through code userid correct, errors stating c.userid not exist in current context however in accountmodels.cs shows public class userscontext : dbcontext { public userscontext() : base("authcontext") { } public dbset<userprofile> userprofiles { get; set; } public dbset<usersinroles> usersinroles { get; set; } public dbset<roles> roles { get; ...

How to draw a region of a texture/bitmap in C++? -

i'm making minimap/radar game (gta iv), , i'm wondering how hide or remove parts/pixels of map texture outside of square map area. function run every frame, i'm looking efficient way this, preferably lightweight library or directx. what i've thought of far "manually" checking coordinates of each pixel, or each line of pixels in texture , see if it's outside radar area, imagine take quite lot of resources 4 512*512 textures every frame. how can in efficient way? thanks, , sorry if has been posted million times, haven't found isn't standard image editing related. if understand properly, want remove pixels map based on current location , actual map. why not use transparency? basically, fill pixel data on cpu (in game code) , update texture on video card. better if map doesn't change, can in big texture first , load on gpu (or manually) , change texture coordinates display portion interest you.

Groovy way to find valid end of a range -

imagine have big list want split in smaller chunks processing: def chunksize = 10 def listsize = abiglist.size() for(def = 0; < listsize; += chunksize) { def startofrange = def endofrange = (listsize - 1) < (i + increment - 1) ? (listsize - 1) : (i + increment - 1) // there has got better way! def chunk = abiglist[startofrange..endofrange] // chunk } the code getting endofrange variable ugly , non-groovy, required in order prevent index out of bounds exception. there better way this? can't use collate ? def chunks = abiglist.collate( chunksize ) if not, fixing code gives like: def chunksize = 10 def listsize = abiglist.size() for( = 0; < listsize; += chunksize ) { def endofrange = + chunksize - 1 >= abiglist.size() ? -1 : + chunksize - 1 def chunk = abiglist[ i..endofrange ] // chunk } but collate way go long abiglist isn't enormous ;-)

html - Adjusting the width of the Legend field for IE8 and lower -

i created html 5 form legends have background colors. aim, accomplished in firefox, google chrome, ie 9>, have text background color extend width of page. problem in ie8 , lower versions extends end of words. have far css wise regular page: .formarea legend { font-weight: bold; font-size: 1.2em; line-height: 2em; display: block; color: white; background-color: #a70c1e; width: 95%; padding-left: 7px; } may have insight on how make necessary adjustments ie8 i used padding: .formarea legend { font-weight: bold; font-size: 1.2em; line-height: 2em; color: white; background-color: #a70c1e; width: 80px !important; padding-right: 650px !important; display: block; } .formarea legend span { width:100%; }

php - Passing a reference using call_user_func_array with variable arguments -

i have following code: <?php class testme { public static function foo(&$ref) { $ref = 1; } } call_user_func_array(array('testme', 'foo'), array(&$test)); var_dump($test); and correctly displays "1". want same, using "invoker" method, following: <?php class testme { public static function foo(&$ref) { $ref = 1; } } class invoker { public static function invoke($func_name) { $args = func_get_args(); call_user_func_array(array('testme', $func_name), array_slice($args,1)); } } $test = 2; invoker::invoke('foo', $test); var_dump($test); this throws strict standards error (php 5.5) , displays "2" the question is, there way pass arguments reference testme::foo , when using func_get_args() ? (workarounds welcome) there no way reference out of func_get_args() because returns array copy of values passed in. see php reference . additi...

php - Joomla install stuck on tables creation -

if have problem (infinite loop) when installing joomla using web installer, face issue while creating tables or copying data, post can (i hope). as lodder said, in fact it's not real infinite loop timeout of server (when executing code). edit php.ini , put : max_execution_time = 3000 memory_limit = 128m and restart service!

d3.js - How to add links dynamically to a D3 Tree -

Image
i'm trying add links dynamically tree in order create new relationships. intent develop flow diagram, more tree. the code seems work fine @ first then, after showing bootstrap popover on 1 of nodes, new links disappear. i'm thinking tree being "re-painted" , makeshift links don't included. here how looks "by default": here how looks new links: after looping ids of nodes should connected, reference nodes , concat pairs output of tree.links . here code //create links var newlinkpairs = getnodereferencesforlinks(nodes, newlinksids); //add new pair links based on removed duplicates var linkpairs = tree.links(nodes).concat(newlinkpairs); var linkenter = g.selectall(".node-link") .data(linkpairs) .enter(); linkenter .insert("path", "g") .attr("class", "node-link") .attr("d", (function(d, i){return createconnector(nodeheight, nodewidth)})()) .attr("marker-end", "url(#sour...