This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Controller | |
| public class ApiDocInfo { | |
| private final RequestMappingHandlerMapping handlerMapping; | |
| @Autowired | |
| public System(RequestMappingHandlerMapping handlerMapping) { | |
| this.handlerMapping = handlerMapping; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RequestMapping(value = "/image/{id}", method = RequestMethod.GET) | |
| public void findImage(@PathVariable("id") String id, HttpServletResponse resp){ | |
| final Foto anafoto = <find object> | |
| resp.reset(); | |
| resp.setContentType(MediaType.IMAGE_JPEG_VALUE); | |
| resp.setContentLength(anafoto.getImage().length); | |
| final BufferedInputStream in = new BufferedInputStream(new ByteArrayInputStream(anafoto.getImageInBytes())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ExampleLog4J implements RestAdapter.Log { | |
| private static final Logger logger = logger.getLogger(ExampleLogger.class) | |
| ExampleLog4J(){ } | |
| @Override | |
| public void log(String message) { | |
| log.info("Retrofit# "+message); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //V 0.1 | |
| // Marco Berri | |
| //[email protected] http://tecnicume.blogspot.com | |
| function compactCollections(dbName){ | |
| var dbToCompact = db.getSisterDB(dbName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use test; | |
| var coll = db.events; | |
| var coll_new = db.events_new; | |
| var cursor = coll.find(); | |
| cursor.forEach(function(doc) { | |
| delete doc._id; | |
| coll_new.save(doc); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dbs_list = db.getMongo().getDBNames(); | |
| for(var d in dbs_list){ | |
| var name = dbs_list[d]; | |
| if(name == 'admin') | |
| continue; | |
| if(name == 'local') | |
| continue; | |
| dbOne = db.getSisterDB(name); | |
| dbOne.setProfilingLevel(0); | |
| dbOne.system.profile.drop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dbs_list = db.getMongo().getDBNames(); | |
| for(var d in dbs_list){ | |
| var name = dbs_list[d]; | |
| if(name == 'admin' || name == 'local') | |
| continue; | |
| dbOne = db.getSisterDB(name); | |
| print("dbname -->" + name); | |
| var cursor = dbOne.system.profile.find( { op:"query", millis : { $gte : 5 },ns : { $ne : (name + '.system.profile') } },{ ts:1,millis:1, nscanned:1, nreturned:1, ns:1, query:1} ).sort({ts:-1}).limit(5); | |
| cursor.forEach(function(r) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*** | |
| data example | |
| { "_id" : ObjectId("5554dc1a4e047bc09c427420"), "ts" : ISODate("2015-05-13T23:24:03Z"), "RC" : 6 } | |
| { "_id" : ObjectId("5554dc1a4e047bc09c427421"), "ts" : ISODate("2015-05-13T23:25:03Z"), "RC" : 6 } | |
| get different from RC prev and act record and write a new collection in upsert | |
| Data from La Crosse ws1640 increment Rain Counter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*** | |
| Extract max a min data from rawtable of extracting data from La crosse WS1640 | |
| project: http://meteo.marcoberri.it | |
| **/ | |
| var dbOne = db.getSisterDB('mbmeteolacrosse'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bytesToSize = function(bytes, precision) { | |
| var kilobyte = 1024; | |
| var megabyte = kilobyte * 1024; | |
| var gigabyte = megabyte * 1024; | |
| var terabyte = gigabyte * 1024; | |
| if ((bytes >= 0) && (bytes < kilobyte)) { | |
| return bytes + ' B'; | |
| } else if ((bytes >= kilobyte) && (bytes < megabyte)) { |
OlderNewer