Posts

Showing posts from January, 2014

python - Area of polygon calculation inconsistent -

Image
i using voronoi_finite_polygons_2d(vor, radius=none) function found elsewhere on stackoverflow . want modify show centroid of each voronoi cell . debugging why centroids appear dramatically wrong (see green arror pointing out centroid way off in weeds). first error identified: of calculations weren't processing vertices in proper all-clockwise or all-counterclockwise order. not sure why points don't sorted correctly, before investigate that, found anomaly. i should same area (with opposite sign) if go clockwise or counterclockwise. in simple examples, do. in random polygon made, /slightly/ different results. import numpy np import matplotlib.pyplot plt scipy.spatial import voronoi import random import math def measure_polygon(vertices): xs = vertices[:,0] ys = vertices[:,1] xs = np.append(xs,xs[0]) ys = np.append(ys,ys[0]) #https://en.wikipedia.org/wiki/centroid#centroid_of_polygon area = sum(xs[i]*(ys[i+1]-ys[i-1]) in range(0, le...

aurelia - Process custom elements specified in returned json -

i have custom aurelia can invoked like test this works fine using in html page in site. however, have restful services return html these custom elements. use html content in aurelia site. @ point custom elements won't execute. there way tell aurelia process custom elements in returned html before display ? thanks you use combination of <compose> , inlineviewstrategy . gist demo: https://gist.run/?id=bd1122986ba8dabde8111c3b4ab6df6f the main idea here have custom component, able use html extracted returned json result. inlineviewstrategy , it's possible full-featured template parser on-the-fly , feed <compose> it. way chunk of html treated other part of application. can contain other custom elements well. custom element basically, it's extended <compose> , view bindable property accepts string variable instead of view path. part.html <template> <compose view.bind="viewstrategy" model.bind="mode...

python - Queries on large number of small sets and lists -

i need calculations on triangular/tetrahedral meshes in 2 , 3 dimensions. tasks following arise: given list of vertices v , list of 3-tuples t indexing v. each vertex v in v, find indices of 3-tuples in t referring v. interpreting t triangulation 3-tuples triangles, find 2-tuples representing edges between vertices of triangulation. for each of edges, find index of triangles indcident it. (also in 3d 4-tuples , polyhedrons instead of triangles.) i think done list comprehensions, extremely worry performance when scaling 100'000s or 1'000'000s of triangles. had scipy's graph library, that's rather finding paths in graph , stuff. i wonder whether python offers functions it, or how problem named in order start search.

sql - How to build query? Any idea? -

3 tables: mark table: student_id sa_id marks 1 1 75 1 2 80 1 3 100 2 4 85 2 5 90 2 6 60 course table: course_code sat_id name_code aaa 100 1 midterm1 aaa 100 2 midterm2 aaa 100 3 final bbb 200 4 midterm1 bbb 200 5 midterm2 bbb 200 6 final transform table: sa_id sat_id 1 1 2 2 3 3 4 4 5 5 6 6 select course.course_code, mark.marks mark left outer join transform on transform.sa_id = mark.sa_id left outer join course on course.sat_id = transfrom.sat_id course.name_code = 'midterm1' at above query midterm1 result, can extract mid2 , final select mark.student_id,course.course_code, mark.marks, course.name_code mark left outer join transform on transform.sa_id = mark.sa_id left outer join course...

What is a null statement in C? -

i want know exactly, null statement in c programming language? , explain typical use of it. i found following segment of code. for (j=6; j>0; j++) ; and for (j=6; j>0; j++) from msdn page: the "null statement" expression statement expression missing. useful when syntax of language calls statement no expression evaluation. consists of semicolon. null statements commonly used placeholders in iteration statements or statements on place labels @ end of compound statements or functions. know more: https://msdn.microsoft.com/en-us/library/1zea45ac.aspx and explain typical use of it. when want find index of first occurrence of character in string int a[50] = "lord of rings"; int i; for(i = 0; a[i] != 't'; i++) ;//null statement //as no operation required

java - Spring Cloud Stream send to Kafka error control handling -

how catch error writing kafka topic? import org.springframework.cloud.stream.annotation.enablebinding; import org.springframework.cloud.stream.annotation.streamlistener; import org.springframework.cloud.stream.messaging.processor; import org.springframework.messaging.message; import org.springframework.messaging.handler.annotation.sendto; import org.springframework.stereotype.component; import javax.xml.bind.jaxbexception; @component @enablebinding(processor.class) public class parser { @streamlistener(processor.input) @sendto(processor.output) public string process(message<?> input) { // smth // how catch error if sending message 'output' topic fails } } switch producer synchronous mode. spring.cloud.stream.kafka.bindings.output.producer.sync=true what next? examples? extend binding impl, add aop magic? i think need register kafkaproducerlistener handles error scenario in case , make available bean in applicatio...

google cloud messaging - can't receive message gcm android below lollipop -

i'm not able receive gcm messages on devices running android below lollipop. push messages works on android 5, 6 , 7. don't know why ... there app code: manifest: <uses-sdk android:minsdkversion="19" android:targetsdkversion="25"/> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.internet" /> <permission android:name="sbntt.android.xenoss.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="sbntt.android.xenoss.permission.c2d_message" /> <application android:name="android.support.multidex.multidexapplication" android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <rec...

sass - PhpStorm ruby.exe: invalid option --no-cache (-h will show valid options) (RuntimeError) -

i want use file watcher scss actions. phpstorm giving me error. c:\ruby22\bin\ruby.exe: invalid option --no-cache (-h show valid options) (runtimeerror) path added while installing ruby. checked path , same destination of ruby. i'm not find real solution issue. can me ?

php - RabbitMQ reject message when processing stops with error -

i using symfony , rabbitmq bundle application , encountered following issue: when consumer service throws uncaught exception/error (eg: out of memory), message republished , consumed again , again until gets either reject or ack signal. want change behavior message instead discarded if uncaught exception/error occurs first time message consumed. is possible and, if so, how? thanks! yes, have ack message. can either setting auto-ack flag true (depends on language/api/library using) or ack message manually/explicitly. it's normal ack message cannot processed because otherwise said message republished , consumed again , again . if want can set requeue false . don't use php dealing rabbitmq don't know api equivalent, where/how nack implemented - in case (not requeing is) may idea configure dead letter exchange (quote link): messages queue can 'dead-lettered'; is, republished exchange when of following events occur: the message rejected (...

Accessing data from JSON in PHP -

this question has answer here: how extract data json php? 2 answers i having difficulty getting data json. i after doing foreach() json formatted data api, cant work. here code: the $player_runes database variable, works totally fine, problem getting data of runeid each array (pages) foreach($player_runes->pages $statplayerrunesfor){ $statplayerrunesforune0 = $statplayerrunesfor->slots->runeid; echo $statplayerrunesforune0; } here json data: { "29161162": { "summonerid": 29161162, "pages": [ { "id": 24193964, "name": "nida", "current": false, "slots": [ { "runeslotid": 1, "runeid": 5273 }, { "runeslotid": 2, "runeid": 5273 }, { "runes...

android - How to make the content of a grid layout stay inside the screen -

Image
i'm developing app, have 100 buttons. , want put buttons inside screen. i'm using gridlayout buttons inside problem having buttons getting out of screen. this code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/content_main" android:layout_width="fill_parent" android:layout_height="fill_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".mainactivity" tools:showin="@layout/app_bar_main" android:layout_column="1"> <gridlayout android:id="@+id/gridlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnco...

javascript - Why does canvas's drawImage scale inconsistently? -

i'm rendering image canvas. after reading drawimage mdn api , looks following 2 lines of code should produce same result: var ctx = canvas.getcontext('2d'); ctx.drawimage(this.image, 0, 0, this.image.width, this.image.height, 0, 0, this.clip.width, this.clip.height); ctx.drawimage(this.image, 0, 0, this.clip.width, this.clip.height); but don't! , can't figure out why. first 1 scales image fill this.clip , expect. second doesn't seem scale mater this.clip is, , image seems go outside of own bounds. now, image generated in javascript, there way have screwed image creation such happen? if helps. below code use make image. this.image = new image(this.getsize()[0],this.getsize()[1]); //this.getsize() = [32, 42, 40]; var c = document.createelement('canvas'); var ctx = c.getcontext('2d'); var pixels = ctx.createimagedata(this.image.width, this.image.height); (var x = 0; x < this.image.width; x...

data structures - stack and queues using doubly linked list in java -

i have problems code. read file in code , build 1 stack , 1 queues structure. code wasn't run correctly. this node class used double linkedlist public class node { string data; node next; node prev; public node(string data,node next, node prev){ this.next=next; this.data=data; this.prev=prev; } public node(){ } public string getdata(){ return data; } public void setdata(string data){ this.data=data; } public node getnext(){ return next; } public void setnext(node next){ this.next=next; } public node getprev(){ return prev; } public void setprev(node prev){ this.prev=prev; } } ** stack class. ** public class stack { node head = null; node tail = null; int size=0; public int getsize() { return size; } public boolean isempty() { return head == null; } public void push(string data) { tail = head; head = new node(data,null,null); head.data=data; head.next= ...

php - Output to Local Time - Convert MySQL to MySQLi Function -

the following converts mysql stored date uk time daylight savings. i'm trying mysqli equivalent? date_default_timezone_set('europe/london'); mysql_query("set time_zone = '".date('p')."';"); here simple example find on w3c <?php $con=mysqli_connect("localhost","my_user","my_password","my_db"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } // perform queries mysqli_query($con,"select * persons"); mysqli_query($con,"insert persons (firstname,lastname,age) values ('glenn','quagmire',33)"); mysqli_close($con); ?> google friend. ; ) for date format, it's still php , mysql, nothing worry mysqli hope helps.

string - Adding to a Python Dictionary -

def countfrequency(l): fdict = {} x in range(0, len(l)): key, value in fdict: if l[x] == fdict[str(x)]: value = value + 1 else: fdict[l[x]] = 1 return fdict i'm trying count frequency of occurrences of particular symbol in given string , create dictionary out of this. reason, function returns empty dictionary. think problem arises adding new value dictionary, not sure how troubleshoot it/fix it. input: countfrequency('mississippi') output: {} do this: def countfrequency(l): fdict = {} x in range(0, len(l)): if str(l[x]) in fdict.keys(): fdict[str(l[x])] = fdict[str(l[x])] + 1 else: fdict[str(l[x])] = 1 return fdict

ruby - Finding palindromes by adding its reversed to itself through x to y doing only depth number of calculation -

i'm having trouble doing challenge in ruby palindromes. i looked many sources , think brain melted bit novice programmer. lemme sum question : so user beginning value ending value, , depth value.we take beginning value , check if number palindrome ,if isn't add reversed itself ( 20, reverse(20)=02, add , 22) , check number find if palindrome.if isn't take calculated number , add reversed itself .but can "depth" value times. , print if find palindrome through calculations print value ----> xxxx if not print value ----> special number. i'm able find palindromes, through given , ending value.but cant implement depth thing.my problem looks lot setting limit on loops , calculating palindromes in c programming since i'm ruby novice cant make sense of c now.any appreciated. edit : x y , beginning value ending value, if type 20 beginning , 30 ending value, check 20 if palindrome add reversed etc.once finish checking check next number, 21 22...

android - Passing string in stdin -

i want create avd (android virtual device) through command line in python. that, need pass string n stdin. have tried following emulator_create = str(subprocess.check_output([android,'create', 'avd', '-n', emulator_name, '-t', target_id, '-b', abi],stdin=pipe)) emulator_create.communicate("n") but raises following error raise calledprocesserror(retcode, cmd, output=output) subprocess.calledprocesserror: command '['/home/fahim/android/sdk/tools/android', 'create', 'avd', '-n', 'samsung_1', '-t', '5', '-b', 'android-tv/x86']' returned non-zero exit status 1 process finished exit code 1 what can do? there's not working example. subprocess.check_output() returns output child process want execute, not handle process. in other words string object (or maybe bytes object) cannot use manipulate child process. probably happens script, us...

asp.net - Programs to inspect web pages -

i have .aspx page has bunch of dialogs , in 1 exact dialog there many lines - info people. want info, first of should understand, how info loaded server. right i'm trying achieve aim using chrome inspector, it's not convenient. maybe there exists software allows inspect web pages (at least pages .apsx)

r - How to create a factor variable from values from two other columns -

i want add new categorical variable based on values 2 other columns. in example below, want create new variable "simple" using semester , gender info. semester gender score simple 01 f 152 f_01 02 m 190 m_02 can dplyr? cheers in tidyr , there unite concatenate columns library(tidyr) school_info %>% unite(simple, gender, semester, remove=false) # simple semester gender score #1 f_01 01 f 152 #2 m_02 02 m 190

arduino - RFID-RC522 not reading card -

i have rfid-rc522 (mf-rc522) module , i'm using arduino sketch program. have downloaded example code: /* * -------------------------------------------------------------------------------------------------------------------- * example sketch/program showing how read data picc serial. * -------------------------------------------------------------------------------------------------------------------- * mfrc522 library example; further details , other examples see: https://github.com/miguelbalboa/rfid * * example sketch/program showing how read data picc (that is: rfid tag or card) using mfrc522 based rfid * reader on arduino spi interface. * * when arduino , mfrc522 module connected (see pin layout below), load sketch arduino ide * verify/compile , upload it. see output: use tools, serial monitor of ide (hit ctrl+shft+m). when * present picc (that is: rfid tag or card) @ reading distance of mfrc522 reader/pcd, serial output * show id/uid, type , data blocks can r...

Static nested resource params name on Rails routes -

i'm playing on rails routing can't figure out how manage this. problem @ user_posts(1) , user(4) routes, params have different names - id , user_id what i'm trying achieve static param name same resource. i have route file rails.application.routes.draw shallow resources :users, module: :users, only: [:index, :show] resources :posts, module: :posts, only: [:index, :show] end end end the routes generated are user_posts(1) /users/:user_id/posts(.:format) users/posts/posts#index post(2) /posts/:id(.:format) users/posts/posts#show users(3) /users(.:format) users/users#index user(4) /users/:id(.:format) users/users#show i tried resources :user param: :user generated route @ user_posts /users/:user_user_id/posts is possible achieve :user_id param , :post_id param every route using resources ? try this resources :users, param: :user_id reso...

how to issue sudo command using python -

i need issue "sudo service nginx status" check service status. have following: import commands service output = commands.getoutput("sudo service nginx status") but getting "no tty present , no askpass program specified" does understand this? using commands.getoutput makes impossible provide user input required sudo command. name self explainable, interested in command output. stdin closed. there several solutions this: turn off password verification sudo user launching python script. (read /etc/sudoers) pipe password: (unsafe/bad solution easy) "echo yourpass | sudo ..." check out subprocess.popen allowing provide input either console or file https://docs.python.org/2/library/subprocess.html#popen-constructor

javascript - Video.js changing source, but does not show new source -

sorry lack of knowledge on topic i have script changes source of video player. , that. problem video.js player plays first source assigned it. document.getelementbyid("vid-player_html5_api").innerhtml = ""; document.getelementbyid("vid-player_html5_api").innerhtml = "<source src='" + link + "' type='video/mp4'>"; document.getelementbyid("vid-player_html5_api").muted = false; so if there 2 buttons, , clicked button 1 change source of player , show correct video. lets clicked button 2 change source of player, but still show same video showed button 1 it proven changes source, checked chrome dev tools , surely enough changed source how fix this? you can try below, function playvideo(videosource, type) { var videoelm = document.getelementbyid('testvideo'); var videosourceelm = document.getelementbyid('testvideosource'); if (!videoelm.paused) { ...

CSS - Add Color to Black & White PNG Image Using a Filter -

everybody. is possible in css add color black & white image using filter? i'm talking using filters it's possible in photoshop, , better example ones in microsoft powerpoint. what i'm trying this: have image file of black icon. want add filter such in image (the background transparent) have color choose using filter, such i'd able have icon in whatever color want. said in title, it's png image, far know, can't use svg filters. how can this? i'm trying write theme website using original icons, , i'm stuck on this. update: want use original png images. i'm not going replace them svgs, or pre-edited pngs. thanks lot in advance! you can css filters, though wouldn’t recommend @ all: .colorizable { filter: /* demonstration purposes; originals not entirely black */ contrast(1000%) /* black white */ invert(100%) /* white off-white */ sepia(100%) /* off-white ...

Rails: command line not finish when create second model -

Image
i tring create new rails app , generate models first, when try use rails g model category name:string command, finishes normally. but, when generate model using rails g model product name:string , command not finish. have press ctrl + c finish it. happened today, how solve problem?

node.js - Sequelize query multiple times -

i'm trying improve search on website, how looks (i use nodejs, sequelize , postgresql): db.food.findall({ where: { namefood: { $ilike: '%' + queryname + '%' } } }).then(function (foods) { foods.sort(comparefood); res.json(foods); }, function (e) { res.status(500).send(); }); i think pretty self explanatory, if isn't clear ask me on comments. now, search algorithm takes consideration whole parameter, searching "chicken eggs" return nothing since on database they're saved "eggs". my idea quick improvement split query looking spaces , query each keyword, like: var keywords = queryname.split(' '); with have keywords, how can query variable number of times , join result in array returned 1 in foods? i checked documentation , questions in here couldn't find anything, appreciated, thank much. you can use $or proper...

Trying to use python 2.7 when 3.5 is default -

currently can use py2.7 using terminal alias. problem when try , run script, depends on module requests . have tried pip install , download requests2.7 folder , sudo python setup.py install . though aliased python2.7, resulted in being downloaded python 3.5 site. installed /anaconda/lib/python3.5/site-packages/requests-2.7.0-py3.5.egg processing dependencies requests==2.7.0 finished processing dependencies requests==2.7.0 how can fix this? need run scripts 2.7 default seems 3.5.

Calling data from a mysqladmin table using php form -

one of pages, index.php references table within mysqladmin login credentials. each row within table different user. i've got work fine. once logs in, content of index.php changes based on content of user row. each account page goes index.php, content dependent on user login. my problem "refreshed" index.php page has form submit button doesn't work properly. form meant reference , call data table within same database. form action directed page, results.php. know data being called correctly because when enter results.php directly browser, can see entire table being called. obviously, i'll prevent happening later security reasons. however, when try results.php via form submit button, i'm redirected index.php (and logged out) rather results.php. it seems second form following protocol specific first form, , don't know why. i've made sure form buttons within form. i'm looking general guidance. i'm trying possible? this content of results.p...

java - How can I add exponent in my code -

import java.util.scanner; public class calculator { public static void main(string[] args ) { scanner userinput = new scanner(system.in); string operator; double num1,num2,answer = 0; system.out.println("enter first number: "); num1 = userinput.nextdouble(); system.out.println("enter operator: "); operator = userinput.next(); system.out.println("enter second number: "); num2 = userinput.nextdouble(); if (operator.equals ("+")){ answer = num1 + num2; } else if (operator.equals ("-")){ answer = num1 - num2; } else if (operator.equals ("*")){ answer = num1 * num2; } else if (operator.equals ("/")){ answer = num1 / num2; } system.out.println("first number:" + num1); system.out.println("operator:" + operator); ...

java - Greedy recursive search -

so trying implement groupsize method , helper functions. here 1 idea: set local set of spots hold spots you’ve found far in cluster. current spot-position, greedily add many direct neighbor spots possible. each neighbor spot newly-found, call recursively position. i lost how go , implement method , better explanation helper functions for. public class grid { private boolean[][] grid = null; /** * simple constructor * * @param ingrid * two-dimensional array of boolean used grid * search */ public grid(boolean[][] ingrid) { grid = ingrid; } /** * main method, creates grid, asks size of group * containing given point. */ public static void main(string[] args) { int = 0; int j = 0; // make sure we've got right number of arguments if (args.length != 2) { system.err.println("incorrect arguments."); printusage();...

Inserting an Image in google cloud storage using php api -

i trying setup storage in google cloud platform. kind of confused on do. i using following code. require_once("vendor/autoload.php"); use google\cloud\storage\storageclient; use google\cloud\storage\storageobject; use google\cloud\storage; $projectid = 'your_project_id'; $storage = new storageclient([ 'projectid' => 'xx', 'key'=> 'yy' ]); $file_name = "imagename"; $obj = new storageobject(); $obj->setname($file_name); $storage->objects->insert( "kmapsimage", $obj, ['name' => $file_name, 'data' => file_get_contents("https://kmapst.blob.core.windows.net/images/kmap581b939a7a28c.jpeg"),'mimetype' => 'image/jpeg'] ); on executing function following error. argument 1 passed google\cloud\storage\storageobject::__construct() must implement interface google\cloud\storage\connection\connectioninterface, n...

python - Socket.error: [Errno 10022] An invalid argument was supplied -

#!/usr/bin/env python import socket clientsocket = socket.socket(socket.af_inet, socket.sock_stream) clientsocket.connect(('192.168.1.123', 5162)) clientsocket.send('getval.1') clientsocket.close clientsocket.bind(('192.168.1.124', 5163)) clientsocket.listen(1) while true: connection, address=clientsocket.accept() value=connection.recv(1024) print value i'm trying python send message server, , in return server responds. yet when execute code gives me socket.error: [errno 10022] invalid argument supplied it seems wrote mixed code of server , client here simple sample of codes socket programming first on server side , second on client server side code: # server.py import socket import time # create socket object serversocket = socket.socket( socket.af_inet, socket.sock_stream) # local machine name host = socket.gethostname() port = 9999 ...

C - Mutex attributes -

can create , use 1 mutex attribute initialize multiple recursive mutexes? or have create 1 mutex attribute each mutex want create? following code correct? int err; int bufferlength = 10; pthread_mutexattr_t recursiveattr; pthread_mutex_t mutexes[bufferlength]; for(int index = 0; index < bufferlength; index++){ err = pthread_mutex_init(&mutexes[i], &recursiveattr); if(err != 0){ perror("error initializing mutex"); } } you can use same attribute object multiple mutexes. note however, pthread_mutexattr_t object you're using must initialized itself. initialize pthread_mutexattr_t must use pthread_mutexattr_init (and eventually, pthread_mutexattr_destroy ), both of should done once . current code makes no such calls, , should compliant.

r - Select grouped rows with at least one matching criterion -

i want select groupings contain @ least 1 of elements interested in. able creating intermediate array, looking simpler , faster. because actual data set has on 1m rows (and 20 columns) not sure whether have sufficient memory create intermediate array. more importantly, below method on original file takes lot of time. here's code , data: a) data dput(data_file) structure(list(group_id = c(123, 123, 123, 123, 234, 345, 444, 444), product_name = c("abcd", "efgh", "xyz1", "z123", "abcd", "efgh", "abcd", "abcd"), qty = c(2, 3, 4, 5, 6, 7, 8, 9)), .names = c("group_id", "product_name", "qty"), row.names = c(na, 8l), class = "data.frame") b) code: want select group_id has @ least 1 product_name = abcd #find out transactions data_t <- data_file %>% group_by(group_id) %>% dplyr::filter(product_name == "abcd") %>% ...

sql server - Remove space recursively in string -

i trying remove multiple white spaces table, contains 40+ columns string values in , 150k rows. using cursor, came following solution (as part of stored procedure populates table), not remove white spaces in single run. if run update statements alone manually multiple times, spaces removed completely. idea on how can clean data in single run? declare @col nvarchar(128) declare stringcol cusrsor select column_name information_schema.columns table_name = 'tablename' , data_type = 'varchar' open stringcol fetch next stringcol @col; while @@fetch_status = 0 begin update tablename set @col = ltrim(rtrim(replace(@col, ' ', ' '))) @col '% %' fetch next stringcol @col end close stringcol deallocate stringcol end if have sql server 2016 can use string_split or similar udf functions other versions. trick convert words columns, take non-space , bring them 1 value declare @col nvarcha...

Class to string method c++ -

first off, sorry bad formatting, still trying used this, here's question. have class endpoint bunch of strings, , class called package 2 endpoints , 2 doubles. .cpp file uses these 2 in these lines of code: endpoint homer{"homer simpson", "742 evergreen terrace", "springfield", "fl", "32401"}; endpoint donald{"donald duck", "1313 webfoot walk", "duckburg", "ca", "95501"}; endpoint kermit{"kermit frog", "on swamp", "leland", "ms", "38756"}; package regular{ homer, donald, 25.0, 0.20}; how make these mesh? main error having endpoint can't read class string package. appreciate can understand what's wrong. package.cpp #include "package.h" #include <iomanip> #include <stdexcept> #include <sstream> #include <string> using namespace std; package::package(endpoint sender, endpoint r...

zend framework2 - zf2 automated translation for dynamic strings -

i working on zf2 translation.i have added fields in database,i added translated string each field each language. but user can add field.suppose user in english local , added field in english language only,but later user accessed website , or knows spanish,in case user field previous user added should displayed in spanish language. so in case how manage dynamic field translation.can 1 me issue.

How to count the amount of times a specific character appears in an array in C? -

so trying count amount of times specific character occurs in program. example, if entered, abcda, want program print, "there 2 a's." code follows: int main(void) { char array[10000]; printf("enter input: \n"); scanf("%s", array); printf("array entered is: %s\n", array); char a; //variable want count char *k //used loop int a_counter; //number of times a, occurs fgets(array, sizeof(array), stdin); = fgetc(stdin); a_counter = 0; for(k = array; *k; k++) { if (*k == a) { a_counter++; } } printf("number of a's: %d\n", a_counter); return 0; } the following loop found on forum attempted count specific character can not seem mine work. approach @ wrong? out of main confused on how so. appreciate given. thank you. new attempt @ count loop not working. got rid of fgets because confusing me. int a_counter = 0; if (array == 'a') { ...

image - Corona SDK, Lua -

helllppppp!!!!! programming in corona sdk, , trying insert backround image, following code ---local backround = display.newimage("bluebackround.jpg")--- not want show in simulator. keeps giving me following message in output, ---failed find image 'bluebackround.jpg'---. image saved in project folder. using microsoft windows software. have done project using corona, , inserted images fine. know what's going on code , how fix it? thank in advance. _w = display.contentwidth; _h = display.contentheight; local image = display.newimagerect(--[["name", width, heigth]] "bluebackround.jpg",_w, _h) image.x = _w/2; image.y = _h/2;

Borland C++ 5.02 cout not showing on the console window -

i'm sorry newbie question, tried make program using borland 5.02, reason cout in if (stat) isn't showing on console window when write married. don't know what's wrong , i've been stuck hours. please me #include <stdio.h> #include <conio.h> #include <iostream.h> int main() { int nip, gol, gp, ti, ta, ja, tg ; char nm[20], stat[10] ; cout << "id number : " ; cin >> nip ; cout << "name : " ; cin >> nm ; cout << "faction : " ; cin >> gol ; if (gol == 1) { gp = 1500000 ; } else if (gol == 2) { gp = 2000000 ; } else { gp = 2500000 ; } cout << "status : " ; gets (stat) ; if (stat == "married" || stat == "married") { cout << "number of children : " << endl ; cin >> ja ; ti = 0.05 * gp ; if (ja <= 3) { ...