Posts

Showing posts from February, 2010

java - How to zoom web view dynamically in android using action bar, onNavigationItemSelected? -

Image
in application used action bar , web view. want zoom web view 125% ,150%.... please me find out solution. you can in android api 21 , after using function mwebview.zoomby(2.0f); //here 2.0f means 200%.

c# - deactivating FormsAuthentication ticket -

i have misunderstanding forms authentication. example app has many employees , 1 of them retired. user information needed documantation. disable account. how can make authentication tickets in browsers became deactivated cannot use app authorised user?

MATLAB:Why the result of comparing the same white image gives NaN? -

salam alikum: want create ocr system based on template matching. so, i`ll input image contains text such 'hello world', algorithm results in hello world text. have created database of chars+the white space images. have extracted characters except white space between 2 words. when trying compare image represent space in database white space in image contains text using corr2 matlab function, gives nan . even when comparing same white image self results nan. help me in problem. check definition of corr, dividing 0 zero if elements equal mean.

iterator - Java - Implementing a round-robin circular List, and counting element's access count? -

scenario: for list have 3 elements [a, b, c]: you can circular access many times want. , there additional counting function records access count of each element. for example, if accessing 7 times, should return: [a, b, c, a, b, c, a] and have access count of each element following: +–––––––––––+–––––––––––––––+ | element | access count | +–––––––––––––––––––––––––––+ | | 3 | +–––––––––––––––––––––––––––+ | b | 2 | +–––––––––––––––––––––––––––+ | c | 2 | +–––––––––––+–––––––––––––––+ any response appreciated. regards. updated add additional function allow caller specify elements list should filtered. still use 7 times accessing example, filtering [c]: [a, b, a, b, a, b, a] +–––––––––––+–––––––––––––––+ | element | access count | +–––––––––––––––––––––––––––+ | | 4 | +–––––––––––––––––––––––––––+...

python - How do you get Gunicorn + Flask to serve static files over https? -

i using gunicorn + flask + python develop heroku app, , want able run locally foreman. works fine, when switch use ssl site, no longer able find javascript files under /static. how can make these available under https? can use nginx front-end gunicorn? if can serve static content javascript via ssl adding location block below nginx.conf: server { listen 443 ssl; # other normal ssl stuff seem have working location / { root /path/to/your/static/stuff; try_files $uri /index.html; # match static content } location /api { # normal proxy stuff gunicorn } } and separately, can serve static content separate api on http efficiency, below: server { listen 80; location / { try_files $uri /index.html; } } server { listen 443 ssl; # other normal ssl stuff seem have working location /api { # normal proxy stuff gunicorn } }

binary - Python - calculate the distance with different data types in python -

i have data 11 attributes. want calculate distance on each of these attributes. example attribute (x1, x2, ..., x11) , x1 & x2 has nominal type, x3, x4, ... x10 has ordinal type, x11 has binary type. how can read attributes using python? , how differentiate these attributes in python , how differentiate these attributes in python can calculate distance? can tell me should do? thank you you can this: def distance(x,y): p = len(x) m = sum(map(lambda (a,b): 1 if == b else 0, zip(x,y))) return float(p-m)/p example: x1 = ("forestry", "plantation", "high", "low", "high", "medium", 3, "low", 297, 1, true) x2 = ("plantation", "plantation", "high", "medium", "low", "low", 1, "low", 298, 2, true) print distance(x1,x2) # result: 0.636363636364 = (11-4)/7

javascript - Passport-Facebook authentication is not providing email for all Facebook accounts -

i using passport-facebook authentication. passport.use(new facebookstrategy({ clientid: 'client_id', clientsecret: 'client_secret', callbackurl: "http://www.example.com/auth/facebook/callback" }, function (accesstoken, refreshtoken, profile, done) { process.nexttick(function () { console.log(profile) }); } )); for of facebook accounts don't email_id , tried using scope variable such below, still unable email_id. profileurl : " " , profilefields : ['',''] make sure these 2 things in code: passport.use(new facebookstrategy({ clientid: 'client_id', clientsecret: 'client_secret', callbackurl: "http://www.example.com/auth/facebook/callback" passreqtocallback : true, pr...

sql - UPDATE database with PHP - not working -

my goal change value in "commission" column 'open' 'closed' when update table 'status'.i can't seem db update. not errors. doing wrong? this code submit button: if($result["commissions"]=='open'){ echo '<form method="post" action="admin_main.php"> <input name="commissionsc" type="submit" value="close comissions" /> </form>'; } this part of code not working: <?php include("includes/connect.php"); if(isset($_post['comissionsc'])){ $res= mysql_query("select * status"); $row= mysql_fetch_array($res); $sql="update status". "set commissions = 'closed'". "where id = 1"; } ?> change query to: $sql = mysql_query("update status set commisions = 'closed' id = 1"); you're not executing query. footnotes: mysql_* functions dep...

mysql - Inserting multiple rows/records into another table from a filtered report -

i'm having trouble inserting multiple rows/records table filtered report when user clicks on checkout. image of report (as have less 10 rep): http://s12.postimg.org/otm0pl8cs/untitled_1.jpg 'inserts books in order details table dim strorderdetailsql string strorderdetailsql = "insert order_details (orderno, isbn, quantity) values ('5', isbn_cart, quantity_cart)" docmd.runsql strorderdetailsql where order number 5 test value. how can have insert filtered records report? as stands, inserts first record, not both. something insert tablea(column1,column2,...) values select othercolumn1, othercolumn2,... bla bla.. (i have used similar query in postgres)

Using bootstrap-switch with Rails' check_box -

i need display checkbox user's field. using: <%= f.label :is_name_public, "public name" %> <%= f.check_box :is_name_public %> now want use bootstrap-switch rails' chech_box. in order use switch button, checkbox needs like: <input id="user_is_name_public" name="user[is_name_public]" type="checkbox" value="1" data-size="small" data-on-color="success" data-on-text="yes" data-off-text="no"> instead of rails' default: <input id="user_is_name_public" name="user[is_name_public]" type="checkbox" value="1"> the question is , how tell rails add custom properties data-size="small" or data-on-color="success" checkbox? or how associate custom html checkbox entity being edited form? you can add more attributes default ones: <%= f.check_box :is_name_public, :class => 'someclass...

github - How to use git submodule with a 3rd party library? -

i want add 3rd party lib on github git submodule project i'm working on. since library can change, , changes out of hands, wondering best practice using submodule. the options had in mind are: forking lib , using sub module ensure no changes harm project. using specific version's branch/tag (is possible) submodule is 1 of these options recommended way go? there better way aside these options? if library owner publish packages, might easier use language manager: you'll have update version number want use when new package available. otherwise, using submodules (or subtree ) might option. stated in comments, you'll still choose commit of library want use, , you'll update whenever choose to. as example, project used successively both solutions: started submodules, , eventually referenced library maven package. note using submodules, you'll end cloning library in workspace, there's not point in wondering if need fork library. ...

c++ - Strange behavior of custom allocator -

if run program, return sigsegv. if dissasemble , debug, saw crash @ begin of function dcallocator::free() . #include <cstdlib> class dcallocator { public: void * alloc(unsigned long size) { return malloc(size); } void free(void * p) { free(p); } }; int main() { dcallocator dalloc; int * arr = (int*)dalloc.alloc(sizeof(int)*40); (int i=0; i<40; ++i) arr[i] = i*2; (int i=0; i<40; ++i) cout << arr[i] << ", "; cout << endl; cout << "end" << endl; dalloc.free(arr); // there sigsegv cout << "of deallocation" << endl; return 0; } your free() member call until runs out of stack space. meant call ::free() : void dcallocator::free(void* ptr) { ::free(ptr); }

database - Parse update and deletion not working android -

i working android apis , per have done same instructed. here code update.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub parsequery<parseobject> query = parsequery .getquery("gamescore"); query.whereequalto("playername", user.gettext().tostring()); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> arg0, parseexception arg1) { // todo auto-generated method stub if (arg1 == null) { if(arg0.size()!=0) { final parseobject delo = arg0.get(0); toast.maketext(getapplicationcontext(), "got : " + arg0.size() + " " + delo.getobjectid(), toast.length_short).show(...

objective c - How can i repeat a code code after a delay -

i'm trying make game have fly through cave, , pick object gives points. want bonus image repeat several times while playing. have tried using code tell me hide object, can't see anymore, can still pick while it's hidden... i thought repeating "corona", how? please me :) here .m file: #import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller -(void)collision{ if (cgrectintersectsrect(heli.frame, obstacle.frame)) { [self endgame]; } if (cgrectintersectsrect(heli.frame, obstacle2.frame)) { [self endgame]; } if (cgrectintersectsrect(heli.frame, bottom1.frame)) { [self endgame]; } if (cgrectintersectsrect(heli.frame, top1.frame)) { [self endgame]; } } -(void)endgame{ if (scorenumber > highscore) { highscore = scorenumber; [[nsuserdefaults standarduserdefaults] setinteger:highscore forkey:@"highscoresaved"]; } heli.hidden = yes; [timer invalidate]; [scor...

python - Debug Multiple Processing Queue in multiple consolse -

i want interact multiprocessing queue data in multiple consoles following: #test.py import multiprocessing global queue queue = multiprocessing.queue() #python console 1 test import queue queue.put("this console 1") #python console 2 test import queue print queue.get() #"this console 1" but doesn't work.what missing? if understood correctly trying do, cannot work. i'm assuming "console" mean python interactive prompt. you start "console 1", os process. create queue object in it, , put on it. you start "console 2", os process not created through process object. create queue object in different object 1 created in "console 1". try nothing because nothing has been put on it. (the fact both import test.py irrelevant.) queue object not meant serve communication channel processes not related means of process object. see instance, example documentation : from multiprocessing import process,...

ios - How to pass data back to the original UINavigationController -

Image
i pass data last table view first view. how can grab hold of first view object? i'm familiar delegate pattern. first view, i'm using style modal invoke table view. create object manage data model outside of controller structure (singleton or owned application delegate). update when have new data , read when want display something. then, instead of having make links between controllers, need remove 1 or ones don't want , let 1 go decide show.

Bash script with expect -

i have simplest script ever: #!/usr/bin/expect expect "hello" send -- "ll \r" when run it, manually type "hello" word , ll command never runs ... afterwards put exp_internal 1 , comes up [root@localhost tmp]# ./file1.exp expect: "" (spawn_id exp0) match glob pattern "hello"? no hello expect: "hello\n" (spawn_id exp0) match glob pattern "hello"? yes expect: set expect_out(0,string) "hello" expect: set expect_out(spawn_id) "exp0" expect: set expect_out(buffer) "hello" }end: sending "ll \r" { exp0 ll [root@localhost tmp]# can explains me why command not being ran command ?

c# - Extending functionality through interfaces -

i have implemented interface iservice inherits functionality series of other interfaces , serves common ground many different services. each of these services being described interface, example: public interface iserviceone : iservice { //... } public class serviceone : iserviceone { //... } everything point works expected: iserviceone serviceone = new serviceone(); iservicetwo servicetwo = new servicetwo(); what have add big list of constants (public variables) each of these services different per service type (for example, iserviceone have different constants iservicetwo , there constants in iserviceone not exist in iservicetwo , etc). what i'm trying achieve that: iserviceone serviceone = new serviceone(); var someconstantvalue = serviceone.const.someconstant; just because variables differ of service type decided implement interface each of them: public interface iserviceoneconstants { //... } and broaden iservice definition: public inter...

JavaScript Number Validation From 0 - 10 -

i need check if number between 0 , 10 in javascript. the code: <html> <head> <script> function compruebacampo(evt,campotexto) { //validar la existencia del objeto event evt = (evt) ? evt : event; //extraer el codigo del caracter de uno de los diferentes grupos de codigos var charcode = (evt.charcode) ? evt.charcode : ((evt.keycode) ? evt.keycode : ((evt.which) ? evt.which : 0)); //predefinir como valido var respuesta = true; //validar si el codigo corresponde if (charcode > 31 && (charcode < 48 || charcode > 57)) { //asignar false la respuesta si es de los no aceptables respuesta = false; } //valida rango valido 1-10 if ((campotexto.value + string.fromcharcode(charcode))>10 ||(campotexto.value + string.fromcharcode(charcode))<0) { respuesta = false; } //regresar la respuesta return respuesta; } </script> </head> <b...

asp.net mvc - Slick grid is not working for more than 8 rows -

in our mvc application ,we using slick grid displaying data update,we passing json string grid , display rows update .but until 8 rows it's working fine.but more 8 rows update not working.while update passing json string controller , save changes in table. when checked in firefox firbug following error coming . typeerror: grid.base undefined my sample code: (for displaying) grid = new slick.grid($("#grid-dplistitem"), data, columns, options); grid.base.render(); for update grid.geteditcontroller().commitcurrentedit(); var data = grid.getdata(); var griddata = json.stringify(data); $.ajax({ url: '/project/updateprojectmessage?griddata=' + griddata, //data: "griddata=" + json.stringify(data), type: 'post', contenttype: 'application/json;', datatype: 'json', may add following code in web config f...

ruby - Rails 4 has_many :through w/ check_box_tag - only one side of associate being saved to join table -

i'm new rails , i've been trying extend michael hartl's tutorial in various ways. 1 of model user interests using has_many :through association. have following models set up: class interest < activerecord::base has_many :user_interests, dependent: :destroy has_many :users, through: :user_interests end class user < activerecord::base has_many :user_interests, dependent: :destroy has_many :interests, through: :user_interests end class userinterest < activerecord::base belongs_to :user belongs_to :interest end my user_interests controller: def index end def create @user_interest = current_user.user_interests.build(params[:interest_ids]) if @user_interest.save redirect_to current_user flash[:success] = "interests updated!" else render 'index' end end def destroy @user_interest = userinterest.find(params[:user_id][:interest_ids]) current_user.user_interests(@user_...

ios - Setting a Row as Selected Based off of NSUserDefaults Value? -

i'm working on view player can choose character play with. have tableview each row represents character. inside each row button player taps select respective character. first time user loads it, 1 character available (first row) , following in viewdidload: //if not selected character exists set default character if (![[nsuserdefaults standarduserdefaults] integerforkey:@"current character"]) { [[nsuserdefaults standarduserdefaults] setinteger:0 forkey:@"current character"]; [[nsuserdefaults standarduserdefaults] synchronize]; } nslog(@"value: %d", [[nsuserdefaults standarduserdefaults] integerforkey:@"current character"]); by default of buttons in each row hidden revealing lock image behind it. following in cellforrowatindexpath method: //check unlocked items switch (indexpath.row) { case 0: { //always show since available cell.playerbutton.hidden = no; break; } case 1: { if([[nsus...

cruisecontrol.net - How to customize the fork process? -

i execute actions after successful fork . (e.g. automate creation of cruisecontrol.net project). which code should modify? should start from? there many options implement that, according source code. the first option should be: modify app_services/projects/fork_service.rb another option be: implement project_service (e.g. model , worker), binded external (unexisting) api manage complexity of project creation (more links when reputation high enough ;-))

java - findAll method of DataService class returns only 100 entities -

we've migrated our v2 qbo v3 , after on production got issue 1 of our customers. have on 100 customers in qbo account. , want copy them our application. implemented import this: dataservice service = getdataservice(owner); // obtain dataservice via access keys list<com.intuit.ipp.data.customer> customers = service.findall(new com.intuit.ipp.data.customer()); (com.intuit.ipp.data.customer customer : customers) { createcustomer(customer, owner); // our internal method create } as mentioned in class library reference - method findall a method retrieve records given entity. but our customer getting only first 100 entities (customer's) qbo v3 account. , if same import operation - same first 100 entities again. method doesn't allow pagination options. so question is, how all of entities? you should use query endpoint page filters. the following query gets customers 1 - 10: string query = select($(custome...

r - Fill blank cells using linear interpolation -

first have excel not tool of trade, , people not r users. supposed easy task, struggling find way fill empty cells using linear interpolation. suppose have following excel sheet: row date interpolated date 1 09/09/13 2 3 15/10/13 4 5 6 7 8 9 10 03/04/14 now copy non-empty values date interpolated date , fill empty cells interpolating between adjacent non-empty cells. note gap between empty values in date column haphazard. result should (this done using na.approx function zoo package r): row date interpolated date 1 09/09/13 09/09/13 2 <na> 27/09/13 3 15/10/13 15/10/13 4 <na> 08/11/13 5 <na> 02/12/13 6 <na> 26/12/13 7 <na> 20/01/14 8 <na> 13/02/14 9 <na> 09/03/14 10 03/04/14 03/04/14 as far have understood, not possible using standard excel functions , 1 should maybe use vba macros. complete newbie in ...

Map<String, String> as @RequestParam in Spring MVC -

i'm new spring , i'm trying add @requestparam of type map<string, string> controller this: @requestmapping(method = requestmethod.get) public model search(@requestparam(value = "searchterm", required = false) final string searchterm, @requestparam(value = "filters", required = false) map<string, string> filters, final model model) { and in url looks this: localhost/search?searchterm=factory&filters[name]=factory1&filters[name]=factory2 but every time, filters null , no matter do. can done? thank time! using map @requestparam multiple params if method parameter map or multivaluemap map populated query string names , values. following mapped /employees/234/messages?sendby=mgr&date=20160210 @requestmapping("{id}/messages") public string handleemployeemessagesrequest (@pathvariable("id") string employeeid, @requestparam map<string, s...

.net - How to use predicate search using Mongodb C# Driver -

how 1 use following method on awesome mongodb c# driver!???? public ilist<tentity>searchfor(expression<func<tentity, bool>> predicate) { return collection .asqueryable<tentity>() .where(predicate.compile()) .tolist(); } examples ideal! simply remove compile because creates delegate driver can't translate mongo query: public ilist<tentity>searchfor(expression<func<tentity, bool>> predicate) { return collection .asqueryable<tentity>() .where(predicate) .tolist(); } it means predicate expression must translatable mongodb driver.

c# - Can't start Gtk# Mono App without IDE (Unable to load DLL "intl") -

some background information: cross-platform-desktop-app written in c# gtk# , mono. target framework: mono / .net 4.5 runtime environment: microsoft .net problem i can build / debug / run project in xamarin studio or visual studio 2012 fine. whenever try start debug/release build without (open .exe), app doesn't start @ all. i tried homestream.exe 2> error.log stated here . and error.log contained following information: unhandled exception: system.dllnotfoundexception: unable load dll "intl": specified module not found. (exception hresult: 0x8007007e). @ mono.unix.catalog.gettext(intptr instring) @ mono.unix.catalog.getstring(string s) @ mainwindow.build() in g:\users\eric\dropbox\projekte\homestream\homestream\gtk-gui\mainwindow.cs:line 35. @ mainwindow..ctor() in g:\users\eric\dropbox\projekte\homestream\homestream\mainwindow.cs:line 22. @ homestream.homestreamapp..ctor() in g:\users\eric\dropbox\projekte\homestream\homestream\homestreamapp.c...

ms access - Making a 'count' in a query to find out how many of the same variables are in a column -

i trying set query, have table called 'cards' each specific id having 1 owner, while each owner has @ least 1 card. i trying set count tell me how many cards each person has , after that, show person has @ least 6 amount of cards. things i've tried: under card #, in criteria, tried doing count(*) > 6 keeps returning generic error, tried count(sum) each person , sum(>6) under 'last name' , nothing works i've been working on while , i'm genuinely stuck. i using microsoft access 2013 , has done within query , 'build' create query in query example view. show table cards . now, in design menu, toggle on totals. add owner group field. add card # (you should change without spaces , special characters) , change it's total field count. run query , you'll see first set of results -- count of cards each owner. next, go in design , add >6 criteria of count of cards column. show second listing describe.

php - file_get_contents not working on different servers -

i trying use file_get_contents() content of http://www.google.com/search?hl=en&tbm=nws&authuser=0&q=pakistan same code on 2 different servers. 1 getting every thing file while other getting 403 error. unable know reason is. used phpinfo() on both servers. one difference observe 1 use apache2 while other use other http server named litespeed v6.6 . don't know how if affect file_get_contents() method. more detail can see phpinfo() page link below. file_get_contents getting 403 phpinfo is; http://zavahost.com/newsreader/phpinfo.php while working file , here phpinfo: http://162.243.5.14/info.php i thankful if can tell effecting file_get_contents()? please let me know if idea? 403 unauthorized error. means lack sufficient permission connect content @ server. i'm not sure if due inability fetch data hosting provider, denied based on header information remote server has flagged unauthorized. try using answer on post: php curl: how can emulate requ...

python - Runtime of brute force string-matching algorithm -

i've written small, quick (to write, not run!), algorithm string matching in python: def brutematch(n,m): in range(0,len(n)-len(m)+1): if n[i:len(m)+i]==m: return(i) would runtime algorithm o(nm)? i'm comparing worst-case runtime horspool string-matching algorithm, (nm). guess confusion stems fact algorithm appears o(n) runtime iterates through input n, using indices inputs slice notation equality statement? thoughts? worst case o(nm), yes. because, see, == test tests each character in each string, take long length of shortest string in equality test.

opengl - How do I find my mouse point in a scene using SceneKit? -

i have set scene in scenekit , have issued hit-test select item. however, want able move item along plane in scene. continue receive mouse drag events, don't know how transform 2d coordinates 3d coordinate in scene. my case simple. camera located @ 0, 0, 50 , pointed @ 0, 0, 0. want drag object along z-plane z-value of 0. the hit-test works charm, how translate mouse point drag event new position in scene 3d object dragging? you don't need use invisible geometry — scene kit can coordinate conversions need without having hit test invisible objects. need same thing in 2d drawing app moving object: find offset between mousedown: location , object position, each mousemoved: , add offset new mouse location set object's new position. here's approach use... hit-test initial click location you're doing. gets scnhittestresult object identifying node want move, right? check worldcoordinates property of hit test result. if node want move child of sce...

c++ - Static class function in different class -

i trying call static function areamap::staticinitialize(model *) method in class view. compiles when define class areamap first error show below when try declaring view first though forward declared areamap. know way keep definition of view @ top? #ifndef view_h #define view_h #include "model.h" class areamap; class view { public: void linkmvc(model * m) { model = m; areamap::staticinitialize(m); } model * model; }; class areamap { public: void static staticinitialize(model * m) { model = m; } model * model; }; #endif error: inc/view.hpp: in member function ‘void view::linkmvc(model*, controller*)’: inc/view.hpp:36:7: error: incomplete type ‘areamap’ used in nested name specifier areamap::staticinitialize(m); #ifndef view_h #define view_h class areamap; class view { public: void linkmvc(model * m); model * model; }; class areamap { public: void static staticinitialize(model * m) { model = m; } model ...

c - Problems with compiling apache2 on AIX 6.1 -

while trying compile latest version of apache web server(2.4.9) on aix 6.1 run problem. when run ./configure --with-included-apr command got following output: checking chosen layout... apache checking working mkdir -p... yes checking grep handles long lines , -e... /usr/bin/grep checking egrep... /usr/bin/grep -e checking build system type... powerpc-ibm-aix6.1.0.0 checking host system type... powerpc-ibm-aix6.1.0.0 checking target system type... powerpc-ibm-aix6.1.0.0 configure: configure: configuring apache portable runtime library... configure: configuring package in srclib/apr checking build system type... powerpc-ibm-aix6.1.0.0 checking host system type... powerpc-ibm-aix6.1.0.0 checking target system type... powerpc-ibm-aix6.1.0.0 configuring apr library platform: powerpc-ibm-aix6.1.0.0 checking working mkdir -p... yes apr version: 1.5.0 checking chosen layout... apr checking gcc... gcc checking whether c compiler works... no configure: error: in `/stud/config/usr/admin/ga...

ios - How to get UITextField (subview to UITableViewCell) text value when tableview cell became invisible -

i created custom uitableviewcell class embedded uitextfield each cell, in additemtableviewcontroller , want text values within uitextfield-embededd cells , create new model object, i'm running problem: cellforrowatindexpath returns nil invisible cells, after scrolled down buttom of tableview hit add button, first few rows' textfield text value became null. is there anyway can fix this? i've been googlging hours , still not find answer it. here's additemtableviewcontroller code: - (ibaction)doneadd:(uibarbuttonitem *)sender { [self.delegate additem:[self newitem]]; } - (nsmutablearray *)newitem { nsmutablearray *newitem = [[nsmutablearray alloc] init]; (int = 0; < [_appdelegate.title count]; ++) { nsindexpath *indexpath = [nsindexpath indexpathforrow:i insection:0]; upfeditableuitableviewcell *cell = (upfeditableuitableviewcell *)[self.tableview cellforrowatindexpath:indexpath]; ...

android - Get Current Location GMaps -

i tried lot of "get current location" android. think of them outdated, or dont it. i dont want set marker.addmarker(params..) use blue default dot position on gmaps. here i've found somthing that, bad aint work. customize marker of mylocation google maps v2 android so in first line need, current location listener when location updating. im trying right (testing on real device). mylocation =null. //get gmaps fragment mmap = ((mapfragment)getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); mmap.setmylocationenabled(true); //activate blue dot mylocation = mmap.getmylocation(); //testing, not working = null //trying locationmanager locmanager =(locationmanager)getsystemservice(this.location_service); criteria criteria = new criteria(); string provider = locmanager.getbestprovider(criteria, true); mylocation = locmanager.getlastknownlocation(provider); if(mylocation != null){ double lat = mylocation.getl...

Atlassian Bamboo: don't trigger build if changes were made to a specific file -

i have plan in bamboo starts whenever changes made attached repositories (via polling). now, on each build, if successful, changelog file updated in repo, in turn, triggers build. how can omit files bamboo's polling, build isn't started if changes found files? because otherwise, enter in infinite loop, change changelog triggering build in turn updated changelog , on. if not possible, other viable solutions there? possible attach shell script somewhere before build starts check whether it's desired start new build? it turned out simpler i've thought. in plan configuration, in repositories tab, on each repository, under advanced, there include / exclude files input can customise files bamboo uses detect changes. adding regular expression there, got solved , working expected. bamboo pattern matching reference: https://confluence.atlassian.com/display/bamboo/pattern+matching+reference

c++ - Different handling of global arrays (malloc vs static) in OMP target -

there 2 ways have global array: use pointer , malloc, or define array: #omp declare target int garray[10]; int* gvals /*somewhere later:*/ = malloc(10*sizeof(int)); #omp end declare target i though, these equivalent in handling discovered huge difference: when map them target, gvals mapped. if want values of garray on device have use "target update". bug in current intel compiler or covered in spec? not find specific this. btw: using local array (no declare target) works intended. test code: for(i=0;i<ct;i++){ garray[i]=1;gvals[i]=1; } #pragma omp target map(garray[0:2],gvals[0:2]) { printf("garraytarget(1111): %d%d%d%d\n",garray[0],garray[1],gvals[0],gvals[1]); garray[1]=2;gvals[1]=2; } printf("garrayhost(1212): %d%d%d%d\n",garray[0],garray[1],gvals[0],gvals[1]); declare target puts enclosed variables in initial device context (2.9.4 -- declare target directive): if list item variable original variable mapped corres...

c# - XMl Search and filter in windows phone -

<?xml version="1.0" encoding="utf-8"?> <root> <player> <playerid>1234</playerid> <playername>abcd</playername> <line> <studentid>5612</studentid> <studentname>wxyz</studentname> </line> </player> </root> above shown xml, i have show "studentname" xml filter "playername" so, how should it? thanks! you can use linq2xml. try this: string xml = @"<?xml version='1.0' encoding='utf-8'?> <root> <player> <playerid>1234</playerid> <playername>abcd</playername> <line> <studentid>5612</studentid> <studentname>wxyz</studentname> </line> </player> </root>"; var doc = xdocument.parse(xml); string studentname = (string)doc.descendants("player") .wher...

symfony - What is the best approach to implement two bundles with common entities in Symfony2? -

i need 2 bundles share entities. best approach implement ? i thinking creating third bundle include entities , using them within other 2 bundles, i'm not sure best approach... thanks i suggest introducing new bundle store common entities. let's have 2 bundles called , b have p,q,r entities in common. introduce bundle called c , place p,q,r entities there. both , b can reuse entities without problem. great feature can achieved doing is, can remove a/b bundles without affecting functionality of system. if have uni-directional/bi-directional relationships, such pointing entities p,q,r entity in a/b bundle, can't remove bundles (removing app kernal , routing). have remove relationship entities @ first place in order remove bundle. mentioned significance of relationship types when comes bundle dependency. so, bottom line is, use bundle store common entities avoid duplication , reduce bundle dependability. recommend organising bundles according functionality of...

Go Resizing Images -

i using go resize package here: https://github.com/nfnt/resize 1) pulling image s3, such: image_data, err := mybucket.get(key) // gives me data []byte 2) after that, need resize image: new_image := resize.resize(160, 0, original_image, resize.lanczos3) // problem original_image has of type image.image 3) upload image s3 bucket err : = mybucket.put('newpath', new_image, 'image/jpg', 'aclstring') // problem new image needs data []byte how transform data []byte ---> image.image , ----> data []byte ?? thanks in advance help! read http://golang.org/pkg/image // need image package, , format package encoding/decoding import ( "bytes" "image" "image/jpeg" // if don't need use jpeg.encode, import so: // _ "image/jpeg" ) // decoding gives image. // if have io.reader already, can give decode // without reading []byte. image, _, err := im...

sql server - How to coalesce many rows into one? -

i using ssms 2008 r2 , trying coalesce many rows one. should simple think, repeating data in each row. consider: create table test ( name varchar(30) ) insert test values('a'),('b'),('c') select * test select distinct name, coalesce(name + ', ', '') test how can rewrite achieve 1 row like: a,b,c in sql server transact-sql, easiest way accomplish following. a table this: create table #foo ( id int not null identity(1,1) primary key clustered , name varchar(32) not null , ) insert #foo (name) values ( 'a' ) insert #foo (name) values ( 'b' ) insert #foo (name) values ( 'c' ) insert #foo (name) values ( 'd' ) go can flattened using seemingly dubious (but documented) technique: declare @text varchar(max) = '' select @text = @text + case len(@text) when 0 '' else ',' end +...

database - Is it possible to not write the result of a Postgres query to the disk? -

i wanted use postgres in memory store. after create materialized view, not want result written disk kept stored in memory. have lot of memory (>100gb) , not need use disk. wondering if possible so. found solution: keeping postgres entirely in memory it's possible ramdisk, it's really inefficient. you'll have @ least two, three, copies of data in ram - ramdisk, os buffers/cache, , postgresql's shared_buffers . what should instead allocate disk space anyway, set linux's dirty writeback thresholds high, turn fsync off in postgresql, use unlogged tables, , let run in non-crashsafe mode entirely ram. let os smart - can still write , flush data lazily, making more room in ram. if feel need in-ram database, you'd better off finding 1 that's designed work way. it's pretty rare need it.

python - How can I group geo-points to make groups on maps (using clustering method ) -

i developing demo show areas buy products most. looking way cluster map using k-means. in every lat/long, have number of items has been bought in area. wanna group points based on number of items , show successful areas. i have large data set (800 mb), data stored way on > lat log n_items > > 36.3312 -94.1334 4 > 36.6828 -121.791 4 > 37.2307 -121.96 8 > 37.3857 -122.026 0 > 37.3857 -122.026 9 > 37.3857 -122.026 6 > 37.3895 -97.644 5 > 37.3992 -122.139 7 > 37.3992 -122.139 8 > 37.402 -122.078 12 > 37.402 -122.078 7 > 37.402 -122.078 8 > 37.402 -122.078 6 > 37.402 -122.078 5 > 37.48 -122.144 4 > 37.48 -122.144 3 > 37.55 126.967 8 however, i'm looking method group points based on geographical proximity buying most, show on map. ideas how can make ? you can use markerclustererplus google maps api v3. return json (lat , lng) , loa...

sql - MySQL fetch data from another table where the column row matches a row result from first table -

i have 2 tables, let's contain: table1 id | username 1 | bla 4 | bla2 table2 from_id | fk_toid | action 1 | 2 | -1 4 | 2 | -1 now have like: select fk_fromid table2 fk_toid = 2 , fp_action = -1 what want fetch id , username table1, id of table1 matches from_id table2, fk_toid '2' in table2. so results returned should [{ id: 1, fk_fromid: 1, username: bla }, { id: 4, fk_fromid: 4, username: bla2 }] you need this: select a.id,b.from_id fk_fromid,a.username t1 left join t2 b on a.id=b.from_id click link see result: http://sqlfiddle.com/#!2/868c1/4 update:1 select a.id,b.from_id fk_fromid,a.username t1 left join t2 b on a.id=b.from_id b.fk_toid=2 , b.action=-1; check link: http://sqlfiddle.com/#!2/868c1/8

regex - Match "de" after abc in regular expression? -

i have string "abb" , , want match "b" after "a" . is possible? if possible, how this? p.s.: know use "a(b)" match "ab" , extract "b" in group. using in text editor, cannot use group technique. you can use positive look-behind assertion that: (?<=a)b this match b without matching a. (?<=a) makes sure b preceded a.

java - NullPointerException in eclipse in Eclipse itself at PartServiceImpl.internalFixContext -

i have problem eclipse ide, can't open file in work space; if try open file, eclipse alert following error dialog "an error has occurred. see error log more details. java.lang.nullpointerexception" i go see .log file in .meta @ workspace , see paragraph in file this: !entry org.eclipse.jface 4 2 2557-04-09 11:40:49.422 !message problems occurred when invoking code plug-in: "org.eclipse.jface". !stack 0 java.lang.nullpointerexception @ org.eclipse.e4.ui.internal.workbench.partserviceimpl.internalfixcontext(partserviceimpl.java:380) @ org.eclipse.e4.ui.internal.workbench.partserviceimpl.bringtotop(partserviceimpl.java:341) @ org.eclipse.e4.ui.internal.workbench.partserviceimpl.showpart(partserviceimpl.java:1029) @ org.eclipse.ui.internal.workbenchpage.busyopeneditor(workbenchpage.java:3047) @ org.eclipse.ui.internal.workbenchpage.access$22(workbenchpage.java:2969) @ org.eclipse.ui.internal.workbenchpage$8.run(workbenchpage.java:29...