Posts

Showing posts from January, 2015

c++ - openmp: recursive task slower than sequential even with depth limit -

i have big binary tree on want expensive calculations. want parallelize these methods using openmp , task pragmas. as test, have parallelized freetree function , have created big example test tree. in order prevent spawning many tasks, have limited tasks creation top 2 levels of tree. 4 tasks created. below minimal working example: #include <chrono> #include <iostream> class node { public: int data; node* l; node* r; node(node* left, node* right) : l(left), r(right) {} }; node* createrandomtree(int depth) { if (depth == 0) return new node(null, null); return new node(createrandomtree(depth - 1), createrandomtree(depth - 1)); } void freetree(node* tree) { if (tree == null) return; freetree(tree->l); freetree(tree->r); delete tree; } void freetreepar(node* tree, int n = 0) { if (tree == null) return; node *l = tree->l, *r = tree->r; if (n < 2) { #pragma omp task fre...

statistics - R aov Function - adjusting the alpha value..? -

i have used aov() function im wondering if there way or function allows user define alpha value..?# i'm assuming these tend industry standard of 0.05....what if wanted aov function yield p-value based on 0.03...or 0.01 alpha values...? you can extract p-values of object returned aov with pvalues <- summary(fit)[[1]][ , 5, drop = false] where fit <- aov(...) . now, can compare p-values alpha level, e.g., 0.01: pvalues < 0.01 this returns true or false .

c++ - Static data initialised when my program EXITS -

sometimes put initialisation code in constructor of static object, this. namespace { struct init { init (); }; init :: init () { // whatever } init init; } yes, know bad in general because can't rely on order of initialisations between translation units, sometimes, things, it's okay. anyway don't syntax , today tried out this. namespace { int init = [] () -> int { // whatever return 0; } (); } when program ran, whatever code ran after main() ! i know static initialisations happen in arbitrary order, thought specification required all , in whatever order, happen before main() enters. is compiler misbehaving or there further subtlety? #> gcc -v using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper target: i686-linux-gnu configured with: ../src/configure -v --with-pkgversion='ubuntu/linaro 4.8.1-10ubuntu9' --with-bugurl=file:///usr...

android - GCC ARM cross compiler won't compile simple Hello world -

i installed arm c compiler android using apt-get install gcc-arm-linux-gnueabi . installed successfully, wrote simple hello world program: #include <stdio.h> int main(){ printf("hello world"); return 0; } i saved hello.c , tried compile using: arm-linux-gnueabi-gcc hello.c -o hello says: usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find crt1.o: no such file or directory usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find crti.o: no such file or directory collect: error: ld returned 1 exit status

makefile - how to make clean without any modification? -

i have makefile huge library, when modify files not want compile library , make clean , @ first compile files clean. how can make clean without other modifications? i have used .phony: clean force clean: force rm *.o rm *.mod force: i resolve problem using: ifneq ($(makecmdgoals),clean) -include $(objs:%.o=%.d) endif as zhertal says there's no way know sure without seeing definition of clean rule, @ least. there 2 possibilities this. the first clean target listing prerequisite causing rebuild. unlikely, i've seen people things before. the second, , more likely, cause you're using method described in gnu make manual automatically generating prerequisites, add %.d pattern %.o pattern rule , -include .d files. problem here make try make sure makefile date first before running targets, , means trying rebuild included .d files, means recompiling everything. you have 2 options fix this. first put include line ...

gracenote - Feature Request : Configuration preference for single best match. MusicID -

i have been using mobile developer kit couple of weeks , have tested "gnoperations.recognizemidfilefromfile" method android kit on large number of files single best match response configured. pretty impressed results. 95% accurate when result found did realized around 20% percent of files recognized single best match identify part of compilation album while think default best single match identify song part of single,an album of artist when applicable before being identify being part of compilation album, ep or soundtrack album. after looking @ documentation, didn't see let me configure . suggestion have property can set in config object similar "content.coverart.sizepreference" property used specify covert art size preference. property : "content.singlebestmatch.albumpreference" , different values "single, album, compilation, dj_mix, soundtrack, live_album" i happy hear comments of gracenote team on or else.

python - Pyinstaller issue with subprocess.check_output on onefile executable under windows -

there requirement of running subprocess.check_output catch ouptupt of 7zip in application. simple code using output = subprocess.check_output(["path/to/7zip", "l", "path/to/archieve"], shell=true) print output as expected works when run ide. same goes crazy , not working after compiled in onefile executable using pyinstaller. other subprocess command subprocess.call works after converting script in executable. how use subprocess.check_output in executable? i use following:- windows 7 python 2.7.5 pyqt4 pyinstaller 2.1 any appreciated. ok. got solved self. used os.popen command accomplish same task. sake of completeness, posting solution code below:- out = os.popen("path/to/7zip l path/to/archieve").read() print out

glsl - OpenGL Shaders - Structuring blocks of data of similar types -

i'm having bit of structural problem shader of mine. want able handle multiple lights of potentionally different types, i'm unsure best way of implementing be. far i've been using uniform blocks: layout (std140) uniform lightsourceblock { int type; vec3 position; vec4 color; // spotlights / point lights float dist; // spotlights vec3 direction; float cutoffouter; float cutoffinner; float attenuation; } lightsources[12]; it works, there several problems this: a light can 1 of 3 types (spotlight, point light, directional light), require different attributes (which aren't neccessarily required types) every light needs sampler2dshadow (samplercubeshadow point lights), can't used in uniform blocks. the way i'm doing works, surely there must better way of handling this? how done?

java 7 - Android: Not finding File.toPath option with JDK. 1.70.51 -

i upgraded java 1.70.51 1.6 version. its first time changing jdk. i've compiled , ran android program using of new features, files.copy(), can't seem find file.topath? file src_db = get_dbfolder(src_dbname, src_location); file dst_db = get_dbfolder(dst_dbname, dst_location); path srcpath = src_db.topath(); // these giving me errors, path destpath = dst_db.topath(); // because no .topath i looked through settings, , see 1.6 settings compiler, if change 1.7 android requires 5.0 or 6.0 compiler settings (i guess means 1.5 or 1.6). allowed use 1.7 android? cause of problem? the workspace jre set 1.7, compiler settings 1.6, can't change without error. android not java - can't use java 7 features when programming android. point of confusion many new developers. safest bet stick java 5 features, java 6 features work, there many aren't available tend avoid them. you can still use jdk 7 build applications, make sure set ide show java 1.5 cod...

apache2 - Specifying the VirtualHost to serve up when there is no DNS Name sent in the HTTP Headers? -

in apache 2 how 1 specify (virtualhost?) served when no dns name set in http headers of request? the apache2 documentation says when virtualhost ... is first in configuration file, has highest priority , can seen default or primary server. so, first 1 answer requests not explicitly match virtualhost through servername directive or separate ip.

java - Behaviour of try-with-resources with closable parameters -

does java-7's try-with-resources require closable assigned directly variable? in short, block of code... try (final objectinputstream ois = new objectinputstream( new bytearrayinputstream(data))) { return ois.readobject(); } equivalent block?... try (final bytearrayinputstream in = new bytearrayinputstream(data); final objectinputstream ois = new objectinputstream(in)) { return ois.readobject(); } my understanding of section 14.20.3 of java language specification says not same , resources must assigned. surprising common usage standpoint , can't find documentation warning against pattern. the 2 blocks not equivalent in sense won't generate same code. since objectinputstream.close() call close() on bytearrayinputstream passed it, first block fine. edit: forgot unlike reasonable constructions new bufferedinputstream(new *inputstream(...)) , objectinputstream constructor reads stream pass , reaso...

JavaCC multiline comment in custom NetBeans plugin -

i having problem comments in creating custom file in netbeans. got 2 types of multiline comment types: starting /* , ending */ starting <!-- , ending --> more : { "/*": xscript_comment | "<!--": xml_comment } <xscript_comment> token : { <x_script_comment_end: "*/" > : default } <xml_comment> token : { <xml_comment_end: "-->" > : default } <xscript_comment,xml_comment> more : { < ~[] > } the problem is, both multiline comments throws tokenmgrerror when write initial part of comment ( /* or <!-- ). error occurs when there no ending part , lexer reaches end of file. my goal create multiline comments works similar other comment types (when initial part written, rest of document comment type text). please excuse english, not native language. one way use single regular expression match comments. example /* .. */ multiline comment can matched by "...

c# - Why is my total record count zero? -

i can't understand why comptetuples 0.0 instead of 1003 , knowing table related _db.appsmetiers has 1003 rows. private monitoringdbcontext _db = new monitoringdbcontext(); double comptetuples; var model = _db.appsmetiers .orderby(x => x.nomapplication) .skip(nblignesdepassees) .take(nblignesretenues); comptetuples = (double)model.count() / 10; comment out skip , take , compare results.

Use Visual Studio for custom script language -

we using commercial software has own scripting language can customize product. tedious write code in without ide , has own compiler. is possible use visual studio , create environment me write scripts in language , of intellisense , syntax highlightning , other things find in ide? ideally bind button in vs launch external compiler , compile code don't have switch windows time well. if possible hard thing accomplish? yes, possible. need create visual studio shell add-in custom language services , text editors. need install appropriate visual studio sdk , you'd continue to: create custom editor and/or designer add language service add project , item templates you're allowed ship visual studio isolated shell application (license required , there limitations) users don't need have visual studio professional installed. there number of open-source projects provide custom editor, language services etc in visual studio, these provide nice place resea...

Weird syntax error in python 3.x logic -

this question has answer here: why 'true == not false' syntax error in python? 3 answers for reason there syntax error in following logical evaluation: true not none , not false not not not none the error can narrowed down statement: false not not none where second not highlighted. this isn't important @ all, interested in why might failing. ideas? another thing remember is , not , is not three separate operators. in other words, is not not (no pun intended) combination of is , not . in case of example false not not none python tries pass false , not is not operator. since not not valid operand, syntax error results.

sql - Right Outer Join to Left Outer join -

i have query in sqlserver needs translated sqlite3, query uses "right outer join", problem sqlite doesn't support operator yet. how can translate query use "left outer join" instead of "right" outer join? select * p right outer join cl right outer join c left outer join cc on c.idc = cc.ridc on c.idc = c.ridcl on p.idp = c.ridp thanks. ps: i'm having trouble sqlite joins precedence , associativity, don't know how may alter final result reordering tables. in query, table c in middle. driving query. your on conditions in strange places. guessing mean: select * c left outer join cc on c.idc = cc.ridc left outer join p on p.idp = c.ridp left outer join cl on cl.idc = c.ridcl

ios - UIWebView contents preload using NSURLConnection -

i'm developing ios app has 2 vcs, mapvc(using google map sdk) , webvc. selecting annotation on mapvc, transition webvc corresponding webpage openned. loadrequest method in viewdidload of webview slow wait. so want preload web data when selecting pin on mapview, , hand on preloaded data webvc using loaddata method. but webvc displays text, no images no css. should preload full html/css/images? advice appreciated. in advance. my current source code follows. // --- mapviewcontroller --- - (bool)mapview:(gmsmapview *)mapview didtapmarker:(gmsmarker *)marker { nsurl *url = [nsurl urlwithstring:@"(target url)"]; nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60.0]; receiveddata = [nsmutabledata datawithcapacity:0]; nsurlconnection *urlconnection; urlconnection = [nsurlconnection connectionwithreque...

How can I make a gradient background for a graphics box in Mathematica? -

Image
i have seen answer problem plots, want general graphics box. graphics[{disk[], red, rectangle[{-.75, 1}, {.5, -.5}]}, background -> green] i make background of graphic resemble 1 of color palette gradients. ideally type "rainbowcolors" somewhere in code , background rainbowcolors palette. i remove background , make rectangle gradient fill, it's not i'd like. i'm hoping has beautiful bit of knowledge. thanks much!! the closest aware of combination of prolog , polygon , vertexcolors , , scaled coordinates: graphics[ {disk[], red, rectangle[{-.75, 1}, {.5, -.5}]}, prolog -> polygon[ scaled /@ {{0, 0}, {0, 1}, {1, 1}, {1, 0}}, vertexcolors -> {yellow, green, magenta, pink} ] ] more complicated gradients can formed stacking polygons: graphics[ {disk[], red, rectangle[{-.75, 1}, {.5, -.5}]}, prolog -> {polygon[ scaled /@ {{0, 0}, {0, 1/2}, {1, 1/2}, {1, 0}}, vertexcolors -> {red, yellow, pink, blue...

java ee - Bean Validation Message with dynamic parameter -

i getting started bean validation, , i'm trying compose constraint. constraint validate cpf(personal document in brazil). constraint working, need message contain dynamic parameter. i'm using validationmessages.properties. code: @constraint(validatedby=cpfvalidator.class) @size(min=11, max=14) @documented @target({elementtype.field,elementtype.method}) @retention(retentionpolicy.runtime) public @interface cpf { string message() default "{cpf.validation.message}"; class<?>[] groups() default {}; class<? extends payload>[] payload() default {}; } my validationmessages.properties: cpf.validation.message=cpf {cpf} é inválido my validator: i'm using context.buildconstraintviolationwithtemplate customiza message. @override public boolean isvalid(string value, constraintvalidatorcontext context) { string cpf = value; boolean result = validationutil.validacpf(cpf); if (result) { return true; } contex...

python - Getting maximum and minimum of OpenStreetMap map -

i downloaded 1 single city corresponding openstreetmap data. want maximum , minimum values latitude , longitude. how can that? my approach following: import osmread osm #... def _parse_map(self): geo = [(entity.lat, entity.lon) entity in osm.parse_file('map.osm') if isinstance(entity, osm.node)] return max(geo[0]), min(geo[0]), max(geo[1]), min(geo[1]) but when print these values don't think right. when downloaded area openstreetmap site had white area indicating region exporting. , area got minimum , maximum values latitude , longitude. , these values arent fitting ones simple script. what doing wrong? return max(geo[0]), min(geo[0]), max(geo[1]), min(geo[1]) you taking extrema of first , second element of geo . geo list of 2-tuples. first element geo[0] 2-tuple consisting of entity.lat , entity.lon first node. therefore choosing min/max of latitude , longitude 1 node. if want feed first (second) element of each tuple in list aggregate ...

c# - Cannot Deserialize xml to List<T> -

im trying deserialize xml response of wcf web service list using xmlserializer fails exception message : there error in xml document (1, 2) xml: <arrayofnote xmlns="http://schemas.datacontract.org/2004/07/notebookservice" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> <note> <author>redouane</author> <body>test note</body> <creationdate>2014-01-28t00:00:00</creationdate> <id>1</id> <title>hello world</title> </note> </arrayofnote> c#: public class note { public int id { get; set; } public string title { get; set; } public system.datetime creationdate { get; set; } public string author { get; set; } public string body { get; set; } } and code wrote deserialize received stream private httpclient client = new httpclient(); private list<note> notes = new list<note>(); . . . xmlserializer serializer = new xm...

c# - Crystal Reports keeps prompting for Parameter -

i having terrible problem crystal report 2010 .net 4.0 (i using fixed 13.0.1 version 13.0.4 released). no matter way try, getting prompting dialogue box input 1 parameter value first time. crystalreportviewer1.reportsource = customerreport1; customerreport1.database.tables[0].setdatasource ( this.dataset); customerreport1.setparametervalue("pathlocation", location.text); customerreport1.parameter_pathlocation.currentvalues.add(location.text) // safe using cs 2010 .net 4 crystalreportviewer1.reusereportparametersonrefresh = true; // prevent showing again , again. i tried this: customerreport1.database.tables[0].setdatasource ( this.dataset); customerreport1.setparametervalue("pathlocation", location.text); crystalreportviewer1.reportsource = customerreport1; and this: customerreport1.database.tables[0].setdatasource ( this.dataset); customerreport1.parameter_pathlocation.currentvalues.add(location.text) crystalreportviewe...

Django: how to use the nice admin tables in the actual application -

new django, worked through 'polls' tutorial. convert simple views tabular views, in pretty admin interface. should try clone code admin module? otherwise, how proceed? the admin forms django forms , formsets . build form model use modelforms . maybe nice @ admin tabular_inline template. lives at: django/contrib/admin/templates/admin/edit_inline/tabular.html. the snippet looping on form fields .

java - Questions about implementing the Comparable interface -

i teaching java programming class first time. textbook uses comparable , see examples on net use comparable<t> . these using 2 different interfaces? related this, when write compareto() method in student class, textbook uses public int compareto(object other){ if (! (other instance of student)) throw new illegalargumentexception("parameter must student"); return name.compareto( ((student)other).getname() ); } i see other examples of compareto() this: public int compareto(student otherstudent){ return name.compareto( otherstudent.getname() ); } is second construct 1 should use if student class implements comparable<student> ? finally, textbook gives hints on how write general-purpose object sorting algorithm. arrived @ following. works, gives "unchecked or unsafe operations" warning. there way write "safe" general-purpose sorting algorithm? private static void bubblesortobjects(comparable[] array) { int ...

File-specific key-binding in emacs -

is possible define file specific key-bindings in emacs? suppose possible create minor mode , have loaded when particular file open 1 key-binding seems overkill. if combine code local-set-key , buffer-locally overriding minor-mode key bindings in emacs end this: (defun my-buffer-local-set-key (key command) (interactive "kset key buffer-locally: \ncset key %s buffer-locally command: ") (let ((oldmap (current-local-map)) (newmap (make-sparse-keymap))) (when oldmap (set-keymap-parent newmap oldmap)) (define-key newmap key command) (use-local-map newmap))) and then, per barmar's answer: ;; local variables: ;; eval: (my-buffer-local-set-key (kbd "c-c c-c") 'foo) ;; end: note minor mode maps take precedence on local map.

python - Basic Prime Number generator -

i've been trying make prime number generator in python, porting this scratch project python terms, , writing primes text document. for reason though, isn't working , can't work out why, writing numbers goes. def primenumbers(): j = 2 f = open("primes.txt", "w") primes = [] notprimes = [] ask = input("how many primes? ") while len(primes) < int(ask): k = 2 while not(k==j) or not(j%k==0): k = k + 1 if k == j: primes.append(j) f.write(str(j)+"\n") else: notprimes.append(j) # if len(primes)%1000 == 0: # print("there have been " + str(len(primes)) + " primes counted far") j = j + 1 print("primes written file 'primes.txt', " + str(len(primes)) + " written") f.close return(" ") so, program asks user how many primes should generate,...

c# - Error validaing new data while updating gridview row data in asp.net web form? -

Image
i'm creating simple web forms application using asp.net registering patients data using entity framework.i'm using dynamic data fields easy validation of editable data based on microsoft sql server data types , null allow my aspx code entity data source , data gridview <asp:entitydatasource id="entitydatasource1" runat="server" contexttypename="webapplication4.pediatricdbentities" enabledelete="true" enableflattening="false" enableinsert="true" enableupdate="true" entitysetname="patients" entitytypefilter="patient"> </asp:entitydatasource> <br /> <asp:gridview id="gridview1" runat="server" allowpaging="true" allowsorting="true" autogeneratecolumns="false" datakeynames="patientid" datasourceid="entitydatasource1"> <columns> <asp:commandfield showde...

svn - Jenkins subversion tagging plugin - with yes/no option? -

Image
i've installed subversion tagging plugin, works expected not want tag every successful build tag release candidates. how control ? there yes/no can incorporated subversion tagging plugin on jenkins ? thanks help! select build want build history, click "tag build" list of links on left. in-built functionality has nothing subversion tagging plugin.

recursion - Why does my javascript countdown timer occasionally over-run? -

as part of web-based educational game, have countdown timer using code follows. mostly, timer stops @ zero, occasionally, over-runs, , continues count down 59:59. a couple of notes code: counttime global variable set dropdown menu stopcount gloabal variable set reset button leadzero external function used formatting i understand settimeout not accurate, have thought remtime > 0 condition stop recursion eventually, if missed first time. anyway, here's code: function newcount() { var starttime=new date(); var min=starttime.getminutes(); var sec=starttime.getseconds(); var endtime=(min*60)+sec+counttime; stopcount=false; countdown(); function countdown() { var today=new date(); var m=today.getminutes(); var s=today.getseconds(); var currtime=(m*60)+s; var remtime=endtime-currtime; var remmin = math.floor(remtime/60); var remsec = remtime % 60; // add 0 in front of number...

jquery - Ajax form attributes are removed when accessing application through reverse proxy -

i have vb.net mvc 4 application functions correctly locally , on server. using apache reverse proxy provide access of our applications, , when implemented this, form attributes generated via ajaxoptions removed. in example: <% using (ajax.beginform("getadminsearchresults", "initiationsearchresults", new ajaxoptions {.httpmethod = "post", .onsuccess = "updateplaceholder", .updatetargetid = "lstsearchresults"}, new {.id = "frmsearch"}))%> without reverse proxy, html generated is: <form action="/initiationsearchresults/getadminsearchresults?length=23" data-ajax="true" data-ajax-method="post" data-ajax-mode="replace" data-ajax-success="updateplaceholder" data-ajax-update="#lstsearchresults" id="frmsearch" method="post"> but reverse proxy: <form action="/initiationsearchresults/getadminsearchresults?length=23" id...

windows phone 8 - How to update old navigation service -

i looking @ on-line documentation navigationservice , see takes uri , object... the navigation service on system takes uri. public bool navigate(uri source); here path referenced dll: c:\program files (x86)\reference assemblies\microsoft\framework\silverlight\v4.0\profile\windowsphone71\microsoft.phone.dll runtime version : v2.0.50727 version : 7.0.0.0 how can update system use new navigation service? thanks the navigationservice ( reference ) class windows phone 8 contains single navigate method ( reference ): public bool navigate( uri source ) it you're looking @ documentation windows presentation foundation ( reference ). i use home page windows phone development , search bar @ top sure i'm looking @ apis supported windows phone (it pre-filters when use search). using full search engine, google, misleading point pages seem correct many msdn pages have link "windows phone" on them.

How to add values of duplicate keys in associative arrays, using Shell Script? -

i'm having trouble removing duplicate keys lower value. i've used while loop loop through file while read key value . the original text file looks this: meson 6 electron 5 meson 12 neutron 10 proton 5 hadron 7 neutron 10 proton 2 proton 8 this output far using associative arrays in shell: electron 5 hadron 7 meson 18 meson 6 neutron 10 neutron 20 proton 15 proton 5 proton 7 i summed values of same keys want remove key lower value. my desired output this: electron 5 hadron 7 meson 18 neutron 20 proton 15 is there way of returning higher value , finishing off script sort ? using bash version 4 -- sh not have associative arrays declare -a sum while read key value; ((sum[$key] += value)); done <file key in "${!sum[@]}"; echo $key ${sum[$key]}; done proton 15 neutron 20 hadron 7 electron 5 meson 18 associative array keys have no natural ordering. can pipe loop sort or sort -k2n if wish.

multithreading - designing a 10 threaded process -

i have 500 odd data-files lying in directory. processing these files using command . problem picks each serially , of course utility moment process spawns 500 processes , staggers them in batches of 10 each interspersed wait . . 1 file == 1 process per design. command1 <parameters> > log 2&>1& command2 <parameters> > log 2&>1& command3 <parameters> > log 2&>1& command4 <parameters> > log 2&>1& /# ....till 10 wait command11 <parameters> > log 2&>1& command1 <parameters> > log 2&>1& command1 <parameters> > log 2&>1& /# ...till 20 wait command1 <parameters> > log 2&>1& so dont pound system away @ same time. command series of shells , c code parses data files , checks, involve connecting oracle. i'd re-design every-time command runs don't open new db connection. lets there 100 files . want open 10 db connectio...

c - dynamic strings in struct -

i having problem understanding concept of dynamic memory allocation, have code encountering segfault perhaps 1 may have insight? #include <stdio.h> #include <stdlib.h> typedef struct tname { char **stringa; int capacity; } tname; tname *createtname(int length); tname *destroytname(tname *l); int main(void) { tname *ll = createtname(10); } tname *createtname(int length) { tname *temp; int i; temp->capacity = length; temp->stringa= (char**) malloc(sizeof(char*) * length); for(i=0;i<length;i++) temp->stringa[i] = (char*) malloc(sizeof(char)*50); return temp; } when call run program segfault, can assist me please? your problem here: temp->capacity = length; you asigning value variable, doesn't have memory yet. have allocate memory struct to. use this: tname *temp = malloc( sizeof(tname) ); if write tname *temp , compiler allocate 4 bytes (or 8 in 64bit systems) pointer. wont't al...

javascript - create fluid (scaling) concentric arcs using css, canvas, or svg -

i trying create graph this: http://bl.ocks.org/cmdoptesc/6228457 or this http://raphaeljs.com/polar-clock.html but want able scale (preferably without javascript) according browser width. love able css only, , if not css, preferably without library raphael or d3 (though i'll take can get). know how accomplish in way scales down / up? update i made js fiddle - graph want: http://jsfiddle.net/q9hb5/ but need resize. using raphael, , read svg resizing here: http://bertanguven.com/?tag=raphael-js and here: http://www.justinmccandless.com/blog/making+sense+of+svg+viewbox%27s+madness but don't want have resize js - i'd able svg properties such viewbox , preserveaspectratio , still haven't seen example accomplishes this. any ideas? since don't want use javascript libraries, assume creating svg image ahead of time and/or on server, , transmitting static svg code user. canvas images, in contrast, made javascript. (if want dynamicall...

c# - ServiceStack iterate through all request/response DTO -

how can iterate through request/response dtos setup route? for example route this: [route("/api/something", "get")] public class somethinggetrequest : ireturn<list<something>> { public int somethingid { get; set; } } and response dto this: public class { public string { get; set; } public int b { get; set; } } i want have service action can iterate through setup routes, , retrieve the: request url class name request properties response dto properties is there servicstack built in way this? in end use autogenerate extjs store/models. i'm interested in better/alternative approach. edit: here solution came with: gist on /extjs/javascript route service returns extjs store/models , on /extjs/metadata route service returns zip file store/model folder can drop in newly created sencha architect project. templates based on architect v. 3.0.1.1343 produces. this assumes route decorated this: [route("/api/s...

javascript - Can you add an object to an array inside its constructor -

i'm trying add objects array specific id need know inside constructor. work? objectarray = []; function newobject (name, age, eyecolour) { this.name = name; this.age = age; this.eyecolour = eyecolour; var id = *some integer* this.id = id; objectarray[id] = this; //this line in question. } obviously example. in real code i'm using id in id of 3 new dom objects, need have available inside constructor. if id number work, arrays meant accessed index. see time in code , being in constructor not matter long objectarray declared globally: var arr = ["one", "two"]; for(var =0; < arr.length; i++){ alert(arr[i]); } if id not number working object. var obj = {one: 1, two: 2}; alert(obj["one"]); here example using code: var objectarray = [] function newobject (name, age, eyecolour) { this.name = name; this.age = age; this.eyecolour = eyecolour; var id = 3 this.id = id; objectarray[id] = this;...

android - Show/Hide two fragments in a single Layout [Both fragments have a Google map each] -

i have activity relative layout; , have 2 different fragments. show 1 fragment , switch next fragment on button click vice verse. // when button menu clicked onclicklistener btnclick = new onclicklistener() { @override public void onclick(view arg0) { if(currenttype==0){ initthisfragment(1); }else{ initthisfragment(0); } } }; public void initthisfragment(int type){ fragment newfragment; if(type==0){ newfragment=new mainfragment(); }else{ newfragment=new journeyfragment(); } currenttype=type; fragmenttransaction transaction = getsupportfragmentmanager().begintransaction(); transaction.replace(r.id.abs_fragment_container, newfragment); transaction.addtobackstack(null); transaction.commit(); } r.id.abs_fragment_container relative layout both fragment contain google maps inside them; but not working expected. by de...

javascript - How to check if the css animation is done in my case? -

i trying detect if css animation ended in app. i have following animation.prototype.nextstage = function(){ this.ball.show().addclass('stage' + this.stage); //start animation this.ball.on('animationend mozanimationend webkitanimationend oanimationend msanimationend',function(){ //when animation ended, animation item itself…. }) } animation.prototype.isended = function(){ // sure how check if animation ended outside of animation obj. } function main(){ this.ball = new animation (); } main.prototype.checkanimation = function(){ this.ball.nextstage(); if(this.ball.isended){ //do stuff not part of animation items.. } } i not sure how check if ball animation done in main object. can me it? lot! this way add new event handler each time call nextstage . it'll better use like: function animation(ball, completecallback) { var self = this; this.isended = false; t...

How to type the dot in github markdown list? -

i try use markdown format write list in readme file. but in the github flavoured markdown , using dot "⋅" not period( "." ) indicate align list. how type such dot regular us/english keyboard? tried copy , paste github, it's not work. thanks. have tried * (asterisk) points? "dots" in link spaces. put in manual can visualize spaces, not literal "dot" character. like: this point this subpoint this point. this subpoint what mean is: first ordered list item another item unordered sub-list. actual numbers don't matter, it's number ordered sub-list and item. you can have indented paragraphs within list items. notice blank line above, , leading spaces (at least one, we'll use 3 here align raw markdown). to have line break without paragraph, need use 2 trailing spaces.⋅⋅ note line separate, within same paragraph.⋅⋅ (this contrary typical gfm line break behaviour, trailing spaces not required....

ruby on rails - Capistrano 3 + AWS: Deployment Issues -

the issue i'm running error when try push production: deploy has failed error: #<net::ssh::authenticationfailed: ec2-user> i've tried quite few stackoverflow solutions, no avail. deploy.rb is set :user, 'ec2-user' set :application, 'name of application on git' set :repo_url, 'the url remote origin git' set :deploy_to, 'where apache points minus /public' my production.rb is role :app, %w{ip} role :web, %w{ip} (same above) role :db, %w{ip} set :ssh_options, { user: "ec2-user", keys: %w(location .pem file use ssh in on), forward_agent: false, } i have tried creating new keys both , using outlined here http://craiccomputing.blogspot.com/2008/08/ec2-ssh-and-capistrano.html cap uses admin instead of ec2-user but still no dice. thoughts? you can check permissions on /home/ec2-user/.ssh directory , `/home/ec2-user/.ssh/authorized_keys file. should this: ec2-user@ec2-server:~/.ssh$ ls -la total 24 ...

c# - Passing value to another class -

hi learn how pass values. have 2 sets of arrays: moment array , curvature array. each array read textfile clicking button in mainwindow class shown below. public partial class mainwindow : window { public mainwindow() { initializecomponent(); } private void button_click(object sender, routedeventargs e) { input ip = new input(); double[] curvature = new double[40]; double[] moment = new double[40]; string path; path = "c:\\desktop\\48co.out"; string[] records = file.readalllines(path); int linenumber = 0; string[][] rows = new string[40][]; (int = 0; < records.length; i++) { if (records[i] == "step epscmax in. tens. comp. comp. tens. force force rad/in (k-ft)") { linenumber = + 1; } } (int = linenumber; < linenumber + 40; i++) { rows[i...

ios - UINavigationController back button title inconsistent? -

i use uinavigationcontroller in app , having issue button titles. have title programmatically set page push to. on of pages button correctly display previous pages title, on select other pages says 'back'. i have basic implementation on pushing new vc: - (void)pushtonewvc { newvc *newvc = [[newvc alloc] init]; [self.navigationcontroller pushviewcontroller:newvc animated:yes]; } in viewdidload of newvc/all of myvc's have self.title = @"title" . the problem in cases works, in others in 'back' rather previous pages title. i've noticed similar behavior if button's title length won't fit in navigation bar title of pushed vc, button's title fallback < back . on vcs inconsistent behavior happening, try setting title of pushing vc shorter word test , confirm if indeed what's happening. hope helps.

configuration - When scrolling my tmux automatically scroll down -

i using tmux (i connect linux exceed on ssh) added magical set -g terminal-overrides 'xterm*:smcup@:rmcup@' enable mouse scrolling , works nicely ! though have problem, when scroll middle button reason cursor down page (like if entering q). don't know if refresh thing or... i add .tmux.conf file in case # change prefix key c-a screen , c-a-a send # session within session unbind c-b set -g prefix c-a bind-key send-prefix # toggle last screen bind-key c-a last-window bind-key c-c new-window # readable status line set -g status-bg blue set -g status-right "%y-%m-%d %h:%m:%s" set -g status-interval 1 # misc tweaks #set -g display-time 3000 set -g history-limit 5000 #set -g bell-action #set -g visual-activity on #set -g visual-bell on # sane scrolling set -g terminal-overrides 'xterm*:smcup@:rmcup@' # bellow allow scrolling mouse (enter normal browsing mode automatically) #set -g mode-mouse on set -g status-right "%y-%m-%d %h:%m:%s...

html - Image won't appear as background when site is live -

i trying background image show when site live. works when in development environment. once uploaded, defaults background color. have checked several times ensure proper file name being used , other aspects work required. following code in main.css file. body { background-color: #f2f2f2; font-family: "lato"; font-weight: 300; font-size: 16px; color: #555; padding-top: 150px; background-image: url(../img/img_0234.jpg); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } when use devtools on google chrome following response : failed load resource: server responded status of 404 (not found) http://josejrvazquez.com/assets/img/img_0234.jpg event.returnvalue deprecated. please use standard event.preventdefault() instead. the file can found @ http://jo...

iphone - Reduce Bluetooth LE transmitting power iOS 7 -

is possible change/reduce transmitting power (== range) of bluetooth le module in ios7 devices (iphone 5, 5s) programmatically? far know, iphones have bt class 2, can set class 3? perhaps it's possible using bt custom profiles (can use them in ios?) thanks time no, can't. there no public api in core bluetooth or other official frameworks that. handled exclusively os , there not means read out inside device.

html - PHP - make a link active based on folder name -

this easy 1 i'm getting started php. i'm attempting create universal header , want use php make links have css class based on folder structure of currant url. the idea have 3 levels of navigation, level 1 set first folder, level 2 set subfolder, , level 3 set name of php file. for example if have url www.mysite.com/home/aboutus/history.php?id=1 the option "home" active on level 1 of menu "aboutus" active on second level , "history" active on 3rd level html <a href="#"><div class="menu-1-button"> <p class="menu-1-button-text">option1a</p></div></a> <a href="#"><div class="menu-1-button"> <p class="menu-1-button-text">option1b</p></div></a> <a href="#"><div class="menu-1-button"> <p class="menu-1-button-text">option1c</p></div></a> ...

How to make a SOAP call with dot42? -

i have following code. know webrequests , such should in async calls wanted proof of concept. using system; using android.app; using android.os; using android.widget; using dot42; using dot42.manifest; using system.xml; using system.net; using system.io; using system.text; [assembly: application("dot42application6")] namespace dot42application6 { [activity] public class mainactivity : activity { protected override void oncreate(bundle savedinstance) { base.oncreate(savedinstance); setcontentview(r.layouts.mainlayout); string soap = @"<?xml version=""1.0"" encoding=""utf-8""?> <soap:envelope xmlns:xsi=""http://www.w3.org/2001/xmlschema-instance"" xmlns:xsd=""http://www.w3.org/2001/xmlschema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""> <soap:body><getcol...

javascript - showing a search result using Ajax -

i trying use ajax display result of search not working , cannot find out why. here .html file contain ajax too. js function showsearchresult() { alert('beginning'); if (document.getelementbyid("search").value == "") { document.getelementbyid("searchresult").innerhtml = ""; return; } try { xhr = new xmlhttprequest(); } catch (e) { xhr = new activexobject("microsoft.xmlhttp"); } // handle old browsers if (xhr == null) { alert("ajax not supported browser!"); return; } var string = document.getelementbyid("search").value; var url = "quote4.php?search=" + string; xhr.onreadystatechange = handler; xhr.open("get", url, true); xhr.send(null); } function handler() { // handle loaded requests if (xhr.readystate == 4) { if (xhr.status == 200) document.getelementby...

timezone - Need a SQL Server function to convert local datetime to UTC that supports DST -

we migrating application azure, of our dates stored eastern standard time. since sql azure on utc , many of our dates generated getdate() call, we're going have issues if leave is. seems option provide least long term headache convert of our stored dates utc, , have them converted local time on front end. unfortunately seems there isn't built-in way convert sql datetime 1 time zone another, , many of solutions i've found don't take daylight savings time consideration. solutions i've found consider dst involve importing calendars , time zone tables , extremely complex. i'm looking work single conversion, , doesn't have pretty. ideas? update: wrote following function believe accomplish need. see holes this? of dates eastern standard time, dates start around 2002 had handle law change in 2007. i'm thinking use function this: update mytable set mydate = dbo.fnesttoutc(mydate) here's function: create function [dbo].[fnesttoutc] ...

c# - trying to send email from database value -

i have method returning email address string chunk of code sends email, i'm getting error: "the specified string not in form required e-mail address." here's method returns email address: public static string getsignerbyid(int signerid) { using (dbpsrentities10 myentities = new dbpsrentities10()) { var thisid = myentities.refauthsigners.where(x => x.refauthsignerid == signerid).select(x => x.networkemail).tolist(); var formattedvalue = thisid.tostring(); return formattedvalue; } } here's code sends email: //method send approved email public static void sendapprovedemail(string contactfirstname, string contactlastname, string contactemail, int signer) { //email 1 string filename = httpcontext.current.server.mappath("~/app_data/approvedemail.txt"); string mailbody = file.readalltext(filename); mailbody = mailbody.replace("##contactfirstname##", conta...