Posts

Showing posts from May, 2013

android - Sort alphabetically from A to Z table (database) -

i'm working on update of android application. have hundred recipes entered in data table. want sort them alphabetically (asc). tried code applied in case on sqllitemanager on firefox , executed manipulation , indeed, classified them, not on eclipse, set: select * tbl_recipes<br /> order recipe_name asc; please, can put code in android project?

Batch File - Delete a File only if another file exists -

i wish create batch file can following: if "file 1abc (x).bin" exists delete "file 1abc (y).bin", if not, keep "file 1abc (y).bin" , move on. basically there multiple versions of file 1 kind (marked single variable in filename stays same) superior other. if superior version not exist, wish inferior version remain. is possible? you use if statement ( http://www.computerhope.com/if.htm ): if exist file1.ext del file2.ext update - address specific problem mentioned in question: set filenames="file 1abc (*).bin" set lastversion="" :: find last version %%f in (%filenames%) ( if "%%f" gtr %lastversion% set lastversion="%%f" ) :: delete old versions %%f in (%filenames%) ( if "%%f" lss %lastversion% del "%%f" ) there 1 catch: if version (x or y in example) number, should specified fixed number of digits (e.g. (009), (010), ...), because (9) considered greater (10). ...

html - Image Reading from base64 data in javascript produces image of different size -

Image
i trying screenshot of page using chrome extension , trying crop image. upon taking screenshot, base64 dataurl of image. when try render image using dataurl, image renders larger(appears zoomed in) original image. when manually give <img> object original size renders fine. when draw image canvas, canvas takes enlarged size. i have been banging head against wall solution problem no avail. appreciated. //here js code: var image = document.getelementbyid("image"); var canvas = document.getelementbyid('mycanvas'); var context = canvas.getcontext('2d'); image.onload = function() { var sourcex = 0; var sourcey = 0; var sourcewidth = 150; var sourceheight = 80; var destwidth = sourcewidth; var destheight = sourceheight; var destx = 0; var desty = 0; context.drawimage(image, sourcex, sourcey, sourcewidth, sourceheight, destx, desty, destwidth, destheight); }; and here html code, removing dataurl takes space, , p...

nested - Child URL Query params shown with ; instead of & -

i creating nested route , when trying access link params , query child routes shown http://localhost:3000/test/test/testingid;param1=value1 instead of http://localhost:3000/test/test/testingid?param1=value1 here parent route definitions: @routeconfig([ {path: '/', component: rootcomponent, name: 'rootcmp' }, {path: '/test/...', component: nestedcomponent, name: 'nestcmp', data: {isadmin: true} } ]) @component({ selector: 'main-app', template:` <h1>using router , router config</h1> <a [routerlink]="['rootcmp']">home</a> | <a [routerlink]="['nestcmp']">nested route test</a> <router-outlet></router-outlet> `, directives: [router_directives, routerlink] }) my child route definitions this: @routeconfig([ {path: '/', component: seccomponent, name: 'nestcmp', useasdefault:true }, {path: '/test/:id...

mapkit - Creating a dynamic MKAnnotationView in Swift -

currently, know how create mkannotationview static pin, image that's added. does know, or have resources, on how create pin change colors or have number displayed inside of change depending on information business? for instance, have pin red when business closed, , green when business open. maybe dollar signs inside of pin tell user how expensive is. edit i have created class called custompin adopts mkannotation protocol. additionally, i'm not looking have custom mkannotationview image can change. mean i'll have add multiple images mkannotationview in array , have change image everytime details business change? thank in advance! you can create custom mkannotationview inheritance. can use class create annotation view delegate method. here 1 example. class kdannotationview: mkannotationview { let titlelabel = uilabel() convenience init(annotation: mkannotation?) { self.init(annotation: annotation, reuseidentifier: "indet...

How can I check if a view is really visible on screen in Android? -

many examples scrollview, don't have idea relativelayout in relativelayout, views cover view. can check in xml, how can check java code? use isshown(), willnotdraw(), haswindowfocus(), getlocalvisiblerect(), not working. case1: container layout on screen <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <!--container layout on screen--> <fragment android:id="@+id/map_fragment" android:layout_width="match_parent" android:layout_height="match_parent" /> <linearlayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <imageview android:id="@+id/icon" android:layout_width="50dp" andro...

perl - the server is overloaded or there was an error in a CGI script -

when run folder,this error occurs.i want run localhost/perl/folder name/eample.pl.how solve it?.sorry easy question.please me. it means server timing out reason. :) answer here, need more specific , limit question shot bit of code, in doubt about. check server's log file more information. path may wrong or pathname misspelled. luck!

javascript - Using apply() in IIFE -

i'm trying use apply() within iife. error 'intermediate value not function' going wrong ? var person = { getfullname : function(firstname, lastname) { return firstname + ' ' + lastname; } } /* iife - using apply */ (function(firstname, lastname) { getname = function(){ console.log("from iife.."); console.log(this.getfullname(firstname, lastname)); } getname(); }).apply(person, ['john', 'doe']); plnnkr : http://plnkr.co/edit/77db8mu4i9rxgqt26pap?p=preview the problem ; , in code person object syntax not terminated, , iife considered continuation of that. read: automatic semicolon insertion if @ external libraries, iife statement starts ; , used escape scenario. also note that, inside getname function this not refer person object, need either use closure variable or pass value this manually. var person = { getfullname: function(firstname, lastname) { return firstname + ...

amazon web services - How to create cloudwatch event using cloudformation template? -

i using cloudwatch scheduled event trigger lambda function after specific time interval. use cloud-formation template add rule in cloudwatch. have gone through cloudformation templates documentation not able find out way configure events using cloud formation template. can please suggest how implement using cloud formation template. i using below template. { "awstemplateformatversion": "2010-09-09", "description": "provision environment specific", "resources": { "lambdascheduler": { "type": "aws::cloudwatch::event", "properties": { "detail-type": "scheduled event", "source": "aws.events", "name": "test_event_10_mins_rule", "schedule-expression": "rate(5 minutes)" } } } } i getting a client error (validationerror) occurred when calling validatet...

android - Odd behavior in adding items to listview -

i have custom photo gallery , need selected images , display filenames in listview this custom gallery: import android.app.activity; import android.content.context; import android.content.intent; import android.database.cursor; import android.graphics.bitmap; import android.os.asynctask; import android.os.bundle; import android.provider.mediastore; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.button; import android.widget.checkbox; import android.widget.gridview; import android.widget.imageview; import android.widget.toast; public class customphotogallery extends activity { private gridview grdimages; private button btnselect; private imageadapter imageadapter; private string[] arrpath; private boolean[] thumbnailsselection; private int ids[]; private int count; string filename; /** * overrides methods ...

c++ - Merging two sorted vectors in one sorted vector -

background: general goal take 2 sorted files strings separated white space, , bring them in 1 sorted file. current goal, see if can use merge function or similar function combine 2 sorted vectors. i using http://www.cplusplus.com/reference/algorithm/merge/ , guide use of function merge. however, error "no matching function call 'merge'". i'm not sure if merge function wanting strings, trying use see if does. #include <iostream> #include <fstream> #include <vector> #include <algorithm> // std::merge, std::sort #include <string> using namespace std; ifstream r_data_file(const string oname) { ifstream ist {oname}; if (!ist) { string error = "cannot open " + oname; throw runtime_error(error); } return ist; } void get_words(ifstream& ist, vector<string>& po) { (string p; ist >> p;) { po.push_back(p); } } int main () { vector<string> ...

javascript - how receive json in jquery success method and use that json to build html content -

i working on java spring application requires controller return json. receiving json in jquery success method, want make html out of it. controller returns json below: return "[{\"id\": \"1\", \"name\": \"apples\"}, {\"id\": \"2\", \"name\":\"mangoes\"}]"; jquery used hit controller , receive json in success method: var content; $(document).ready(function(){ $("#submitbutton").click(function(e){ var formdata = getformdata(); if(formdata!=false){ $.ajax({ type: 'post', 'url': 'http://localhost:8080/test_reportingui/fieldmappingnext.htm', data: {jsondata: json.stringify(formdata)}, datatype: 'json', success: function(response){ (var x = 0; x < response.length; x++) { content = response[x].id; ...

javascript - Jquery : Why is the first image repeated twice in lightbox -

i'm new jquery , php. below code, see first image gets repeated twice, while rest of images displayed properly. <div class="image-zoom" rel="lightbox" id="gallery"> <div id="album1" style="margin-right:18px;" rel="lightbox"> <?php if (isset($albums[0])) { $i = 1; foreach ($albums[0]['photos'] $photo) { if ($i == 1) { ?> <a href="<?= $photo ?>" rel="lightbox"> <img src="<?= $photo ?>" width="214" height="160" /> </a> <div class="zoom-magnifier" id="gallery"> <a href="<?= $photo ?>" rel="lightbox"> ...

tabs - How to change PrettyPrint's default indentation? -

i'm using prettyprint , default indent 4 spaces. didn't found answer on google code site. how change 2 spaces? update i have found solution. pre { tab-size: 4; }

reporting services - SSRS hidden rows cause KeepWithGroup to not work -

i have report consists of single table 3 groups. last group has 6 rows in it's footer. each of these rows has keepwithgroup set before , of them can hidden conditionally. when of rows visible, footer rows kept on same page detail possible. however, when 1 of hidden conditions evaluates true row hidden correctly other rows moved next page though fit fine on current page. if @ groups in advanced mode see this (static) (group1) (static) (group2) (static) (static) (group3) (static) (static) (static) -- don't know why here (group4) -- detail (static) (static) (static) (static) (static) (static) (static) all of static rows after detail have keepwithgroup set before, seems ignored when of them hidden. i've tried setting hidden condition on table row , on static row in advanced mode both cause issue. any ideas? thanks, bill i have 2 ideas try: in setting advanced properties of grouping try change 'h...

c++ - Is it possible to have different .DEF files per build configuration? -

i have project compiles dll. using .def file manage exported functions . instance: exports myfoo1 myfoo2 myfoo3 myfoo4 is possible have different .def files in debug , release configurations? have larger set of functions in debug mode in release . for example, have in release mode myfoo1 . currently thought using __declspec instead of .def file, , use macro enable them when macro on. macro in turn, can put pre-processor definitions, dependent on build configuration. is possible accomplish goal without switching .def files __declspec mechanism? you can set different def file every build configuration : project properties -> linker -> input -> module definiton file this sets /def option

c# - Saving plain text to RichText -

i'm little confused following code. i'm taking plain text stored in database , supplying text portion of richtextbox control saving file. the first file blank though contain data. richtextbox test = new richtextbox(); for(int = 0; < dt.rows.count; i++) { test.text = dt.rows[i][1].tostring(); string file_name = path.combine(path, dt.rows[i][0].tostring() + ".rtf"); test.savefile(file_name, richtextboxstreamtype.richtext); test.clear(); } now work around though it's ugly did following , write first entry file correctly bool run_once = true; richtextbox test = new richtextbox(); for(int = 0; < dt.rows.count; i++) { test.text = dt.rows[i][1].tostring(); string file_name = path.combine(path, dt.rows[i][0].tostring() + ".rtf"); test.savefile(file_name, richtextboxstreamtype.richtext); test.clear(); if (run_once) { file.delete(file_name); run_once = false; i--; ...

unsigned char - Some Simple C++ Questions -

i don't know c++ (almost nothing), meaning i'm noob @ c++. 1. let's have code: typedef unsigned char u8; with code, mean when create variable can write u8 instead of unsigned char? unsigned char 1 byte value ranging 0 255 or else? 2. now add something: typdef unsigned char u8; u8 *somevariable; somevariable = new u8[12345]; what's variable somevariable now? list/array 12345 items every entry of type u8? 3. adding more: typedef unsigned char u8; u8 *somevariable; somevariable = new u8[12345]; somevariable+=4; what happens somevariable now? add 4 every index in somevariable or one? or totally wrong list or array thing? yes can write u8 stuff; instead of unsigned char stuff; given typedef. yes, might range 0 255. might bigger. see here in example have allocated array (std::list or c++11's std::array different) or unsigned chars (and don't seem delete[] them) adding number pointer affect pointer, not points to, third e...

Java - How to write a very large (20,000x20,000 px or larger) tif image -

i working extremely large tif images composing large single image. have library created colleague of mine generates image pyramid , provides handy tool visualizing image pyramid. visualizer great taking peak @ large image , visually identifying points of interest, customers more interested in image analysis on these large images. thus, necessary export large image single file. find troublesome considering these images can anywhere 800 mb multiple gbs in size. , task of loading single image memory challenging, particularly when image analysis being done. i wondering, if possible in java write large tiff image in block or line-by-line fashion. application running out of memory on small (8 gb ram) machines. the current method composing these images is: store pixel values bufferedimage using writableraster short[][]pixels = ... bufferedimage image = new bufferedimage(width, height, type); writableraster = image.getraster(); (int row = 0; row < height; row++) { (int ...

laravel - Route::resource issue when its under a group-route with a prefix -

when use route::resource under group-route has prefix applied, "routenotfoundexception" for example have this /// routes file $languages = array('gr','en'); $locale = \request::segment(1); if(in_array($locale, $languages)){ \app::setlocale($locale); }else{ $locale = null; app::setlocale("gr"); } route::group(array('before'=>'auth','domain' => 'app.domain.dev','prefix'=>"$locale"), function(){ route::resource('invoices', '\ctrl\app\invoicescontroller'); }); i error symfony \ component \ routing \ exception \ routenotfoundexception unable generate url named route "invoices.index" such route not exist.

javascript - How to assign variable to json object -

'i'm trying assign variable parent div json string of child table , can't seem javascript straight. what i'd see, or variation of: {"blocks":[{"id":"115",courses:[{"semester":"s,f","credits":"3","subject":"act"}‌​, {"semester":"f","credits":"6","subject":"csi"}]}] and jquery have far. $('#update').click(function (e){ var table = $('#table').tabletojson(); var blockid = $('#table').closest('div.block').attr('id'); table = {"block":table}; document.getelementbyid('courselist').value = json.stringify(table); } i'm not sure how add in variable need in object? how insert blockid? i'm assuming bracket notation you're looking : $('#update').on('click', function(){ var table = $('#table').ta...

How can I create an MDI application from a DLL (c++/mfc) -

i hope isn't confusing have following situation: sdi application dynamically loads dlls. these dlls perform various tasks, spawn dialogs, etc. normally these dialogs dlls create simple. have many controls , need features of mdi application. can't separate window new project, i'm looking way create within dll , initialize if simple dialog. i'm not particularly sure if possible if can point me in correct direction. thanks!

twitter bootstrap 3 - Disabling responsiveness and Column ordering -

i have problems column ordering after disabling responsiveness in bootstrap 3. <div class="row"> <div class="col-xs-9 col-md-push-3">...</div> <div class="col-xs-3 col-md-pull-9">...</div> </div> if so, affect layout on resolution below 1024 - blocks change places. i've tried solutions, one... <div class="row"> <div class="col-xs-9 col-xs-push-3">...</div> <div class="col-xs-3 col-xs-pull-9">...</div> </div> ... , one... <div class="row"> <div class="col-md-9 col-md-push-3">...</div> <div class="col-md-3 col-md-pull-9">...</div> </div> ... , none of them work properly. i want disable responsiveness , force col-9 block go first in html document , col-3 go after @ resolution, col-3 block (sidebar) must aligned left , col-9 block (main content) must...

c# - Web Service that handles file upload works locally but not remote -

i've written webservice in servicestack accepts file uploads. test i've used following code: string filepath = @"c:\myfile.pdf"; string webapi = @"http://localhost:20938/upload/myfile.pdf"; httpwebrequest client = (httpwebrequest)webrequest.create(webapi); client.method = webrequestmethods.http.post; client.allowwritestreambuffering = false; client.sendchunked = true; client.contenttype = "multipart/form-data;"; client.timeout = int.maxvalue; using (filestream filestream = file.openread(filepath)) { filestream.copy(client.getrequeststream()); } var response = new streamreader(client.getresponse().getresponsestream()).readtoend(); this works localhost, when deploy remote server, doesn't work. 500 internal error. (other web api calls return json data work locally , remotely). how fix/debug this? the code below, works me. difference, can see allowwritestreambuffering = true; string requesturi = path.combine(...

mysql - Need Help Thinking Through Semi-Complex Query on Two Tables -

i have 2 tables, , want create select pulling single record 1 table based on multiple records table. perhaps clearer if give sort of example. table: dates. fields: dosid, personid, name, datein 1 | 10 | john smith | 2013-09-05 2 | 10 | john smith | 2013-01-25 table: cards. fields: cardid, personid, cardcolor, carddate 1 | 10 | red | 2013-09-05 2 | 10 | orange | 2013-09-05 3 | 10 | black | 2013-09-05 4 | 10 | green | 2013-01-25 5 | 10 | orange | 2013-01-25 so want select record dates table if person did not receive "red" card. closest have come like: select name, datein dates, cards dates.personid = cards.personid , cardcolor != 'red' , datein = carddate; but query 2013-09-05 date-of-service still pulled out because of "orange" , "black" cards given on same day. i have tried searching not sure how describe issue , google-fu has failed me. or suggestions appreciated. the easiest understand version filter using not...

How does Lucene weigh a term if it appears in the query with different weights (below or above 1)? -

since use algorithm create weighted multi-term queries fire lucene in query-time, happens 1 term appears several times different weights, e.g. [ignore dutch language] euro^5 geld^5 euro^5 assuming answer lie in either multiplying or adding weights, compared top-10 returned docs each option. results seemed confirm weights multiplied, i.e., query above equal to euro^25 geld^5 however, using same test in query both weights below 1 , above 1 occured, got different results 3 of following queries: euro^0.5 geld^5 euro^0.5 euro^0.25 geld^5 euro^1 geld^5 that means either (or both) test results due chance , weights summed nor multiplied; or cannot combine weights below , above 1. can me out? or can find in-depth information lucene's mysterious query-time weight handling ways? for it's worth: use dutchanalyzer , queryparser , lucene version 4.2.1. there 3 highly useful resources point to: tfidfsimilarity documentation - details default scoring algorit...

php - Selecting records that fall withing a time range in MySQL with Laravel 4 -

hello having problem cant figure out. have database couple of columns. title, body, start, , end. the start , end columns of datetime type. have rows in database start , end dates. i trying select rows fall within date range. in case 24 hour span. so example, if have row has start day of today(sept. 24, 2013) , end date of jan. 1, 2014, expect returned. route::get('/', function() { //start of day $start = date('y-m-d 00:00:00'); //end of day $end = date('y-m-d 23:59:59'); $data['flyers'] = flyer::where('start', '>=', $start)->where('end', '<=', $end)->get(); //return homepage return view::make('view', $data); }); thanks in advance. post answer if figure out first. the comparison operators on where() calls backwards. way code now, selecting flyers start , end today. want this: $data['flyers'] = flyer::where('start', '<=', $start)->where(...

android - Generate Call Graph Model in MoDisco -

i read file [1 testing android apps t hrough symbolic execution]: http://mason.gmu.edu/~nesfaha2/publications/jpf2012.pdf they wrote: we parse app’s source code using modisco [19] , extract app’s call graph model i installed modisco not sure do. so question how can create call graph model? http://i.stack.imgur.com/khber.png after having installed modisco, can select discovery -> actions -> display method calls package explorer context menu. opens view. looks bit different image linked to.

openstack - python-novaclient source code explanation -

i trying figure out python-novaclient source code , need more familiar python. code below exactly? how init method in class novaclientargumentparser being used. from shell.py program line 197: class novaclientargumentparser(argparse.argumentparser): def __init__(self, *args, **kwargs): super(novaclientargumentparser, self).__init__(*args, **kwargs) the class called somewhere below: class openstackcomputeshell(object): def get_base_parser(self): parser = novaclientargumentparser( prog='nova', description=__doc__.strip(), epilog='see "nova command" ' ...... ...... def main(self, argv): # parse args once find version , debug settings parser = self.get_base_parser() .......... .......... thanks al

regex - php split string on first occurrence of a letter -

i have following string $string = "18/05-01/06 01/06-06/07 06/07-22/08 22/08-14/09 dr record + 2 21.47 20.24 27.15 20.24 record + 2 24.05 22.68" i split @ first letter found (the letter varies each time). found similar question had following example $split = explode('-', 'orange-yellow-red',2); echo $split[1]; //output yellow-red but assuming know letter is. there way specify letter? i've used preg split before can't limit , i'm not regex. if explode work regex may work, example not work. $string = "18/05-01/06 01/06-06/07 06/07-22/08 22/08-14/09 dr record + 2 21.47 20.24 27.15 20.24"; $split = explode([a-za-z], $string,2); use preg_split $string = "18/05-01/06 01/06-06/07 06/07-22/08 22/08-14/09 dr record + 2 21.47 20.24 27.15 20.24 record + 2 24.05 22.68" $stringarray = preg_split("/[a-za-z]/",$string,2); the [a-za-z] tells find first letter, , split there $stringarray hold 2 resultin...

ruby - rails: how to have a FactoryGirl for all my states -

say have event_type model has few event types such "live","used","offline". those types used in other model called event. now, when testing, need have types populated on every run. more specific, event factory: factory :event |e| e.event_type {|v| v.association(:event_type)} e.latitude 40.767929000000 e.longitude -73.985742000000 end i tried on event factory: after(:create) {|event| factorygirl.create(:event_type, {:name => "live"}) factorygirl.create(:event_type, {:name => "used"}) factorygirl.create(:event_type, {:name => "offline"}) } the problem approach if create more 1 event object event types created again each event use. what better approach? thanks, you have in _spec running test. (or test) in rspec you'd in before block @ top of spec. require 'spec_helper' describe event before factorygirl.create(:event_type, {:name => "live"...

Using Counters in cassandra for multiple java instances -

hi planning use counters getting human readable unique number in cassandra .i have java application running on 2 servers (2 instances).how can ensure request @ anytime fetches me unique counter value? counters not sequences. use uuids generate unique identifiers instead: http://www.datastax.com/documentation/cql/3.0/webhelp/cql/cql_reference/cql_data_types_c.html

vba - Why is my .setfocus ignored? -

i have access form textbox meant allow repeatedly typing number, hitting enter, , letting script stuff. speed, field should keep focus after dostuff() done. however, while i'm sure dostuff() run, focus goes next field in tab order. it's me.myfld.setfocus being ignored. how keep focus on field after dostuff() done? private sub myfld_keydown(keycode integer, shift integer) if keycode = vbkeyreturn dostuff me.myfld.setfocus end if end sub if @ the order of events keypress change focus , can see follows pattern: keydown → beforeupdate → afterupdate → exit → lostfocus you can re-set focus anywhere in there , still keep following pattern. need tell stop following pattern. replace me.myfld.setfocus docmd.cancelevent , should fix problem. basically, kicks out of above pattern, exit , lostfocus events never fire...

How to open and process a video file like .mpeg or .avi using openCV's VideoCapture method in Java -

import org.opencv.core.core; import org.opencv.core.mat; import org.opencv.core.size; import org.opencv.highgui.highgui; import org.opencv.highgui.videocapture; import org.opencv.imgproc.imgproc; public class video { public static void main(string[] args) { system.loadlibrary(core.native_library_name); videocapture cap = new videocapture(0); cap.open(1); if(!cap.isopened()) { system.out.println("no camera"); } else { system.out.println("yes. camera"); } mat frame = new mat(); cap.retrieve(frame); highgui.imwrite("me1.jpg", frame); mat frameblur = new mat(); imgproc.blur(frame, frameblur, new size(5,5)); highgui.imwrite("me2-blurred.jpg", frameblur); imgproc.gaussianblur(frame, frameblur, new size(25, 25), 20); ...

django form wizard, does not go to second step -

i trying perform following using django : wizard containing 2 formds first form simple form containing ajax compute automatically fields second form user registration the problem following : the first form displayed correctly , ajax within page working fine the second form never displayed after pushing on button "submit" the code follows : urls.py from forms import insertpropertyform1, insertpropertyform2 views import insertpropertywizard urlpatterns = patterns('', url(r'^addproperty/$', insertpropertywizard.as_view([insertpropertyform1, insertpropertyform2]), name='addproperty'), ) views.py forms = [("property", insertpropertyform1), ("test", insertpropertyform2) ] templates = {'0': 'realestate/addproperty.html', '1' : 'realestate/test.html', } class insertpropertywizard(sessionwizardview): def get_template_names(self...

php - Content update for all visitors through JavaScript -

i'm looking solution fix following problem: when hold down mousebutton, div change it's background-color red green , when lift button color change red again. now works in own browser (my client side).. i'm trying when down button in browser, div should change it's color on screen aswell on screen of neighbour or other visitor. can manage js/ajax? or need other server side scripting language php make onmousedown/up happen visitors if 1 person clicks? the div should change it's color on screen aswell on screen of neighbour or other visitor you absolutely need server-side support build such realtime application. if have choice of server-side technology, recommend looking node.js . also, want learn websockets . edit: you use service pubnub , host centralized messaging , distribution part of , have javascript libraries make easy. – @jason sperske

winapi - capturing a desktop , other then the active one -

(c/win32) i using http://msdn.microsoft.com/en-us/library/windows/desktop/dd183402(v=vs.85).aspx capture current desktop. uses: getdc(null); to running desktop. let's have few desktops (for example, using sysinternal's desktop tool). thought use opendesktop , use handle in getdc gives me black pic. there other way of capturing other desktops in current station (within current session of course)? opendesktop() returns hdesk getdc() requires hwnd instead. try calling setthreaddesktop() first, thread associated target desktop, try getdc(null) again.

sorting - d3.js sort descending positive to negative -

Image
would sort largest positive largest negative. desired output: (3,2,1,0,-1,-2,-3), current output: (3,2,1,0,-3,-2,-1) initial array: ["-0.87", "0.51", "3.34", "1.58", "2.67", "0.51", "-1.58", "1.91", "-0.86", "-0.42", "0.23", "1.5", "-1.67", "1.9", "-2.88", "-0.63", "1.13", "-1.37", "-0.42", "-0.35", "-0.38", "0.65", "-0.41", "0.49", "1", "-0.14", "-0.07", "2.41", "3.09", "0.85", "0.51", "-0.67", "0.53", "0.98", "-0.88", "0.18", "-0.75", "-0.22", "-0.27", "-2.09", "0.01", "1.14", "-0.64", "-0.53", "3.01", "1.49", "1.56...

angularjs - ui-bootstrap modal scope bug -

i noticing weirdness ui-bootstrap modal scope. seems when using ng-model in it, have reference $parent scope of modal controller. notice in plunker other properties such ng-options doesn't require $parent: http://plnkr.co/edit/xgshz4ekzvgr2d6cuebz?p=preview any idea why? found similar issue here: scope issues angular ui modal that led me try $parent change unable comment on thread because don't have enough reputation. any idea why scope seems change? thanks! the modal has own scope (i've never used angular ui, it's thing can happening) , when you're setting "selectedlocation" property getting set on modal's scope , not controller's scope. $parent forcing got controller's scope, that's not solution because you'll locking self structure assuming parent of modal has "model". here's modified plunker using model object on controller scope (using model.selectedlocation) http://plnkr.co/edit/b5kzaia5xi...

push notification - Android GCM Server error: Device Subscription Expired -

on sending notifications android device via gcm getting following response: device subscription expired: pushsharp.android.gcmpushservice -> appid due issue experience random issues on phone. example, app receives call backs on receiver. can please provide more details error? when occur? similar device id registration? needs done handle situation? thanks! if @ code of gcmpushchannel.cs , you'll see devicesubscriptonexpiredexception returned when either google return notregistered error or canonicalregistrationid . since saying app gets calls on receiver, it's possible have in db multiple registration ids same device, , when send message of them, device gets multiple messages. explain why canonical registration id in response google. i'm not sure how push sharp handles canonical registration id. little code read it's possible fires event allows delete old registration id db.

SI-prefixes for number format in MS Excel -

does know if possible show numbers in ms excel si-prefixes? i'd have ... 1 n, 1 µ, 1 m, 1, 1 k, 1m, 1 g, ... instead of scientific format ... 1e-09, 1e-06, 1e-03, 1, 1e+03, 1e+06. 1e+09, ... perhaps adding unit v (volts), f (farad) etc. i perfect, if cell still contain number , not string, can changed format (back scientific or whatever) no solution work better scientific notation. if use custom number formats, have enter them manually (or vba) such mask actual content of cell. for instance, if want display following format pairs: 1 n 1e-09 1 µ 1e-06 1 m 1e-03 1 1 1 k 1e+03 1 m 1e+06 1 g 1e+09 if have 0.001, have set format "1 m" -- mask number, if have 0.002 have set "2 m" -- if changed 0.004 still display 2 m result. isn't ideal. you set two-column sheet, have values in left, , use formula display units on right, end not being able math formatted values. so basically, answer "no", isn't possibl...

inserting line breaks after every record in the textpad -

i have textpad file has rows of text. e.g. cat: meaning - animal. cat ran house rat: meaning- rodent. rat lives in borough , feeds on leftovers word 3: description word 4: description i have many such record in file. want insert line break @ end of every record proper presentation. doing manually tedious. please if know automated process insert line break. thanks mohit you can using feature called "regular expressions" find , add empty lines. open find/replace (search menu > replace) in "find what" field, type following: (^.+$)\n(^.+$) in "replace with" field, type following: \1\n\n\2 tick "regular expression" checkbox click replace button @ least twice, perhaps 3 times, until message cannot find regular expression untick "regular expression" checkbox close replace dialog confirm file formatted expecting save file.

JQuery set focus on uniform select -

a simple enough problem, stupidly simple solution, i've been unable find anywhere. how manually set focus on select has been processed uniform.js? if remember correct, think call jquery focus() on input , call $.uniform.update(); force uniform update based on change.

c# - Why is this code not threadsafe? -

i have piece of code this: public class usercache { private dictionary<int, user> _users = new dictionary<int, user>(); public user getuser(int id) { user u = null; lock (_users) { if (_users.containskey(id)) return _users[id]; } //the below line threadsafe, no worries on that. u = retrieveuser(id); // method retrieve database; lock (_users) { _users.add(id, u); } return u; } } i'm locking access dictionary, in team told still not threadsafe(without explanation). question - think thread safe @ all? edit: forgot ask,what solution like.please note i'mnot looking lock whole method, retrieve user time consuming operation. no, it's not thread-safe. imagine it's called twice @ same time same id, isn't present. both threads far retrieveuser , , they'd both call _users.add(id, u) . second call fail...

Rails Fullcalendar modal close gets uncaught error -

Image
i have rails app using fullcalendar. has modal entering labor hours. modal shows fine , if enter data, gets added database. but, modal won't close. cancel button , x in top right corner of modal don't work. i uncaught jquery.event.remove in browser console. see attached pic. i have similar code working in application. i've looked , looked differences cause - no avail. the statement not working $(this).dialog "close" . but, said, statement works fine in application using fullcalendar. i'm not sure look. how chase down uncaught error? (i feel other javascript (not fullcalendar) that's causing error.) here coffeescript buttons created: $("#dialog-form").dialog autoopen: true height: 450 width: 400 modal: true buttons: "create labor": -> $.create "/events/", event: workorder_id: workorder.val(), actcode_id: actcode.val(), ...

Retrieve all facebook photos in an album -

when did fql query following query... select album_object_id, src_big photo album_object_id = xxx it returned me 4 photos only. however, have 7 photos in album. of solutions found online, many mentioned regarding privacy issue. however, have checked photos in album set public. the other 3 photos posted @ different timing earlier 4 photos though. set public too!

windows phone 8 - SoundEffectInstance and progress bar -

in wp application i'm playing lengthy sound effect , trying update progressbar song state, can't find way, appreciated. my sound standard soundeffectinstance sound; and: if (sound.state == soundstate.paused) { sound.resume(); } else { try { sound.stop(); } catch { } stream stream = titlecontainer.openstream("sounds.wav"); var effect = soundeffect.fromstream(stream); sound = effect.createinstance(); frameworkdispatcher.update(); sound.play(); } if have way length of sound, either in bytes or units of time, can use value. compare number of bytes streamed or amount of time elapsed (depending on can get) total, , set loading bar accordingly.

java - Unable to lose jComboBox in a jTable focus -

i have jtable has jcombobox column. had issue couldn't jcombobox show unless first click on it. other people have had same problem , it seems . so learned needed make cellrenderer besides celleditor. , did... public class mycellrenderer extends jcombobox<customitem> implements tablecellrenderer{ @override public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column){ if(isselected){ setforeground(table.getselectionforeground()); super.setbackground(table.getselectionbackground()); } else{ setforeground(table.getforeground()); setbackground(table.getbackground()); } setselecteditem(value); return this; } } by way, using comboboxrenderer because need display text while containing item. public class mycomboboxrenderer extends basiccomboboxrenderer{ @override public component getlistcellrend...

php - How can I remove this extra character from my string? -

i have string stored in array, , inserted sql database using php , pdo. when in database there =20 gets stored @ end of string rid of. my code looks this: $name = trim($message_item[1]); $name = addslashes($name); $so_row = "insert sales_order (name) values('$name')"; $dbmrp->exec($so_row); i thought trim() remove extra, doesn't seem help. can rid of using preg_replace('/\s+/','',$name), lose whitespace, including ones in middle want keep. =20 , how rid of it? more info- $message_item array created exploding string gets read email. trim spaces on beginning , end of string. can donovan said , remove 3 last caracter. $name = substr($name, 0, -3); or replace =20 empty str_replace('=20', '', subject) but think should figure out why getting string =20. solution remove it, nothing workaround.

c# - How can I update Rally team membership? -

i'm stumped on how update team membership through api. i'm able add users projects, through project permissions, can't update team membership show user part of specific team. how best accomplished? the teammemberships collection on user modifiable. since question tagged c# here example of how (assumes wsapi v2.0 , .net rest toolkit 2.0): //get current team memberships user var user = restapi.getbyreference("/user/12345", "teammemberships"); request teammemberrequest = new request(user["teammemberships"]); list<dynamicjsonobject> teams = new list<dynamicjsonobject>(restapi.query(teammemberrequest).results.cast<dynamicjsonobject>()); //add new team (project) dynamicjsonobject newteam = new dynamicjsonobject(); newteam["_ref"] = "/project/23456"; teams.add(newteam); //update user dynamicjsonobject toupdate = new dynamicjsonobject(); toupdate["teammemberships"] = teams; resta...

jquery - How to add remote upload functionality to a web app with Instagram-like Filters to allow sharing on Facebook? -

i found awesome tutorial on building web app instagram-like filters: http://tutorialzine.com/2013/02/enhancing-the-instragram-filter-app/ the app allows drag picture computer browser , apply instagram-like filters it. can download image computer. i trying figure out how add ability share photo on facebook. possible without remote upload? i have 1 idea of using script: <a class="share" onclick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=title_goes_here&amp;p[summary]=copy_goes_here&amp;p[url]=http://www.website.com&amp;&amp;p[images][0]=http://www.webste.com/image_url.jpg', 'newwindow', 'width=555, height=315'); return false;"></a> would possible replace " http://www.webste.com/image_url.jpg " part temporary image generated canvas? thanks much! i believe not possible. the way pass image directly in url create data uri. while canvas have todataurl() met...

java - Mod Making, crash on drawing things to the screen? -

i'm making hacked client/cheats game called minecraft. compiled mods, , when try turn on, crash report on wherever drawing hack name screen. i can't tell wrong, works in eclipse not in game. wrong code? if(client.flight){ var8.drawstring("flight",guiscreen.width-var8.getstringwidth("flight")-1,arrayseperator,0xccff33); arrayseperator+=11; } if(client.sneak){ var8.drawstring("sneak",guiscreen.width-var8.getstringwidth("sneak")-1,arrayseperator,0x007700); arrayseperator+=11; } if(client.nofall){ var8.drawstring("nofall",guiscreen.width-var8.getstringwidth("nofall")-1,arrayseperator,0xff0000); arrayseperator+=11; } if(client.sprint){ var8.drawstring("speed",guiscreen.width-var8.getstringwidth("speed")-1,arrayseperator,0x99ccff); arrayseperator+=11; ...