Posts

Showing posts from February, 2015

plugins - Download, save and show images with sencha touch and phonegap -

i' have download images server folder , save in sencha application show them offline. i've found phonegap plugin download , save files in document folder of app. once saved images how can show them in sencha app? you can have store images mapping paths , use phonegap file api.

Possible to add a button to the built-in android calendar? -

i don't know if possible, want this: when user enters android calendar , opens "add new event", want add button inside built-in "new event" activity. possible? if not, possible me run own implementation of "add new event" instead of built-in one? i new when comes working android calendars, dont know how it, if possible. if possible, gratefull basic code-examples :) thanks the answer first question no, cannot add button the calendar app (simply because google proprietary app). solution, more clear , secure, develop thirdy-part application uses google calendar api , , interface app google's calendar app , can adds particular button (with particular operation). this sample application . more info on google developers site , documented

tsql - show bool if row exists or doesn't -

i have table [contracts] columns [id], [number]. , have numbers in string format: '12342', '23252', '1256532'. want output this. 1535325 | no 12342 | yes 23252 | yes 434574 | no 1256532 | yes of course can write , rows have, how can determine if row doesn't exist , output above: select [id] ,[number] [contracts] [number] in ('12342', '23252', '1256532') you can put values temporary table or table variable , left join : declare @d table (number varchar(10)) insert @d values ('12342'), ('23252'), ('1256532'), ('xxxx') -- last 1 not in contracts select c.[id], c.[number], case when d.number null 'no' else 'yes' end [this number c in d also] [contracts] c left join @d d on d.number = c.number for "opposite" use right join select c.[id], d.[number], case when c.number null 'no' else 'yes' end [this number d in c also]

c# - How to set custom module as default in orchard cms -

i made custom module in orchard cms.i want custom module startup module when run site orchard makes home page start up.how can make custom module startup in orchard.my module simple mvc application using entity frame work db .i pretty new orchard learning it.any appriciated advance in order steal home route, have write own route, , give high priority. removing alias current home page help.

svm - r support vector machine e1071 training not working -

i playing around support vector machines in r-language. using e1071 package. as long follow manual pages or tutorial @ wikibooks everythings works. if try use own datasets examples things aren't anymore. it seems model creation fails reason. @ least not getting levels on target column. below find example clarification. maybe can me figure out doing wrong here. here code , data. test dataset target,col1,col2 0,1,2 0,2,3 0,3,4 0,4,5 0,5,6 0,1,2 0,2,3 0,3,4 0,4,5 0,5,6 0,1,2 0,2,3 0,3,4 0,4,5 1,6,7 1,7,8 1,8,9 1,9,0 1,0,10 1,6,7 1,7,8 1,8,9 1,9,0 1,0,10 1,6,7 1,7,8 1,8,9 1,9,0 1,0,10 r-script library(e1071) dataset <- read.csv("test.csv", header=true, sep=',') tuned <- tune.svm(target~., data = dataset, gamma = 10^(-6:-1), cost = 10^(-1:1)) summary(tuned) model <- svm(target~., data = dataset, kernel="radial", gamma=0.001, cost=10) summary(model) output of summary(model) statement + summary(model) call: svm(formula = t

Simple opengl code (render to texture) works on mac but not on ubuntu -

i have simple opengl code written in cpp in qt 4.8 gl context, qt-creator. the code render-to-texture fbo , show texture on screen. render-to-texture involves vertex buffer array. old-school immediate render ( glpushmatrix , glbegin(gl_points) , glvertex , etc) debug. in macbookpro. no problem, code working perfectly. then have tried port on ubuntu. changes in .pro files: libs += -lglut -lglu -lgl -lglew #linux libs += -framework glut -framework opengl -lglew # mac and in headers: // linux #include <gl/glew.h> #include <gl/gl.h> #include <gl/glu.h> // mac #include <gl/glew.h> #include <gl.h> #include <glu.h> in ubuntu immediate render works, showing has do, texture empty (both when draw them on screen both if pixel transfer texture buffer qimage, , in mac works perfectly). the macbookpro has intel hd graphics 4000 512mb, , gl version 2.1 intel-8.12.47 while ubuntu (12.04, 3.5.0-36-generic #57~precise1-ubuntu) ma

c# 4.0 - C#: Linq Reverse Collection failed -

i want reverse order of items in observable collection. sample code: int[] collection1 = new int[] { 1, 2, 3, 4, 5 }; observablecollection<int> obcoll1 = new observablecollection<int>(); foreach ( var item in collection1 ) // initial order 1,2,3,4,5 { obcoll1.add(item); console.writeline("added {0} in observablecollection", item); } console.writeline("now reverse order"); obcoll1.reverse(); foreach ( var item in obcoll1 ) // still show 1,2,3,4,5 instead of 5,4,3,2,1 { console.writeline("after reversing observablecollection: {0}", item); } console.writeline("press key exit"); console.readkey(); the output result shows still same order initial order. missing something? mistakes? thank in advance you need assign return value object something like int[] collection1 = new int[] { 1, 2

streaming - Create media sample timestamps for live source filter? -

Image
i'm trying write udp streaming application directshow intends work in lan environment. things turned out fine until client starts experience freezing issues when seeking. here did: server client on server side, have 2 transform filter, 1 video , 1 audio. in these 2 filters, each of them creates thread reads mediasamples , perform multicast without modifying timestamps/flags. meanwhile, video transform filter pass media samples decoder. audio transform filters same. on client side. live source filter reads video , audio mediasamples udp port. @ here, perform simple timestamp calculation is: mediasample start time = current stream time + 40 ms the videos stream fine in lan environment. however, found out when seek, client side freeze moment. when check renderer, show lots of frames dropped. i'm guessing timestamps causing frames dropped. i noticed whenever perform seek, initial frames have negative stamps. if don't send these frames on client, clie

javascript - Displaying MongoDB Documents with HTML -

i trying create html table display contents of mongodb collection. collection contains data different customer orders small business. of data exist in given document, example customer name , phone number. however, of pieces of data within each document need vary, such items ordered since 1 customer may order 1 item, while may order 3 items. so, if have mongodb collection documents contain arbitrary number fields in each document, how can dynamically add them html table display document's contents? example of type of display looking for, here hard-coded html fields know remain constant. <!doctype html> <html> <head> <head> <title>invoice report</title> <style type="text/css"> body {font-family:sans-serif;color:#4f494f;} form input {border-radius: 7.5px;} h5 {display: inline;} .label {text-align: right} .ordersbook {float:left; padding-top: 10px;} .name {width:100%;float:left;

sql - Doing BULK Insert SUSPENDED With Wait Type LCK_M_RIn_LN -

i'm having awful problems doing bulk insert. i'm using sqlbulkcopy insert number of rows table. @ first, timeout exception. so, set sqlbulkcopy's bulkcopytimeout ridiculous[?] 1800 seconds. exception wouldn't thrown (yet). so, checked activity monitor (as suggested here: timeout expired. timeout period elapsed prior completion of operation or server not responding. statement has been terminated ) ms server management studio , saw bulk insert's task status suspended wait type of lck_m_rin_ln.my code goes this: using sqlcon sqlconnection = connection.connect() dim sqlbulkcopy new sqlbulkcopy(sqlcon, sqlbulkcopyoptions.checkconstraints , sqlbulkcopyoptions.firetriggers , sqlbulkcopyoptions.keepnulls , sqlbulkcopyoptions.keepidentity, sqltran) sqlbulkcopy.bulkcopytimeout = 1800 ' ridiculous? sqlbulkcopy.batchsize = 1000 sqlbulkcopy.destinationtablename = destinationtable sqlbulkcopy.writetoserver(datatableobject) sqltran.commit() e

http - Forward a servlet request to another server -

java servlet api can forward requests path within same server ( identical host:port ). but, forwarding different host:port — proxy — story. i've tried jersey client, adapting servletrequest — method, headers, mediatype , body — jersey clientrequest ( with different base uri ), making call, , adapting jersey clientresponse — method, headers, mediatype , body — servletresponse . adapting manually seems wrong me. isn't there pure servlet api solution? or http client capable of adapting requests , forth when changing host:port? http-proxy-servlet need. quick configuration pom.xml <dependency> <groupid>org.mitre.dsmiley.httpproxy</groupid> <artifactid>smiley-http-proxy-servlet</artifactid> <version>1.7</version> </dependency> web.xml <servlet> <servlet-name>solr</servlet-name> <servlet-class>org.mitre.dsmiley.httpproxy.proxyservlet</servlet-class> &

Android HTTP POST file upload not working with HttpUrlConnection -

i trying upload file server via http post device. have 2 method upload1 , upload2. upload1 uses httppost class , works, bigger files throws out of memory exception. upload2 uses httpurlconnection , not work. (i bad request message server.) want upload2 work, because uses stream send data , throws no out of memory exception. looked @ packages in wireshark, headers seems same, length upload1 380, upload2 94. problem? private void upload1(file file) { try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url + "?recname=" + filename); // /////////////////////////////////////// string lineend = "\r\n"; string twohyphens = "--"; string boundary = "---------------------------this boundary"; bytearrayoutputstream baos = new bytearrayoutputstream(); dataoutputstream dos = new dataou

json - android FATAL EXCEPTION: AsyncTask #2 -

i'm getting fatal exception: asynctask #2 in application. can please tell me why , tell me need do. pretty confused right , need little help. 07-25 11:18:27.014: e/androidruntime(784): fatal exception: asynctask #2 07-25 11:18:27.014: e/androidruntime(784): java.lang.runtimeexception: error occured while executing doinbackground() 07-25 11:18:27.014: e/androidruntime(784): @ android.os.asynctask$3.done(asynctask.java:299) 07-25 11:18:27.014: e/androidruntime(784): @ java.util.concurrent.futuretask.finishcompletion(futuretask.java:352) 07-25 11:18:27.014: e/androidruntime(784): @ java.util.concurrent.futuretask.setexception(futuretask.java:219) 07-25 11:18:27.014: e/androidruntime(784): @ java.util.concurrent.futuretask.run(futuretask.java:239) 07-25 11:18:27.014: e/androidruntime(784): @ android.os.asynctask$serialexecutor$1.run(asynctask.java:230) 07-25 11:18:27.014: e/androidruntime(784): @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1

Mapping to one CoreData attribute from a collection of elements using RestKit RKDynamicMapping -

i trying map 1 coredata attribute following json: { "products": [ { "stock": { "instock": true, "instockbeforemaxadvanceorderingdate": false }, "url": "xxxxxxxxxxx", "manufacturer": "demo", "images": [ { "format": "thumbnail", "imagetype": "primary", "url": "/imageurl/xx.jpg" }, { "format": "thumbnailgrid", "imagetype": "primary", "url": "/imageurl/xxx.jpg" } ], "productfees": [ [ "empty", "0.0" ] ], "name": "demo product" } ]

php - Encrypting URL and securing server -

i have app upload files server. files uploaded in same folder php script placed. files can viewed if 1 finds out url, easy hack , destroy data. i have provide download address users downloading data uploaded if provide exact url, fair chance of loss of data. i want know there way encrypt url or other way of securing folder data uploaded. my url www.hostname.com/myfolder/file.txt . due such plain url, can't benefit url encoding in java. i java programmer, have experience in php. regards a few remarks: use sessions , make users authenticate themselves. put files in upload/ folder, outside of web root. when files requested, check in upload/ folder if exist , serve them there. if file exists, deny upload. run secure (https) host.

symfony - symfony2 date field type format option changes input type to text -

when do: $builder->add('submittedat_min', 'date', array('widget' => 'single_text', 'label' => 'my label', 'attr' => array('placeholder' => 'my placeholder'))); i get: <input type="date" placeholder="my placeholder" required="required" name="es_app_filter[submittedat_min]" id="es_app_filter_submittedat_min" class="hasdatepicker"> the type "date" but when add format option field: $builder->add('submittedat_min', 'date', array('format' => 'dd-mm-yyyy', 'widget' => 'single_text', 'label' => 'my label', 'attr' => array('placeholder' => 'my placeholder'))); i get: <input type="text" placeholder=&quo

zend framework2 - zf2 MultiCheckbox Error: The input was not found in the haystack -

i displaying dynamic checkbox using zend\form code: $this->add(array( 'type' => 'zend\form\element\multicheckbox', 'name' => 'user_group_id', 'attributes' => array( 'id' => 'user_group_id', 'options' => $tagdata, ), )); this works fine. when have encrypted values in $tagdata , form produces error: the input not found in haystack i have tried 'disable_inarray_validator' => false , 'inarrayvalidator' => false, none working. they work select element. how accomplish same multicheckbox ? there 2 approaches here 1) disable validators on specific field(if zf2 allows disable validator). tho @ moment few validators after being disable remove/hide haystack error . still wont form validate. 2) may need re-populate values/reset values field after data posted.the thing zf2 form assumes values should in haystack . c

java ee - Avoiding POST requests resulting in "400 - Bad Request" status code in Spring MVC -

i have spring mvc application using annotation configuration. test controller looks that: @requestmapping(value = "/add", method = requestmethod.post) public string addnumber(@requestparam("name") long somenumber) { ... return "redirect:/showall/"; } when user posts data controller , not enter valid long number ("somenumber"), spring mvc responds 400 - bad request http status code. application not chance react on error. how problem handled? i think best way handle add 'required' parameter requestparam annotation. @requestparam(value="name", required=false) http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/bind/annotation/requestparam.html

tooltip - Use AutoIt to call another AutoIt compiled executable with parameters -

i trying create program use multiple tooltips, came across problem: can use 1 @ time, because after that, new 1 replace previous. i came solution: compile program creates tooltip , use as needed. there problem: want tooltips in different positions , different texts/titles. to need use parameters or other types of variables change coordinates , text of tooltip. my called exe perform simple like: tooltip($text, $x, $y, $title, 0, 1 + 4) sleep(10000) there quicker/easier way it. the easiest way make use of /autoit3executeline command line option, allows run 1 line of code command line. @ simplest implement this: _showanothertooltip(1000, "hello", 100, 100) _showanothertooltip(1000, "world", 200, 200) func _showanothertooltip($time, $text, $x = default, $y = default, $title = "", $icon = default, $options = default) local $cmd = stringformat("tooltip(%s,%s,%s,%s,%s)", "'" & $text & "'&quo

html - jQuery validation plugin - pass function as parameter -

i'm writing jquery plugin validate forms. plugin works great want able define happens after form validates. want able pass function parameter. function contain bunch of stuff submit form. parameter needs called when validation successful. plugin called within html file: <script> $(document).ready(function(){ $('#cform').shdvalidate({ success : formsubmit() }); }); </script> jquery plugin: (function($) { $.fn.shdvalidate = function(options) { //==== settings var shdvalidatesuccess = $.extend(options).success, form = this; //==== submit click this.children('input[type=submit]').click(function(){ //variables var shdrequired = $(form).children('.required'), shdvalid = 0; //validated fields $(shdrequired).each(function(){ $(this).removeclass('shdvalidatealert'); if ($(this).val() == '' || $(this).val() == $(this).attr('place

ruby on rails - attr_encrypted and postgresql, does it work? -

des attr_encryptor (or attr_encrypted) works postgresql ? datas not saved, when wrote @object.encrypted_value i have never saved... or maybe doing wrong ? my model looks : model user < activerecord::base attr_accessible :name, :email attr_encrypted :email, :key => "asecretkey" end in ddb, have user(name, encrypted_email, encrypted_email_iv, encrypted_email_salt) character varying(255) each. and form c.email (and not c.encrypted_email, right ?) what model like? if have @object.my_value = 'thing' model should like class myobject attr_encrypted :my_value, :key => 'a secret key' end don't forget call #save on object after assigning value. should able encrypted payload @object.encrypted_my_value if want. db need string field called encrypted_my_value.

css - Code reuse with LESS -

so, i'm in project. have running application same clients have. thing changes, little bit of (pure) css. big problem, each page, have css stylesheet, , each client, have same sheet, specific changes made. i'm thinking on way reduce redundant code, , starting use css precompiler @ same time, ease our development process, less. have ground rules, are: code refactoring bad idea, it's many code , not worth it the final css filesize cannot bigger, our sites have heavy traffic my first idea, write precompiler enables "extending" sheets, extending view, blocks , stuff ( like this ), , write little script diffs files , automatically extends it, , creates file differences only, this: /** @extends: site/home/test */ #square-test { background: #c00; } but seems complicated, , little bit messy. has been same situation? how did guys handle it? has ideas? i'm thankful help. edit: i'm using regular lamp, php 5.3.newer. you can use sas

c# - Interaction between JavaScript and Windows Forms -

i have windows forms application, uses webbrowsercontrol display dynamically generated htmlpage. there possibility interact jscode of page? example if have have following function: <script type="text/javascript"> function returnvalue() { var output; output ='test'; return output; } </script> would there possibility receive "test" in application (not trough url)? yes it's possible using invokescript on browser control; see article more information: http://www.codeproject.com/tips/127356/calling-javascript-function-from-winforms-and-vice

Solr (4.4+) solrconfig.xml location when creating cores -

i'm trying setup multi core solr server our webapplication i'm having trouble creating new core through coreadmin service. i'm using solr-4.4 because 4.3 ran problems persisting cores in solr.xml (datadir wasn't preserved) i'm using new solr.xml configuration 4.4 , beyond my solr.xml looks like: <solr> <str name="corerootdirectory">default-instance/cores/</str> </solr> solrconfig.xml located @ (solrhome)/default-instance/conf/solrconfig.xml when trying create core url http:/example.org/solr/admin/cores?action=create&name=test-name&schema=schema-test.xml&loadonstartup=false gives me error: error createing solrcore 'test-name': unable create core: test-name caused by: can't find resource 'solrconfig.xml' in classpath or 'default-instance/cores/test-name/conf/', cwd=/var/lib/tomcat7 the following seems work: http:/example.org/solr/admin/cores?action=create&na

c# - not able to get values in second dropdownlist in a view -

i have got cascaded dropdown list show items in second drop downlists regarding selected ones in first drop downlist purpose have done this.... code controller namespace mvcsampleapplication.controllers { public class cascadelistcontroller : controller { public actionresult index() { list<selectlistitem> state = new list<selectlistitem>(); state.add(new selectlistitem { text = "state1", value = "state1" }); state.add(new selectlistitem { text = "state2", value = "state2" }); viewbag.statename = new selectlist(state, "value", "text"); return view("basicdrop"); } public jsonresult districtlist(string id) { var districttype = s in cascadingdropdowns.getdistrictlist() s.statename == id select s; retu

javascript - How to not merge all js into one file in Rails 3.2? -

i use rails 3.2. using lot of js gems, , of them require called in specific order. in development automatically seperates different js files : <link href="/assets/companies.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/contacts.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/fake_json.css?body=1" media="all" rel="stylesheet" type="text/css" /> but in production merges of files : <script src="/assets/application-e30cf15d1afc4b59752074fa16cd83a3.js" type="text/javascript"></script> in specific case, not want or require rails me. tried cancel using config.assets.compress = false , config.assets.debug = true in production.rb file, has no effect after restarting server. how enable "not merging" on production? you can add fo

php - retrieve MySQL table schema from .frm files to create SQL script -

i received mysql database vendor (whose contract closed) , followed instructions set php , mysql on localhost, using phpmyadmin interface see few of tables visible in db directory. i noticed tables able see (and query) in phpmyadmin had 3 files types (.frm .myd .myi) 'missing' ones had 1 type (.frm). how use .frm file (which schema) create sql scripts allow me re-generate tables in full? you can´t restore data .frm files, no problem table defintion out of files. following: create new table same name .frm file (so e.g. yada.frm become yada table) stop mysql daemon copy on old old .frm file location new .frm stored restart mysql deamon you should able table defintion show create table yada

iphone - Button setHighlighted not working -

i have button want highlight using highlighted attribute. in interface builder, highlighted attribute works , changes button visibly highlighted state. however, in code, when write [mybutton sethighlighted:yes]; nothing changes. ideas why doesn't work? please remember correct behaviour next: highlighted state button when button tapped, changing button state isn't correct. there control state appropriate, selectedstate if modify selected state in ibaction of button work. hacking highlighted state of button in moment tap on it, it's wrong. -(ibaction)touch:(uibutton *) tappedbutton { [mybutton setselected:yes] } you need provide resources selectedstate. can via xib ( choose state button in attributes inspector selected , can add textcolor background etc.) or via code: [self.button setimage:[uiimage imagenamed:image] forstate:uicontrolstateselected];

dns - Domain name from IP -

my site still gets requests 1 ip address - 195.210.29.12. when tried nslookup shown me name: data12.websupport.sk address: 195.210.29.12 that hostname of 1 hosting provider. when tried realize domain using http://www.yougetsignal.com/tools/web-sites-on-web-server/ gave ma 500 results. my question - possible realize domain was? thanks. every provider has abuse mailbox. if tries hack page or sth that, can write mail provider. in case following mail to: abuse-mailbox: abuse@websupport.sk

asp.net web api - Dependency Injection for DataContracts and Models in the BLL -

apologies if has been asked before. unable find similar question or post. i have solution unity di framework. i have tried understand concept of tdd , di. should last question before move things real application. i understand concept of injecting dependency via constructor, how bll looks now: the bll class called carservice , 1 method getcardetails : class carservice { irepository repository; carservice(irepository repository) { this.repository = repository; } carresponse getcardetails(carrequest request) { carresponse carresponse = new carresponse(); carmodel car = this.repository.selectcarbyid(request.carid); if(car!=null) { carresponse.make = car.make; carresponse.reg = car.reg; } return carresponse; } } using composition root (cr) suggestion in this question using webapi project cr project. wanted projects referred in cr suggested in question , here how ever in above

c# - Emgu - How to extract the images likely to represent an icon or control from a screenshot? -

Image
i'm working on experimental project in challenge identify , extract image of icon or control user has clicked on/touched. method i'm trying follows (i need step 3): 1) take screen shot when user clicks/touches screen: 2) apply edge detection: 3) extract possible icon images around point associated user's cursor (don't know how this) there easier cases in mouse-over event highlight icon/control, allows me identify control simple screen shot comparison (before , after mouse-over). above method cases in icon not highlighted. i'm new emgu, if has pointers on how better achieve this, i'm ears. cheers! matt instead of doing edge detection. consider taking following steps: only grab pixels within radius of point of user's cursor. create new image these pixels. use thresholding classify foreground , background. calculate centroid, (use mean x coordinate , mean y coordinate). calculate deviation mean. discard foreground pixels beyo

local - Viewing MAMP site on iPhone/iPad? -

i'm compiling website hammer mac , running site in local environment mamp. now, i'm able view site on iphone when visiting 10.0.1.2/project-name/html reason it's not reading paths correctly, means things stylesheets missing. my css looks in page source: <link rel='stylesheet' href='assets/css/base.css'> <link rel='stylesheet' href='assets/css/form.css'> <link rel='stylesheet' href='assets/css/layout.css'> <link rel='stylesheet' href='assets/css/skeleton.css'> does know i'm doing wrong. i'd easy way view local sites on other devices. any appreciated. in advance.

c - b and *b works in argument list of my function exactly same. What is the difference then? -

this question has answer here: why same value output a[0], &a, , *a? 4 answers i use swapcardsrandomly(b) when tried swapcardsrandomly(*b) program still works without problem. what difference then? /* *shuffles cards randomly */ void shuffle( int b[][13] ) { int counter; int rand1 = rand() % 4; int rand2 = rand() % 13; b[rand1][rand2] = 1; counter = 2; while ( counter < 53 ) { rand1 = rand() % 4; rand2 = rand() % 13; while ( b[rand1][rand2] != 0 ) { rand1 = rand() % 4; rand2 = rand() % 13; } b[rand1][rand2] = counter++; } swapcardsrandomly( b ); } //for better shuffling swap elements randomly void swapcardsrandomly( int m[][13] ) { int temp; int rand1; int rand2; ( = 0; < 4; i++ ) { ( j = 0; j < 13; j++ )

typedef - Objective C: NSRange or similar with float? -

for methods want them return range of values (from: 235, to: 245). did using nsrange return value - (nsrange)givemearangeformyparameter:(nsstring *)myparameter; this works fine long return value integer range (e.g. location: 235, length: 10). but have problem need return float range (e.g. location: 500.5, length: 0.4). read in doc nsrange typedefed struct nsuintegers . possible typedef struct float ranges? , if so, can there similar method nsmakerange(nsuinteger loc, nsuinteger len) create float ranges? although reuse 1 of several "pair objects" graphics library (you can pick cgpoint or cgsize , or ns... equivalents) struct s behind these objects simple better create own: typedef struct fprange { float location; float length; } fprange; fprange fprangemake(float _location, float _length) { fprange res; res.location = _location; res.length = _length; return res; }

java - RESTful: how to dynamically extend an API path's (or available resources)? -

i've had nice 'ride' restful technology. using hello.java resource this: @path("/hello") public class hello { ... /* get/put/post */ } with can access resource path http://my.host/res/hello . want 'ride' restful harder. having 1 resource path bit boring. problem i have dynamically created resources this: http://my.host/res/hello http://my.host/res/hello/1 http://my.host/res/hello/2 ... http://my.host/res/hello/999 it doesn't make sense create .java resource every @path("/hello/1") ... @path("/hello/999") . right? list of sub-resources bigger or dynamically change in time. solution that? thanks. you can use @path annotation on methods inside resource class. @path("/hello") public class hello { ... /* get/put/post */ @get @path("{id}") public string mymethod(@pathparam("id") string id) {...} } the paths concatenated match /hello/13 . {id} placeh