Posts

Showing posts from September, 2011

Facebook auth with PHP SDK -

i'm trying authorize php sdk. $facebook = new facebook(array( 'appid' => 'xxx', 'secret' => 'xxx', )); $user = $facebook->getuser(); if($user) { $user_profile = $facebook->api('/me'); } <a href="#" onclick='mywin=window.open("<?php echo $facebook->getloginurl(array('redirect_uri'=>home_url().'/auth.php')); ?>", "", "width=500,height=400");'">facebook</a> this piece of code should authorize me , profile. redirect_url script looks this echo "<html><head><meta charset='utf-8'/></head><body><script> var form=window.opener.document.createelement(\"form\"); form.id = \"red\" form.action=''; form.method=\"post\"; form.target=\"_top\"; form.style.display=\

How to pass {% captured %} variable from a view to the layout in Jekyll/Liquid? -

i trying rebuild blog in jekyll , have stubled upon simple task. provided have following set of templates: default.html: {{ head }} {{ content }} frontpage.html: --- layout: default --- {% capture head %} frontpage {% end %} {{ content }} index.html: --- layout: frontpage --- other stuff i expecting {% capture head %} pass variable layout. seems variables front matter being passed page.variable_name . is there way pass capture -d var layout in jekyll? guess make 2 different layouts frontpage , normal_page replace whole {{head}}{{content}} block in layout. that's twice html, i'd rather solve capture if possible. you can't capture, can using include. every level of page hierarchy can override head key point different include file required default.html {% include {{ page.head }} %} {{ content }} frontpage.html --- layout: default head: header1.html --- {{ content }} _includes/header1.html (frontpage header content)

c++ - How to completely manage heap memory allocation of std containers like map? -

i'm interested in using multiple std map<int,int> , want of them allocate elements common memory pool. i've read far, can use custom allocators such boost pool_alloc achieve this. my question is, despite using boost pool_alloc manage allocation of elements themselves, std map still use little bits of heap memory form of container overhead not managed boost pool_alloc? i'm thinking along lines of pointer elements regards use std map itself? the short version a map type such as: typedef std::map< int, int, less<int>, boost::pool_allocator<pair<const int, int> > > amaptype; will allocation needs grows using boost::pool_allocators. of initial structure created on stack. how , exact structure though implementation dependent. allocator rebind the above possible through use of allocator::rebind all std::allocator conformant allocators (such boost::pool_allocator) provide rebind template struct in for

ios - Titanium Studio - Adding SDK's later(Android first project) -

i'm doing minor crossplatform application, , have chosen titanium studio after researching whats out there. can tell me if it's possible first develop prototype android, , when content go on ios, or if both strictly have enable go? for ios specific parts, i'm forced work on remote machine, why prefer have finished possible before that. hope makes sense, , can me out! thank all. yes possible make app android , later make required changes ios.

java - Fire - Back button event (kinda crazy scenario) -

my scenario follows. this application , want add shortcut swipepad (shortcut application). when app launched swipepad, key pressed on application existed before . simulating key on previous application. (if application has own key behavior, want same key behavior executed). for example: launch gmail. use swipe pad , launch facebook. want go facebook. use swipe pad hit key. results in, 1. swipe pad closing (this happen). 2. facebook executing 3. gmail on display why go through trouble? use note 2 spen. nagging scenario when, using spen, , go back, have switch pen hand , pen. coming dotnet background struggling java , eclipse. little would appreciated. i'll try: i didn't asking. to emulate key, want make own " input method editor ", problem replace current keyboard. (you can emulate key if rooted.) instead, solve problem: i have switch pen hand , pen. you can use spen, hold button on pen, make gesture: "<" , act if pressed

objective c - Getting an object's attribute from an NSDictionary -

i have nsdictionary nsstring of values , of other values own classes. question how access attributes of 1 of classes dictionary. assumption this: dictionary[@"work"].name will work object dictionary , name attribute object yourclass *classvar = [self.yourdictionary objectforkey:@"work"]; classvar.name = @"your name";

ios - extracting street name using reverse geocoding (Google API) -

i'm using google reverse geocoding user's current location. code goes this: nsstring* strcurrentlongitude=[nsstring stringwithformat: @"%f", currentlocation.coordinate.longitude]; // string value nsstring* strcurrentlatitude=[nsstring stringwithformat: @"%f", currentlocation.coordinate.latitude]; [nsurl urlwithstring:[nsstring stringwithformat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%@,%@&sensor=true_or_false",strcurrentlatitude,strcurrentlongitude]]; now how continue here user's current location? of top of head: [nsurlconnection sendasynchronousrequest:[nsurlrequest requestwithurl:yoururl] queue:[nsoperationqueue mainqueue] completion:^(nsurlresponse *r, nsdata *d, nserror *e) { //decode id json = [nsjsonserialization jsonobjectwithdata:d options:0 error:nil]; //process google response, json iirc }];

asp.net mvc - How Do I Set the Name and Value of an Editor Template Specific to the Model Being Edited? -

i'm trying use editor template standardise display of datepicker fields across multiple models in mvc4. for example i'd standard display publishdate property on news model, , eventdate property on event model. i have created datepicker.cshtml template , set uihint "datepicker" each of model properties. far good. but how set name , value of editor template current model? desired result i'd use same editor template create inputs these: <input name="eventdate" value="{currenteventdate}" class="datepicker"..... /> and <input name="publishdate" value="{currentpublishdate}" class="datepicker".... /> use in datepicker.cshtml template, , place under views/shared/editortemplates: @model system.datetime @html.textbox("", model, new { @class = "datepicker" }) and, in main view: @html.editorfor(model => model.eventdate) @html.editorfor(model =>

facebook - making notifaction bar ("ticker") from my android application -

i want make update on notification window on facebook , think called ticker when finish game on application . like : jesus dimri made new record (10201 points) on super trivia !! i dont want make wallpost couse annoying user . my application connected facebook how make happen ?? again...no wallpost . notify on notification bar above chat . candycrush , other applications.

how to evalulate when reading and processing a html/php file -

i trying create template function: function includeandtemplate($file){ $json = '{"first_name" : "first name", "middle_name" : "middle name"}'; $template_vars = json_decode($json); $file = file_get_contents($file); foreach($template_vars $var => $value){ $file = str_replace("{{\$".$var."}}", $value, $file); } return $file; } my html/php: <p>{{$first_name}}, {{$middle_name}}</p> and works fine. now happens if have this: <p>{{$first_name}}, {{$middle_name}}, time <?php echo data("h:i:s"); ?></p> the raw php code outputed client i think looking this: <?php function includeandtemplate($file){ $json = '{"first_name" : "first name", "middle_name" : "middle name"}'; $template_vars = json_decode($json); ob_start(); require $file; $file = ob_get_clean()

highcharts - Is it possible to supply multiple yAxis from with data in one series -

i want supply single series of data multiple y axis rather duplicate data , put y values in 3 separate series. is possible tell each yaxis value pull data object? data: [{ name: 'point1', x: 123, y0: 1, y1: 4, y2: 18 is possible have 'y' in data object array 1 value each y axis? data: [{ name: 'point1', x: 123, y: [1,4,18] no, need use separate series. if want have 1 series in legend, use linkedto option.

haskell - GHC can't handle large lookup tables -

i need use lookup table in 3 dimensions. table has 73x73x73 (389017) double values. module hammer.texture.table3d import qualified data.vector v import qualified data.vector.unboxed u import data.vector.unboxed (vector) table3d :: v.vector (v.vector (vector double)) table3d = v.fromlist [table0, table1, ... table72] table0 = v.fromlist $ map u.fromlist [ [1.973921e+01, 0.000000e+00, ... 0.000000e+00], ..... [1.973921e+01, 0.000000e+00, ... 0.000000e+00]] ..... table72 = v.fromlist $ map u.fromlist [ [1.973921e+01, 0.000000e+00, ... 0.000000e+00], ..... [1.973921e+01, 0.000000e+00, ... 0.000000e+00]] the problem ghc can't handle size of vector double or [double], ghc compilation takes lot of time (~ 2 min) until, finally, memory blows up. seems there memory leak on ghc or bug because works fine large string ([char]). what solutions, if any, available creating "large" lookup tables (double type) using ghc? i can think of

c++ - Administrator rights for Windows application -

i need create , write file under c:\ on windows. obviusly require administrator right. my application consist on: the core (.exe) two .dll now, saw lot of time software (like games) require admin right during installation , after can whatever want; how possible? how via c++ ? if want application run administrator, can specify in application's manifest file. specifically, need add this: <trustinfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedprivileges> <requestedexecutionlevel level="requireadministrator" uiaccess="false"/> </requestedprivileges> </security> </trustinfo> more on application manifest files can found in msdn.

Actionscript 3.0: Help Linking Document Class To And Audio Slider Class -

so i've been going @ actionscript 3 couple weeks i'm still complete newb. difficulty i've had linking classes document class. example, i'll have nice great class things wonderfully (i insert document class of fla , provide functionality need specific function), when have insert regular class...i guess "subclassing" document class, goes hell. i know have change variables , instantiate things work , sort of understand that, gets way on head , feel should simple solution if have full working class. seems there's billion things need switch around. anyways, have specific example i'm hoping explain , walk me through bit. went online , found code slider, spent last few hours editing contain mp3 want, loop it, etc. etc. works great on designated fla...i run document class , pops designed audio slider changes volume, loops , everything. want add slider simple game i've been working on, have no idea start or do. i'll keep simple though. say hav

networking - Unity Network.Connect() returns no error -

i'm trying create online game, works in computer, , in 2 different computers in house. not connect room of other players. i'm testing trying connect closed room, naturally not connect, still networkconnectionerror returns "noerror" , , onfailedtoconnect() function never called. my code this: if(gui.button(rect,"connect")) { var error = network.connect(element); printconsoleentry("connection attempt : " + error); } which prints "connection attempt : noerror" . but @ point, see in "real console", in unity editor window, the connection request 192.168.x.x:26500 failed. sure server can connected to? but not show press "connect" button. waits little. , shows once, out of 100 presses, there kind of yielding? i tried yield error in coroutine : var error = network.connect(element); yield error; printconsoleentry("bağlantı denemesi : "+error); it returns noerror. so error? how c

SQL Server 2005 Down or Unavailable History -

i have sql server 2005 instance has nightly run ssis job. in morning see report generated sql job server unavailable. error: error code: 0x80004005. ole db record available. source: "microsoft sql server native client 10.0" hresult: 0x80004005 description: "login timeout expired". ole db record available. source: "microsoft sql server native client 10.0" hresult: 0x80004005 description: "a network-related or instance-specific error has occurred while establishing connection sql server. server not found or not accessible. check if instance name correct , if sql server configured allow remote connections. when connect instance in morning, can see working fine now. is there someway find out 2 things. when down , again what's reason of down. thanks

javascript - scrolltop() doesn't work in IE9 at all -

http://jsfiddle.net/qf47a/7/ function onscroll(){ document.getelementbyid("fly").style.top=""+ $(document).scrolltop() * 5 +"px"; } check out... sigh not working 1 bit in ie9... haven't tested in ie10 yet. yes, works in chrome, firefox, , every browser under sun except damned ie. listen window 's scroll event instead: $(window).on('scroll', function() { document.getelementbyid("fly").style.top = $(document).scrolltop() * 5 +"px"; }); demo tested in latest chrome, firefox, opera 15 , ie8. seems work fine in browser, main issue ie not parse body 's onscroll attribute window.onscroll property other browsers do. live test case . test case source: <body onscroll="42;"> document.body.innerhtml = 'does ' + (window.onscroll ? '' : '<b>not</b> ') + 'parse body onscroll attribute window.onscroll'; so assigning event

c - Why does this assignment break my program? -

i learning c , i'm not sure how phrase this, why uncommenting line 11 in following code break program? #include <stdio.h> int main(int argc, char *argv[]) { printf("argc: %d\n", argc); char *states[] = {}; int = 0; while(i < argc) { printf("arg %d: %s\n", i, argv[i]); //states[i] = "test"; i++; } return 0; } when uncomment line , run program this: greggery@lubu:~/code$ ./myprog aaa bbb ccc argc: 4 arg 0: ./lc arg 1: aaa why states[i] = "test"; breaking while loop? when comment out see arguments printed. it breaks because array states empty. make size of argc (that's allowed in c99) fix problem: char *states[argc]; the reason follows: char *states[] = {}; makes array of 0 elements, dereference states[i] undefined behavior.

java - JTextPane not updating after values changed -

code underneath. i'm trying have display going on in jpanel of jtextpane. have button edits value of string that's supposed displayed in jtextpane. can't figure out how update jtextpane however. i've tried revalidate(), validate(), repaint(), none of seemed work. the code complete, should able run. import java.awt.canvas; public class windowbuild extends jframe { /** * */ private static final long serialversionuid = 1l; private jpanel contentpane; private int health = 20; private int energy = 4; /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { windowbuild frame = new windowbuild(); frame.setvisible(true); } }); } private class buttonhandler implements actionlistener { public void actionperformed(actionevent e) { string = e.getactioncommand(); if (which.equals("claw")){ energy = ener

rest - Google Fusion Table API Authentication Issue -

i trying create simple database google fusion table, , make api calls browser update / fetch data. (the table private, set exportable.) when make call browser, following tutorial @ https://developers.google.com/fusiontables/docs/v1/getting_started#browserurl using syntax: https://www.googleapis.com/fusiontables/v1/query?sql=select * {tableid}?key={apikey} and replacing {tableid} , {apikey} values directly browser , following 403 response: { "error": { "errors": [ { "domain": "usagelimits", "reason": "dailylimitexceededunreg", "message": "daily limit unauthenticated use exceeded. continued use requires signup.", "extendedhelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "daily limit unauthenticated use exceeded. continued use requires signup." } } i've quadruple-checked api key , synt

android - ListView returning null using Fragment -

when try retrieve listview coponent in xml layout, nullpointerexception launched. listview lv = (listview) view.findviewbyid(r.id.lvalerts); i'm using fragments, welcome. 1) layout file (tab_frag_alerts.xml) <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <spinner android:id="@+id/spinneralertcategory" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <listview android:id="@+id/lvalerts" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout> 2) layout file (alert_row.xml) <?xml version="1.0" encoding="utf-8

java - static runnable in Activity -

i modifying following code in activity: new handler().postdelayed(new runnable() { public void run() { txtstatus.settext("hello"); } }, 1000); to: static runnable myrunnable = new runnable() { public void run() { txtstatus.settext("hello"); }; new handler().postdelayed(myrunnable, 1000); which doesn't work, since we're referencing non static variable. this doesn't work either: public void settext() { txtstatus.settext("hello"); } static runnable myrunnable = new runnable() { public void run() { settext(); // doesn't work myactivity.this.settext(); // still doesn't work }; new handler().postdelayed(myrunnable, 1000); so how initial example rewritten use static class instead of anonymous inner class (to avoid potential of memory leak)? try this: private runnable myrunnable = new runnable() { public void run() { txtstatus.settext("hello"); } }; // somewhere in cod

php - File generates line break only when included -

this file below working alone menu.php , when include in file using <?php include("menu.php") ?> it generates line break. why don't understand, tried several times, not solved. so, please me guys , girls. <style> /* menu style starts*/ nav ul li:hover > ul { display: block; } nav ul { background: maroon; background: linear-gradient(top, maroon 0%, #800000 100%); background: -moz-linear-gradient(top, maroon 0%, #800000 100%); background: -webkit-linear-gradient(top, maroon 0%,#800000 100%); list-style: none; display: inline-table; position: relative; padding: 0 15px; box-shadow: 0px 0px 20px #888888; } nav ul:after { content: ""; clear: both; display: block; } nav ul li { float: left; } nav ul li:hover { background: #4b545f; background: linear-gradient(top, black 0%, #5f6975 40%); background: -moz-linear-gradient(top, black 0%, #5f6975 40%); background: -webkit-line

php - laravel route on logged in not triggering -

i'm trying route index page different location if logged in though authentication system works, it's not redirecting expected i.e. getlogged, instead redirects getindex whether logged in or not. route::filter('auth', function() { if (!sentry::check()) return redirect::to('/'); }); route::group(array('before' => 'auth'), function() { route::get('/', array('uses' => 'mycontroller@getlogged')); }); route::get('/', array('before' => 'detectlang', 'uses' => 'mycontroller@getindex')); i tested make sure auth works changing route::group(array('before' => 'auth'), function() { route::get('/', array('uses' => 'mycontroller@getlogged')); }); to route::group(array('before' => 'auth'), function() { route::get('/dash', array('uses' => 'mycontroller@getlogged')); });

odd thing with php processing using POST -

i have project works on test server stopped working when moved onto another. think it's php ma here ask opinion. main page html login has form post calls php script file, this: <form method="post" action="prologin.php"> name: <input type="text" name="nam"><br> password: <input type="password" name="pas"><br> <input type="submit" value="login" data-inline="true" data-icon="gear"> </form> an prologin.php file looks this: <?php session_start(); include 'mycon.php'; $nume1=mysql_real_escape_string( $_request['nam'] ); $pass1=mysql_real_escape_string( $_request['pas'] ); $s = "select * uzers uzname = '$nume1' , pass = md5('$pass1')"; var_dump($s); ... followed other validations , stuff. when run html file , click submit button (login), receive "undefined" page

java printf with repeating periods -

we can use space pad output fit "fixed width columns" in java using printf. example: system.out.printf("%-30s - %s%n", "hello hello", "goodbye goodbye"); system.out.printf("%-30s - %s%n", "lots of cats", "large amounts of dogs"); system.out.printf("%-30s - %s%n", "a crowd of teachers", "no students"); system.out.printf("%-30s - %s%n", "three desks", "twenty boxes"); gives output hello hello - goodbye goodbye lots of cats - large amounts of dogs crowd of teachers - no students 3 desks - twenty boxes what achieve this: hello hello. . . . . . . . . . . goodbye goodbye lots of cats . . . . . . . . . . large amounts of dogs crowd of teachers. . . . . . . no students 3 desks. . . . . . . . . . . twenty boxes or hello hello..................... goodbye goodbye lots of cats.

celery - celeryev Queue in RabbitMQ Becomes Very Large -

Image
i using celery on rabbitmq. have been sending thousands of messages queue , being processed , working fine. however, number of messages in several rabbitmq queues growing quite large (hundreds of thousands of items in queue). queues named celeryev.[...] (see screenshot below). appropriate behavior? purpose of these queues , shouldn't regularly purged? there way purge them more regularly, think taking quite bit of disk space. you can use celery_event_queue_ttl celery option (only working amqp), set message expiry time, after deleted queue.

objective c - IOS - Using drawRect method to set background color on view -

im quite new ios; , made gradient etc via drawrect method, now, if want implement it, subclass view. thinking, there way can call method drawrect , make set background view, subclass of viewcontroller ? layout this: backgroundcolor.h #import <uikit/uikit.h> @interface backgroundcolor : uiview @end backgroundcolor.m #import "backgroundcolor" @implementation backgroundcolor___fuschia - (void)drawrect:(cgrect)rect { ... } @end viewcontrollernav.h #import <uikit/uikit.h> @interface viewcontrollernav : uiviewcontroller @end viewcontrollernav.m @interface viewcontrollernav () @end @implementation viewcontrollernav - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } @end i assume have import backgroundcolor , init method or ? (ps: drawrect method uses cgrect fram

linux - Arm platform, Why the thread was blocked in popen function? -

in program, there thread calls popen function execute ping command. after letting run few days, thread block in popen . found information popen , can not result. below output of run. normal: test popen before test fgets before test fgets after block: test popen before code: int ping_fun(char *p_ip_addr) { file *ptr = null; char buff[512]; char ps[128]; int ret_value = 0; memset(buff, 0, sizeof(buff)); memset(ps, 0, sizeof(ps)); sprintf(ps,"ping -c 5 %s 2>&1 | grep -c '64 bytes from'", p_ip_addr); printf("test popen before\n"); ptr = popen(ps, "r"); if (null != ptr) { printf("test fgets before\n"); fgets(buff, 512, ptr); printf("test fgets after\n"); ret_value = atoi(buff); if (ret_value > 0) //ping success { //do ..... } pclose(ptr); } else {

postgresql - postgres copy tables from another database using pg_dump? -

i copy 2 tables database database b, in postgres how can using pg_dump without losing previous tables , data in database b ? i read answers in stack overflow suggesting using pg_dump in documentation page read? the idea behind dump method generate text file sql commands that, when fed server, recreate database in same state @ time of dump doesn't mean delete previous data in database b? if tell me step step solution move 2 tables in database database b without losing previous data in database b, helpful. i found answer question : sudo -u owner_user pg_dump -t users databasename1 | sudo -u owner_user psql databasename2

basic spring 3 hibernate 4 mvc web application with many exceptions -

status: solved . nevermind. found problem. entitymanager should not have been autowired in dao. effort. i have simple newly created web project spring 3.2.3 , hibernate 4.x.x. maven in netbeans 7.3. getting following exception stated @ end following code. does 1 had similar problem or has idea why happening. controller /* * change template, choose tools | templates * , open template in editor. */ package web.controller; import org.springframework.stereotype.controller; import org.springframework.ui.modelmap; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import web.entity.users; import web.service.userservice; /** * * @author syncsys */ @controller public class usercontroller { @autowired private userservice userservice; // @requestmapping(value = "/create", method = requestmethod.get ) @requestmapping(value = "/create" ) public string creatuser(mode

sql - Oracle checking for existence of rows in a large table -

trying find whether id2 used in table x. easiest way use 'count': select count(*) x id1 = :1 , id2 = :2 ; if x large table containing on 90,00,000 data , above query has severe performance impact. there alternative better performance? note: both column have indexing in table x. if use: select count(*) x id1 = :1 , id2 = :2 , rownum = 1; then 0 if no rows not found, , 1 if single row found. the query stop executing when finds first row, , not have deal no_data_found exceptions if no row found. you composite index on both columns this, combining index may not efficient. if 1 of predicates selective index combine can efficiently skipped , table accessed check other column's value.

ios - How to draw a triangle over a UIImage in a UIImageView -

i'm having trouble drawing atop image in uiimageview, i've looked @ "draw image on uiimage" help. here's scenario: have uipopovercontroller uitableview in , want display triangle pointing when user @ bottom of scrollable table view. my code: - (uiimage *) drawtriangleinviewforsize:(cgsize)sizeofview imagetodrawon:(uiimage *)underimage isattop:(bool)top{ cgpoint firstpoint; cgpoint secondpoint; cgpoint thirdpoint; if(!top){ //i want draw equilateral triangle (side length 10) in center of image in //the imageview, these coordinates using. firstpoint = cgpointmake(underimage.size.width * 0.5 + 5, underimage.size.height * 0.5 - 5); secondpoint = cgpointmake((firstpoint.x - 10), firstpoint.y); thirdpoint = cgpointmake(underimage.size.width * 0.5, underimage.size.width * 0.5 + 5); } */ **disregard** else{ firstpoint = cgpointmake(sizeofview.width * 0.5 + 5,

parsing - How do I represent morning and midnight timings in ruby? -

i need store , retrieve restaurant timings in simple methods morning , midnight . doing is: def morning time.new("6:30 am") end def midnight time.new("12:00 am") end i can compare timings seems wrong way , don't know how read time values method like: def open?(time) time >= morning && time <= midnight end what right way this? using chronic gem able this: def opens_at morning end def closes_at midnight end def open?(time) chronic.parse(time) >= morning && chronic.parse(time) < midnight end private def morning chronic.parse("6:30 am") end def midnight chronic.parse("midnight") end this works comparisons

ios - How can I call a category method from my UIViewcontroller class? -

Image
error hi have category base64 encoding, need call thing main class method. following category code #import <foundation/foundation.h> @interface nsstring (addition) - (nsstring *) base64stringfromdata:(nsdata *)data length:(int)length; @end in .m file #import "nsstring+addition.h" static char base64encodingtable[64] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', '

javascript - How to maintain reference to an instance, when using the setTimeout callback? -

how maintain reference instance, when using settimeout callback? e.g: in viewmodel (using knockout) var myvm = function () { this.myfunc = function () { settimeout("this.mycallback()", 2000); }; this.mycallback = function() { this.myobservable(true); } } this fails. you can add private field : var myvm = function () { var self = this; this.myfunc = function () { settimeout(self.mycallback, 2000); }; this.mycallback = function() { self.myobservable(true); } } var vm = new myvm(); have @ rp niemeyer's answer . i hope helps.

ext.net - ImageCommandColumn Click event not fired when i palced it in Asp.net master page -

hi, working ext.net gridpanel, has imagecommandcolumn 1 column, when click on particular image button, fired , call 1 directmethod in common .aspx page. when place same code in contenpage loaded in asp.net master page click event imagecommandcolumn not firing in gridpanel. what should have do, work masterpage , content page scenario gridpanel. thank you.

sql server - How to retrieve next 5 hours data from the table in sql -

select * tablename text_date < getdate() , text_date < dateadd(minute, 300, getdate()) is there wrong in this? try 1 - declare @data datetime select @data = getdate() select * tablename text_date between @data , dateadd(minute, 300, @data)

visual studio - Re-creating a C# Solution from a .exe -

a few years ago had small program created generating reports (written in c#, visual studio 2008) - windows forms exe couple of dll files. i need make change hard-coded value of vat cannot find source code file anywhere. there way re-load exe + dlls visual studio project? i have experience .net reflector, answer building new solution? thanks help. try google .net decompiler , should give searching for.

vim - What is the use case of marks? -

both sublime text 2 , vim have feature called marks . however, i've not been able find use case it. feels can can done other things, better. so question is: use case of marks? if mean marking text lines in vim , use quite bit. for example, if want go @ else, can use ma mark current line a , go check out else in file, return simple 'a . similarly, if want delete unknown number of lines between current position , somewhere else, use ma , go "somewhere else, , use d'a . there many more things can them (such changing text between current position , mark), 2 common ones use (and use them lot).

swing - Java return from a ShowOptionDialog from an inner JPanel -

i used joptionpane.showoptiondialog(null, new mypanel(), "import", joptionpane.default_option, joptionpane.plain_message, null, new object[]{}, null); because don't want default buttons provided optiondialog , created buttons inside mypanel extends jpanel problem how can close optiondialog inside mypanel fired actionevent ? don't care return value, long dialog disappears. , realize might not best design i've been working on lot of times i'd prefer fix involves little change in structure possible. thanks! convert joptionpane jdialog , using joptionpane.createdialog(string title) : joptionpane optionpane = new joptionpane(getpanel(), joptionpane.plain_message, joptionpane.default_option, null, new object[]{}, null); dialog = optionpane.createdialog("import"); dialog.setvisible(true); now

java - converter class test driven -

i have class, should convert data 1 format (database librarytype). looks like: public librarytype converttolibrary(database db, parameters params) { preconditions.checknotnull(db," missing database conversion"); preconditions.checknotnull(params, "missing parameters conversion"); librarytype lib = basicfactory.createlibrarytype(); lib.setname(db.getname()); componenttype type = convertstructure(db.getstructure(),params); if (type != componenttype.empty) { lib.addcomponent(type); } return lib; } componenttype convertstructure(structure s, parameters params) { if (!params.isstructureallowed(s)) return componenttype.empty; componenttype comp = basicfactory.createcomponenttype(); comp.setname(s.getname()); return comp; } i have 2 problems concept. the method convertstructure should private, because not neccessary call outside, testing purposes defined package-wide, not nice the parameters (par

php: queue / dont delay the user -

i have piece of code takes while run , low priority. wondering if in php can like public function put () { $comment = array('title' => 'my title', 'description' => 'my description'); sendtoqueue($this->internalcall('controller' => 'comment', 'data' => $comment); $object = $this->get('id' => $this->id); return $object; } where function inside sendtoqueue wouldnt delay $object being fetching , returned , run in bg. possible? know can throw python ideally i'd run within current scope. if need run in current scope fork ( pcntl_fork() ) process , let child handle whilst parent carries on otherwise run script periodically empties queue of tasks.

.htaccess - Reference capture groups of multiple RewriteCond in RewriteRule -

when have multiple rewritecond chained together, capture groups of last rewritecond can referenced %0 - %9 . in following problem parameters in query string of url can in order. parse them fancy url need match each parameter in query string individually: rewritecond %{query_string} param1=([^&]+) rewritecond %{query_string} param2=([^&]+) rewritecond %{query_string} param3=([^&]+) rewriterule ^foo$ bar/%1/%2/%3/ [r] like pointed out... doesn't work. fix this, reference capture group of previous rewritecond in next rewritecond , 'propagate' each parameter actual rewriterule: rewritecond %{query_string} param1=([^&]+) rewritecond %1&%{query_string} ^([^&]*)&.*param2=([^&]+) rewritecond %1&%2&%{query_string} ^([^&]*)&([^&]*)&.*param3=([^&]+) rewriterule ^foo$ bar/%1/%2/%3/ [r] this should work, each additional parameter get's messier. other solution possibly parsing 1 parameter , redirecting client a