Posts

Featured post

Proper way to return a string in C -

i have following code: char* get_address_string(package* pkg){ char *c; sprintf(c, "%02x:%02x:%02x:%02x:%02x:%02x", pkg->address[0], pkg->address[1], pkg->address[2], pkg->address[3], pkg->address[4], pkg->address[5]); return c; } the code works fine. however, know not proper way return string in c. receiving warning "c used uninitialized in function". what proper way write function in c? c pointer, no memory allocated. return value ok, that's how can done in c. but need allocate memory.

elixir - "dialyzer: Analysis failed with error.." (dialyzer bug? or wrong use of map-type?) -

working on simple application in progress of learning elixir, ran minor roadblock when checking types dialyzer. running dialyzer on code results in analysis failed error... far dialyzer has given me warnings , not errors when violate type spec's, have no clue error about. trying narrow down problem, made ultra simple function performs offending return value. @spec blabla(integer) :: %{atom => any} def blabla(1) %{:error => 'wrong input (us-state)'} end def blabla(2) %{ location: 'new york city, central park, ny', temp_c: '23.3', visibility_mi: '10.00', weather: 'a few clouds', wind_dir: 'north', wind_kt: '0' } end when running dialyzer on following error proceeding analysis... =error report==== 14-jul-2015::17:26:55 === error in process <0.31.0> exit value: {function_clause,[{erl_types,t_form_to_string,[{type,12,map_field_assoc,{type,12,atom,[]},{type,12,any,[]}}],[{

go - syntax error: unexpected name, expecting semicolon or newline -

i don't understand why code has syntax error. package main import ( "fmt" "os/exec" "time" ) func ping(curl_out string) endtime int64 { try_curl := exec.command("curl", "localhost:8500/v1/catalog/nodes") try_curl_out := try_curl.output() try_curl_out == curl_out { try_curl := exec.command("curl", "localhost:8500/v1/catalog/nodes") try_curl_out := try_curl.output() } endtime := time.now().unix() return endtime } func main() { run_container := exec.command("docker", "run", "-p", "8400:8400", "-p", "8500:8500", "-p", "8600:53/udp", "-h", "node1", "progrium/consul", "-server", "-bootstrap") container_id, err := run_container.output() if err != nil { fmt.println(err) return } run_curl := exec.co

php - the curl link is not sent -

create message function not working form execute need go sms api link , not getting called please me fix this <?php include_once('inc/class.simple_mail.php'); include_once('inc/gump.class.php'); include_once('mail-config.php'); // check data $isvalid = gump::is_valid($_post, array( 'first-name' => 'required', 'last-name' => 'required', 'phone-number' => 'required', 'email-address' => 'required|valid_email', 'address' => 'required', 'city' => 'required', 'zip-code' => 'required', )); if($isvalid === true) { // submit mail $mail = new simplemail(); $mail->setto(your_email_address, your_company_name) ->setsubject('new car rental request') ->setfrom(htmlspecialchars($_post['email-address']), htmlspecialchars($_post['first-name'].' '.

java - Wrong 2nd argument type found 'com.technology.computer.mit.ctechmit.Menu_pageFragment' required 'Android.app.Fragment' -

i have written code fragment replacement on click of send button. code shows error saying wrong 2nd argument type found 'com.technology.computer.mit.ctechmit.menu_pagefragment' required 'android.app.fragment' in below line under word 'newfragment' transaction.replace(r.id.fragment_container, newfragment); when searched solution online says extend fragmentactivity instead of extending fragment. if home_activity (one has no errors) shows many errors. can please suggest me solution this? below home_pagefragment in sendmessage method replaces menu_pagefragment on click of send method in layout: package com.technology.computer.mit.ctechmit; import android.app.fragmenttransaction; import android.support.v4.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; /** * placeholder fragment containing simple view. */ public class home_pagefragment extends fragment { pu

SAP BPC EPM dynamic table member -

Image
i'm quiet new bpc , struggle right looking easy. have table splitted in 3 parts. in first 2 data coming cube in 3rd part (in red), data calculated excel formulas formula of cell d33 :(=d26 - d40) .... work long dimension doesn't move, if add new member formualas , number shifted , don't match anymore.. solution solve , stay dynamic ? tried several option epmformattingsheet , excel formulas, local member , formulas :((( has idea on how solve ? thank e. local members formulas should work case

Private Variables vs Properties in C# -

this question has answer here: why use private members use public properties set them? 5 answers why use simple properties instead of fields in c#? [duplicate] 5 answers i teaching myself c# , curious need declaring private member variables accessed public properties. textbook i'm using says sake of encapsulation, why need private variables begin if properties can changed depending on 'get' or 'set' functions? here's example: namespace practice { struct person { private int id; private string name; public int id { {return id;} set {id = value;} } public string name { get; set; } public int age { get; set; } } class program { static void main(string[] args) { pers