Posts

delphi - Firemonkey: How can I detect the X position of a character in a memo -

i'm trying develop method justify text in memo/label. need take x position of character. possible? if not, how can justify texts in firemonkey? know possible on desktop using vlc library, found nothing firemonkey. i haven't found getting x coords of chars. can create array of widths of characters font , make method count absolute x , y of characters, this: for y := 0 memo.lines.count - 1 x := 0 memo.lines[y].length - 1 begin absolutex := absolutex + charwidths[memo.lines[y][x]]; absolutey := absolutey + charheights[memo.lines[y][x]]; // careful, crossplatform using should use copy(), not string[n] end; for text align can use this(for label have vertextalign) memo.textalign := ttextalign.trailing; // right justify memo.textalign := ttextalign.center; // center justify memo.textalign := ttextalign.leading; // default left justify

php - Dynamic href when generating buttons? -

i have table displaying data user , each row in table has unique id, in table generating button each row more information on content in row. however, need generate unique href each button based on unique id of data in row. way have done it correctly goes link in href without passing unique id. <tbody> <?php while($row = $query->fetch()) { ?> <tr> <td><?php echo $row['car_id']; ?></td> <td><?php echo $row['car_make']; ?></td> <td><?php echo $row['car_model']; ?></td> <td><?php echo $row['number_available']; ?></td> <td><?php echo $row['rent_cost_per_day']; ?></td> <td><a class="btn btn-default" href="cars.php?"<?php $row['car_id']; ?>>view</a></td> </tr> <?php } ?> </tbody> an...

excel - Export Google sheet as xlsx to company network drive -

this function triggered when sheet changed. function exportasxlsx() { var spreadsheet = spreadsheetapp.getactivespreadsheet(); var spreadsheetid = spreadsheet.getid() var file = drive.files.get(spreadsheetid); var url = file.exportlinks[mimetype.microsoft_excel]; var token = scriptapp.getoauthtoken(); var response = urlfetchapp.fetch(url, { headers: { 'authorization': 'bearer ' + token } }); var blobs = response.getblob(); var folder = driveapp.getfoldersbyname('\\gbc1234.fs1.util.xxint.com\shared\projects\test_google2excel'); if(folder.hasnext()) { var existingplan1 = driveapp.getfilesbyname('testgoogle2excel.xlsx'); if(existingplan1.hasnext()){ var existingplan2 = existingplan1.next(); var existingplanid = existingplan2.getid(); drive.files.remove(existingplanid); } } else { folder = driveapp.createfolder('\\gbc1234.fs1.util.xxint.com\shared\projects\test_google2exc...

mongodb - Create unique indexes for document's objects stored in an array -

how 1 create unique indexes document's objects stored in array? { _id: 'documentid', books: [ { unique_id: 1, title: 'asd', }, { unique_id: 2, title: 'wsad', } ... ] } one thing can think of autoincrementing. or there mongo way so? if remove _id field doc, mongo automatically add 1 you, is: guaranteed unique contains timestamp of creation lots of other features. see here: https://docs.mongodb.com/v3.2/reference/method/objectid/ looking @ example object again, referring ids in books array? if so, can assign them objectids well, in document root's _id field: doc.books.foreach(x => { x.unique_id = new objectid() } );

java - Android take multiple photos and return them in a list with delete button -

Image
i working on app have choose 2 values spinner, give them description , take photo (which multiple photos). have simple app needs changes. when press take photo button go camera activity, , after accepting taken photo automatically send photo sever instead return previous activity , see taken photo in list view (under description in main activity) , have possibility remove photo list view. want send data (and photos) after pressing send button. can suggest me guys how possible or links similar examples? have searched not find this. thank you! here java code: oncreateview() @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { db = new sqlitehandler(getactivity().getapplicationcontext()); db.deletezones(); db.deletepoints(); //adding zones database try { new addzonestodatabase().execute().get(); } catch (interruptedexception e) { e.prints...

c# - Why is there no built-in type for DateTime? -

this question has answer here: why there no “date” shorthand of system.datetime in c#? 3 answers most common datatypes have built in type: int32 has int , boolean has bool , string has string , etc. why there no built-in type datetime? first thought it's because datetime has properties , public functions, int . can shed light on this? what's criteria type have built-in equivalent? the clr defines basic building blocks: minimal data types necessary define others. types given alias. since datetime collection of longs , integers, packed in struct, there no need create new data type in clr it. can build data types defined in clr. no need aliasing it.

c++ - c# udpClient sent packets don't exist the router -

using following code: udpclient sender = new udpclient(); try { sender.send(encoding.ascii.getbytes(msgout), msgout.length, ip); } i trying send reply previous request same ip/port. while working on same computer, work if customize values localhost, not work when state own computer ip in nat. 2 facts it: 1) same ip/port values work fine on c++ version of it. (even across globe) next code: sockaddr_in si_custom; int s_custom; //create socket if ((s_custom = socket(af_inet, sock_dgram, ipproto_udp)) == socket_error) { //socket fail return false; } //setup address structure memset((char *)&si_custom, 0, sizeof(si_custom)); si_custom.sin_family = af_inet; si_custom.sin_port = htons(stoi(port)); si_custom.sin_addr.s_un.s_addr = inet_addr(ip.c_str()); //send message if (sendto(s, msg.c_str(), msg.size(), 0, (struct sockaddr *) &si_custom, slen) == socket_error) { closesocket(s_custom); return false; } closesocket(s_...