How can I retrieve an attachment in a Cloudant database with Delphi?

delphi
Question: I have successfully created a Bluemix Cloudant document and did Put an attachment to that doc with a Delphi program. I'm also able to retrieve that attachment via a BAT-file, but I should like to do it with Delphi 2009. I get a HTTP/1.1 200 OK response, I don't know where to get the attachment The code:program httpsGet; {$R *.res} {$APPTYPE CONSOLE} uses IdHTTP, IdSSLOpenSSL, IdGlobal, SysUtils,IniFiles, Classes; var HTTP: TIdHTTP; RequestBody: TStream; ResponseBody: string; LHandler: TIdSSLIOHandlerSocketOpenSSL; json: string; F: textfile; s: string; id,rev: string; Dir,user,password,mapp,butik: string; IniFile: TInifile; a,i,x,Antdocs: integer; begin // Read ini-file and get user / password Dir:=ExtractFilePath(ParamStr(0)); IniFile:=TIniFile.create(Dir + 'Credentials.ini'); user:=IniFile.Readstring('Credentials','User',''); password:=IniFile.Readstring('Credentials','Password',''); IniFile.Destroy; id:='02d42fc7c5966b2ab7d27a3c9942a77e'; rev:='2-904b6ca2f8883e35b931d138acc969c6'; json:='{ "selector": {"_id":"' + id + '"}, "fields": "_attachment" } '; HTTP := TIdHTTP.Create; try try RequestBody := TStringStream.Create(json, TEncoding.UTF8);…
Read More

How can i remove the category description from the nav item’s title attribute

Uncategorized
Question: I am currently working on the site https://barwareandmore.com.au, If you click on any item from the left hand nav bar, then hover your mouse over another item, you can see that the link's title attribute contains that category's description. This code is also reflected in the source code for all pages (thus making duplicate content) Is there a way i can remove the title attribute from these links? or set them to be the value of nothing? i am using the DaVinci Theme Sorry i can't be more specific, still a rookie at wordpress, Thanks for any help/advice/suggestions :] Answer: I hope this will help you out if you just want to remove the title attribute if your side navigation are set in menu section. http://www.wpbeginner.com/wp-tutorials/how-to-add-title-attribute-in-wordpress-navigation-menus/ Let me know…
Read More

Lambdization of a range loop

Uncategorized
Question: for k := range SomeArray { func(i int) { v := SomeArray[i] ... }(k) } I have seen such piece of code in one library, why would anyone want to do this? Why not just for i := range or for i, v := range? My guess was they wanted to use defer inside the lambda, but no, there is no defer statement in it. Answer: Read more
Read More

Vivid – Digital Media Agency One page HTML template

Uncategorized
Vivid is an HTML Template, great for the creative ones, be it your agency, your app landing page, business, portfolio or blog, it is meant for the people that want more from an HTML template, for Creative agency’s or graphic designers that want to use this design for a certain content platform, for people that have basic knowledge of HTML/CSS or even for a grandma who wants to promote her new line of Jams and Preservatives.
Read More

ZingChart: handle label and legend with no data

Uncategorized
Question: In my zingCahrt i want to handle a case where data is missing, so i'm using "no-data". It's working but label of chart and legend is still displaying on screen. So how can i remove legend and text of label when there is not data? "no-data":{ text:"No data" }, labels:[ { "text":"Failed tests" } ], legend: { mediaRules: [{ maxWidth: 300, marginTop: 50, layout: 'h', align: 'center' }] } Thanks in advance. Answer: Read more
Read More

How to properly test a Spring Boot using Mockito

java
Question: I never did a test and decided I would do my first. I am using Spring Boot and by default the layout is as follows: https://zapodaj.net/c8b65f1644e95.png.html The file that is created on startup looks like this @RunWith(SpringRunner.class) @SpringBootTest public class RestWebServicesApplicationTests { @Test public void contextLoads() { } } I do not change anything here, because I do not need it. By contrast, I created a new class public class CheckUserDataRestControllerTest { @Mock private UserService userService; @InjectMocks private CheckUserDataRestController checkUserDataRestController; private MockMvc mockMvc; @Before public void setup() { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(checkUserDataRestController).build(); } @Test public void textExistsUsername() throws Exception { mockMvc .perform(get("/checkUsernameAtRegistering") .param("username", "jonki97")) .andExpect(status().isOk()); } } To test the controller method, which should return the status OK. @GetMapping("/checkUsernameAtRegistering") public HttpEntity checkUsernameAtRegistering(@RequestParam String username) { return ResponseEntity.ok().body(!userService.existsByUsername(username)); } However,…
Read More

Eclipse – E4: Removing a Placeholder in a non-active perspective grabs control from active perspective

Uncategorized
Question: I've tried to place may concern in an eclipse forum weeks ago, but got no response. Maybe they are on holiday or the forum has already started its process of dying in order to find a new conversation platform. Nevertheless... Now to my little big problem while developing on e4 rcp. I've got a little issue with those MPlaceholders. What I'm trying to archive is, to remove every placeholder (one per perspective) referencing the same MPart, when closing any placeholder. In order to realize this I've hijacked the EPartService method 'hidePart(MPart, boolean)' to remove the placeholders and finally to remove the part from windows.sharedElements. Everything works fine with one exception. When closing a placeholder in a non-active perspective, its parent partstack activates a different part and grabs the control…
Read More

ReadOnlyCollection property underlying Collection is modified while iterating

Uncategorized
Question: I have the following property:private static Collection _loadedAssemblies = new Collection(); internal static ReadOnlyCollection LoadedAssemblies { get { return new ReadOnlyCollection(_loadedAssemblies); } } In another class I loop through LoadedAssemblies foreach (Assembly assembly in ResourceLoader.LoadedAssemblies) While looping through the assemblies the underlying collection (_loadedAssemblies) changes sometimes which gives a System.InvalidOperationException. What is the preferred way to make LoadedAssemblies safe? I cannot reproduce the problem so I can't just try it. Is it okay to do? internal static ReadOnlyCollection LoadedAssemblies { get { return new ReadOnlyCollection(_loadedAssemblies.ToList()); } } Edit public static void Initialize() { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { AddAssembly(assembly); } AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyLoad += OnAssemblyLoad; } private static void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args) { AddAssembly(args.LoadedAssembly); } private static void AddAssembly(Assembly assembly) { AssemblyName assemblyName = new…
Read More