Posts

Showing posts from September, 2015

java - Limit RAM usage Eclipse -

this question has answer here: setting memory of java programs runs eclipse 2 answers i'm writing java program using eclipse ide (kepler service release 1) causing jvm hog more memory needs. don't run out of ram fan ramps up. i'd experiment limiting jvm's seemingly godlike power on system memory. apparently there way start jvm switch limit amount of ram allow program consume. know there setting in eclipse.ini file ide itself. want limit ram usage java program when start in dev/debug mode. know how might accomplished? set vm arguments specific run configuration can found at run → run configurations → arguments tab → vm arguments you can -xms512

php - regex find input value -

the string is: <input type="hidden" name="billing[address_id]" value="34543" id="billing:address_id" /> how can input value string? tried code: preg_match('/<input type="hidden" name="billing[address_id]" value="(.*?)" id="billing:address_id" \/>/mis', $html, $results); your regex correct.. escape [ , ] @ address_id. preg_match('/<input type="hidden" name="billing\[address_id\]" value="(.*?)" id="billing:address_id" \/>/mis', $html, $results);

.htaccess - Mod_rewrite, first rule works perfectly, second rule does not -

i have 2 mod_rewrite rules, defining category , product . products displayed in categories, , clicking on product comes product page: this works: http://www.example.com/ele/electricalgoods/ takes code value "ele" , uses rewrite call /view_category.php?cat=ele . works perfectly, using following mod_rewrite: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]*)/([^/]*)/([^/]*)$ /show_category.php?catcode=$1&page=$3 [nc] (this includes further "folder" pages in category view such http://www.example.com/ele/electricalgoods/3/ ) however, underneath in htaccess file want have similar rewrite so: http://www.example.com/product/el063/earphones/ rewrites to: /view_product.php?prodid=el063 i did this htaccess code: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^product/([^/]*)/([^/]*)$ /show_product.php?prodid=$1 [nc,l] but somehow doesn't work expected, want pro...

php - No input file specified while using Nginx -

i create server recently, , use nginx web server. i did : service nginx force-reload reloading nginx configuration nginx [ ok ] then service nginx status nginx running knowing site running, when go it. see no input file specified. wired ??? here have in /etc/nginx/sites-available/default server { listen 80 default_server; server_name default; root /default/public; can please me fix ? i fix problem assign document root correct path : root /home/forge/default/public; if see no input file specified. , make sure set root correct path.

ftp - Website offline viewing/editing -

i went end ftp website , downloaded c drive. question show in browser normal address different beginning, ex. file:///c:/folder/www.websitename.com or type in access pages? need heavy lifting on , don't want site while live. dev site redirects main site , can't find in htaccess file reroutes i'm gonna try way. thanks! the path this: file:///c:/folder/filename.html you can open file in browser by: opening file menu in browser. if editing in tool notepad++, there should option launch page you're editing in browser. (in notepad++ it's under "run" menu) go file in windows explorer/finder, right click file, select "open with", , pick browser want see page in.

linux - Should I always use GAWK over AWK? -

i see features of awk included in gawk, besides using system doesn't have gawk installed, there ever reason should use awk versus gawk? awk have better performance on gawk? awk can refer many things. there's awk -the-standard , , there's many different implementations, 1 of gawk . not using implementation-specific features means you'll have high(er) chance code run unchanged on other implementations of awk -the-language. gawk , being 1 implementation of awk -the-language, claims conform awk -the-standard, while adding features. $ man awk … description gawk gnu project's implementation of awk programming language. conforms definition of language in posix 1003.1 standard. version in turn based on description in awk programming language, aho, kernighan, , weinberger. gawk provides additional features found in current version of brian kernighan's awk , number of gnu-specific extensions. … as speed, using gawk ...

Drupal 7 Date module All day otpion -

i using drupal 7 date module. have enabled , created date field date, time , day option in content type. created node of content type, set date 04/25/2015, checked day option , saved node. after saving node can see date field value being saved 04/24/2015 00:00:00 in database. expecting saved 04/24/2015 23:59:59. can 1 please me how achieve this? in advance good morning. should modify submitted info after submision of form. have @ hook_node_presave() , hook lets alter node before inserted database. hope helps.

bash - Delete <feff> from text file, UTF 8 -

i use bash script filter text 1 text file another. text encoded in utf 8. #!/bin/bash mid=$1 infile="/var/www/tmp/textgrid_uploads/${mid}.txt" outfile="/home/var/www/vids/$mid/${mid}_textgrid.mlf" tmpfile="/home/var/www/vids/$mid/${mid}.tmp" i=1 touch $tmpfile cat $infile | grep "text =" | cut -d '"' -f2 | tr -d ',' | tr -d '.' | tr -d ':' | tr -d ';' | tr -d '!' | tr -d '?' > $tmpfile #| awk '{ print tolower($0) }' #cat $infile | grep -v "<" | egrep -v '^[[:space:]]*$' | tr -d '.' | tr -d "," | tr -d ";" | tr -d ":" | tr -d "^" | tr -d '#' | tr -d '?' | tr -d '!' | tr -d '%' | tr -d '@' | tr -d '*' | tr -d '~' | grep -v '((xxxxx))' | awk '{ print tolower($0) }' > $tmpfile #cat $infile | grep -v 'webvtt' | grep...

python - Delete tab character from config files -

i using function read config file. import numpy np stream = np.genfromtxt(filepath, delimiter = '\n', comments='#', dtype= 'str') it works pretty have problem: tab character. i.e. output ['\tvalue1 ', ' 1'] ['\t'] ['value2 ', ' 2'] is there way ignore special char? my solution that: (it works purposes it's bit "ugly") result = {} el in stream: row = el.split('=',1) try: if len(row) == 2: row[0] = row[0].replace(' ','').replace('\t','') #clean elements not needed spaces row[1] = row[1].replace(' ','').replace('\t','') result[row[0]] = eval(row[1]) except: print >> sys.stderr,"fatal error: '"+filepath+"' missetted" logging.exception(sys.stderr) sys.exit('') to replace tabs nothing: stre...

cql - What is the compatible gcc version for cassandra c++ driver -

i installed cassandra c++ driver http://datastax.github.io/cpp-driver/topics/building/ i trying compile sample program given in http://datastax.github.io/cpp-driver/ i getting below errors: g++ -lcassandra -lgcc_s basic.c -o basic /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_val_compare_and_swap_4' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_fetch_and_sub_8' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_fetch_and_add_8' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_lock_test_and_set_8' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_val_compare_and_swap_8' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undefined reference `__sync_fetch_and_sub_4' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libcassandra.so: undef...

Can anyone help me with estimote beacons sample android code to start with? -

hello started estimote beacons , trying build sample application finding beacons range , send notifications mobile devices when beacons near range. this how set beacons. first want service class: public class beaconservicing extends service { private static context context; private static final region all_beacons = new region(beaconconfig.global_region_id, beaconconfig.uuid, beaconutils.all_major, beaconutils.all_minor); private static beaconmanager beaconmanager; public static beaconmanager getbeaconmanager() { if (beaconmanager == null) { beaconmanager = new beaconmanager(context); } return sbeaconmanager; } @override public void oncreate() { super.oncreate(); context = this; startbeaconing(); } @override public ibinder onbind(intent intent) { return null; } private void startbeaconing() { if (beaconutils.iscapable()) { beaconmanager = getbeaconmanager(); beaconmanager.seterrorlistener(new beaconerror()); ...

Rails i18n list of items and looping in view -

how can list elements in yml , loop through them in view , access properties? current code gets last item in list. want loop through in view list of items , display title , description elements. e.g. yml: en: hello: "hello world" front_page: index: description_section: title: "mytitle" items: item: title: "first item" description: "a random description" item: title: "second item" description: "another item description" view: <%= t('front_page.index.description_section.items')do |item| %> <%= item.title %> <%= item.description %> <%end %> result: {:item=>{:title=>"second item", :description=>"another item description"}} desired result: first item random description second item item description ...

python - Pygame Midi Multi Instrument -

is possible play multiple instruments @ same time in pygame.midi? solution found note on, change instrument, other note on, note off, note off but think not proper way. there alternative? each instrument want use should on own midi channel (0..15). set using set_instrument(instrument_id, channel) method. then pass channel number of instrument want send note on/off message using note_on(note, velocity, channel) , note_off(note, velocity, channel) methods.

javascript - bootstrap modal click on div appears once -

i've used bootstrap modal when click on div modal pops up. however, on clicking close, if click on div modal not pop again. wondering how can this. the html: <div class="col-sm-3 col-lg-3" id="userdiv"> <div class="modal fade " data-backdrop="false"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> <p>one fine body&hellip;</p> </div> <div class="modal-footer...

kubernetes - How to use OAuth2.0 to authorize Google Container Engine APIs -

i trying make call using google container engine api via browser. have created both client id , public api access key. when try use public api access key, unuauthorized: https://www.googleapis.com/container/v1beta1/projects/cohesive-feat-92204/clusters?fields=clusters%2fmasterauth&key=xxxxxxxxxxxxxxx (where xxxxx... key) is there document describes required values call? how specify client id , client secret etc...where put in scope, etc... this link https://cloud.google.com/container-engine/docs/v1beta1/libraries gives me 404 this same question google container engine rest api authorization , answer public api access key cannot used access google container engine api.

Python OpenCV output on Tkinter label deletion -

i trying delete tkinter label displaying webcam stream made opencv. made happen not way wanted because stops stream last image outputted stream still present. code this: from tkinter import * import cv2 pil import image, imagetk def start(): width, height = 800, 600 cap = cv2.videocapture(0) cap.set(cv2.cv.cv_cap_prop_frame_width, width) cap.set(cv2.cv.cv_cap_prop_frame_height, height) def show_frame(): _, frame = cap.read() frame = cv2.flip(frame, 1) cv2image = cv2.cvtcolor(frame, cv2.color_bgr2rgba) img = image.fromarray(cv2image) imgtk = imagetk.photoimage(image=img) lmain.imgtk = imgtk lmain.configure(image=imgtk) lmain.after(10, show_frame) show_frame() root = tk() lmain = label(root) lmain.pack(side = right) button1 = button(root, text = "start", command = start) button1.pack(side = left) button2 = button(root, text = "stop", command = start) button2.pack(side = le...

java - Access SSL-Parameters in connections via Hibernate -

i using hibernate java application uses sessionfactory create connections , sessions. using postgresql database pass proper jdbc connectionstring build sessionfactory , sessions afterwards. thing im able access jdbc4connection. how able read ciphersuite used within secured connection, ssl protocol used etc? here how initialize sessionfactory: configuration configuration = new configuration(); properties p = configuration.getproperties(); p.setproperty("hibernate.connection.url","jdbc:postgresql://127.0.0.1:5432/postgres?ssl=true&sslfactory=org.postgresql.ssl.nonvalidatingfactory"); p.setproperty("hibernate.connection.username", "myusername"); p.setproperty("hibernate.connection.password", "mypassword"); p.setproperty("hibernate.connection.driver_class", "org.postgresql.driver"); p.setproperty("hibernate.dialect", "org.hibernate.dialect.postgresqldialect...

c++ - Overloading operator+ with pointers -

i'm working on project on polymorphism in c++ , have lots of pointers. need overload operator +, can write following expression naturally: c=a+b; with a,b , c being declared as: a *a,*b,*c; the basic overloading definitions know are a &operator+(const a& a) &operator=(const a& a) but following errors: invalid initialization of non-const reference of type 'a&' rvalue of type 'a* const' invalid operands of types 'a*' , 'a*' binary 'operator+' how should write overloaded operator can call naturally? i know following suggestion not want, sake of completeness tried find solution template wrapper class around pointers would permit overloading operator+. wondered combination of lookup rules, template arguments , type conversion achieve. turns out "natural" use of operator+ seems impossible, explicit call works. here code: /** wrapper class around arbitrary pointer types */ template<c...

php - Retrieveing data from database results in 0 results -

i've got multiple entries in database, yet php code returns 0 entries. here's php: error_reporting(e_all); ini_set('display_errors', 1); $conn = new mysqli($host, $user, $pass, $databasename); // check connection can established if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select charts_url, charts_date, charts_retrace, charts_start_of_swing_trade, charts_end_of_swing_trade, charts_bull_flag, charts_bear_flag, charts_ema_crossover, charts_trading_instrument charts"; $result = $conn->query($sql); if($result && $result->num_rows > 0) { // output data of each row echo " <table> <tr> <td><strong><u>chart</u></strong></td> <td><strong><u>date</u></strong></td> <td><strong><u>retrace</u></s...

javascript - Does run mongoskin only with mongodb version 1.4 and older? -

i'm trying understand nodejs, express , mongodb i'm running mongodb v 2.0.6 , latest nodejs , express , trying connect express application mongodb through mongoskin. problem is: npm err! peerinvalid package mongodb not satisfy siblings' peerdependencies requirements! npm err! peerinvalid peer mongoskin@1.4.13 wants mongodb@~1.4 does mean mongoskin can work mongodb v 1.4? version old me (current 3) it's expecting version 1.4 of mongodb driver , not database. you should remove 2.0.6 version of driver, mongoskin doesn't work yet ( issue ), , install 1.4 version instead: $ npm uninstall mongodb $ npm install mongodb@~1.4 [--save] $ npm install mongoskin [--save] (however, i'm not sure if 1.4 driver works 3.x databases)

jquery - Is it possible to edit a CSS style after bootstrap has done it's magic? -

i totally new bootstrap , not brill jquery apologies if stupid question. possible hook jquery event page called after bootstrap has worked out go in grid. want modify background image in css class depending on layout bootstrap sets. what check dom ready know bootstrap done. don't think can edit css classes directly jquery, have 2 css classes differ background image, set elements use other class jquery after checking whatever conditions looking for.

laravel - Storing remember_token to a separate table than users? -

is possible set table & column store remember tokens? know framework tries automatically find remember_token column in "users" model, want store separately users. there way configure default tokens table? thank you p.s - i'm using laravel 5 first, need create separate model storing remember tokens , define relationship on user model so public function remembertoken() { return $this->hasone('remembertoken'); } then need override methods on user model, defined in authenticatable trait. override getremembertoken() , setremembertoken() methods. need override getremembertokenname() used in where clause in eloquentuserprovider::retrievebytoken() see eloquentuserprovider line 60. in order work have add global scope user model join remember_tokens table on every query, , return 'remember_tokens.token' getremembertokenname() method. think twice seems more trouble worth. why want store tokens separately anyway?

javascript - Video not growing in height -

after transferring website site 1 domain other, new about page reason shrinking video. findings div holding iframe seems not growing more 181px. if grows, video automatically re-adjusts , grow. working on old link can please check me see causing second link not work correctly first. video located @ top , main video. link good video : http://rossiterandco-2.hs-sites.com/about-us link bad video : http://rossiterandco-1.hs-sites.com/about some of rules of stylesheet have changed. need add back/modify following rules hubtheme-style.min.css: .hs-responsive-embed iframe, .hs-responsive-embed object, .hs-responsive-embed embed { position: absolute; left: 0; } .hs-responsive-embed, .hs-responsive-embed.hs-responsive-embed-youtube, .hs-responsive-embed.hs-responsive-embed-wistia, .hs-responsive-embed.hs-responsive-embed-vimeo { padding-bottom: 56.25%; } the best way find these problems in future beautifying stylesheets , using diff tool. recommend using dif...

ios - Forcing a UIView to redraw its contents inside of an animation block -

Image
i have superview , subview b. in a's drawrect(_:) line drawing depends on position , size of subview b. in class (but not in drawrect(_:) ) have animation block moves , scales b. the problem drawing in drawrect(_:) happens before animation takes place, either using final position , size of subview or using initial position , size, never using intermediate values. case 1: drawing uses final state the image below screen shot of simulator while animation scales subview in progress. note how lines drawn in final state. the code line drawing in a's drawrect(_:) . code animation (it's in class self refers superview): uiview.animatewithduration(3.0, delay: 0.5, options: uiviewanimationoptions.curvelinear, animations: { [unowned self] in self.subviewwidthconstraint.constant = 0.75 * cgrectgetwidth(self.bounds) self.layoutifneeded() self.setneedsdisplay() // has no effect since self's bounds don't change })...

javascript - Jquery settimeout not waiting to redirect -

well, trying set timer on redirect webpage, when use settimeout not work. settimeout(function() { window.location.replace("https://github.com/riggster""); }, 2000); it redirects me, not wait 2 seconds. , not sure why. $(document).ready(function () { var gsb = $('.github-side-bar'); var rd = $('.redirectnotice'); gsb.on('click' , function() { $('html, body').animate({ scrolltop: 0 }, 500); rd.show('slow'); settimeout(function() { window.location.replace("https://github.com/riggster""); }, 2000); }); associated html: <a href="#top" class="back-to-top"><img src="./asset/img/btt.ico" width="32" height="32" /></a> <a href="https://twitter.com/euanriggans" class="twitter-side-bar"><img src="./asset/img/twitter.ico...

oracle - ORA-00932: inconsistent datatypes: expected CHAR got NUMBER while adding 1 to a date -

probably silly mistake, couldn't figure out myself. when run query in oracle 11g. if question answered in so, please let me know link. with last_business_day (select decode(to_char(last_day(to_date('29-mar-2013')), 'd'), , '7', to_char((last_day('29-mar-2013') - 1), 'dd-mon-yyyy') , '1', to_char((last_day('29-mar-2013') - 2), 'dd-mon-yyyy') , to_char(last_day('29-apr-2013'), 'dd-mon-yyyy')) last_bd dual), holidays (select distinct rpt_day rpt_days rpt left join calendars cal on rpt.calendar_id = cal.calendar_id rpt.type = 2 , cal.group = 4) select case when to_char(to_date(last_bd, 'dd-mon-yyyy'), 'd') null last_bd else decode(to_char(to_date(last_bd, ...

javascript - Real time charts with D3.js -

i totally new d3.js. trying create simple sparkline time on x axis , numbers upto 1000 on y axis. have web socket server pushes random numbers unto 1000 clients. plot graph these values on y axis , time (in 24 hrs format) on x axis. tried few things, none of them work properly. graph turns out vertical , displayed sometimes. appreciate in getting working. below have in code, tweaked version of example found online. data[] populated web socket call. var margin = {top: 20, right: 20, bottom: 20, left: 40}, width = 960 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; var x = d3.scale.linear() .domain([0, data[data.length -1]]) .range([0, width]); var y = d3.scale.linear() .domain([0, 100]) .range([height, 0]); var line = d3.svg.line() .x(function(d, i) { var dt = new date(); var time = dt.gethours() + ":" + dt.getminutes() + ":" + dt.getseconds(); return dt.getseconds(); ...

printf - Weird Symbols printed at end of string - C -

so, i've got program parses expressions in line of text such as 11110000 & 11001100 ; and evaluates binary results. code parsing correctly , evaluating correctly, 2 of test inputs (including 1 above) printf printing these weird symbols after each run. eos$ ./interpreter < program02.txt 11000000 + eos$ ./interpreter < program02.txt 11000000 2ñ eos$ ./interpreter < program02.txt 11000000 "] eos$ ./interpreter < program02.txt 11000000 ÒØ eos$ ./interpreter < program02.txt 11000000 Ê eos$ ./interpreter < program02.txt 11000000 òj the string malloc'd this char *str = ( char * ) malloc ( ( getlength( src ) + 1 ) * sizeof( char ) ); and here how string printed char *str = binarytostring( val ); printf( "%s\n", str ); any awesome! thanks! strings null terminated in c. when malloc() memory, filled whatever in block previously. one solution fill buffer null character \0 via memset() (found in string.h ) after using ma...

c - AVL tree insert function -

avltree insert( elementtype x, avltree t) { 1 if( t == null) 2 { 3 /* create , return one-onde tree */ 4 t = malloc( sizeof( struct avlnode ) ); 5 if( t == null ) 6 fatalerror( "out of space!!!"); 7 else 8 { 9 t->element = x; t->height = 0; 10 t->left = t->right = null; 11 } 12 } 13 else 14 if( x < t->element ) 15 { 16 t->left = insert(x, t->left ); 17 if( height( t->left ) - height( t->right ) == 2 ) 18 if( x < t->left->element ) 19 t = singlerotatewithleft( t ); 20 else 21 t = doublerotatewithleft( t ); 22 } 23 else 24 if( x > t->element ) 25 { 26 t->right = insert( x, t->right ); 27 if( height( t->right ) - height( t->left ) == 2 ) 28 if( x > t->right->element ) 29 t = singlerotatewithright( t ...

In eclipse, can we change font style of a section of code, unlike the global? -

we know can change font styles eclipse editors globally. let's want change font particular block of code or line of code selecting text word processing software. life easier if went through big classes , color-coded block of code different styles. i not sure if there way can change font of section of code in eclipse. but, can use plugins editbox highlight sections of code in eclipse. editbox configurable can create own color presets. hope helps :) try: http://editbox.sourceforge.net/

javascript - How to open a local PDF in a Windows 8/Cordova app? -

i have ios app built i've been tasked port on windows 8 use on windows tablet. app downloads files dropbox, gets stored in local folder. can see of works fine. able reference images using ms-appdata:///local/" + filename in src of img tag, , i'm able play mp4s same folder using html5 video tags. my problem is, ios version, using cordova's inappbrowser open local pdfs on windows 8 version, doesn't work. i using following code ( filename equals [1]casestudy-ac_en_04.pdf , exist on file system): var ref = window.open("ms-appdata:///local/" + filename, '_blank', 'location=no'); and following error in visual studio when run simulator apphost9607: app can't launch uri @ ms-appdata:///local/[1]casestudy-ac_en_04.pdf because of error: -2147024846. i've tried switching winjs coding methods, tried loading pdf in iframe nothing work. don't mind kicking user out internet explorer if must... need way user see these local...

c# - SSIS Web Service Task XmlNode Input POSSIBLE? -

Image
i've scoured internet past 2 weeks , tried many different ways i'm beginning think might not possible via web service task in ssis. i've created web service task in ssis using provided wsdl - see screenshot below. as can see requirement web service method pass in xml node contains filter items so: <filteritems><filteritem filteritemid="12345">4/20/2015 12:00:00 am</filteritem></filteritems> this "filteritems" node nested in between xml element named "templatevalues" - see soap body: <soap:body> <getreportresults xmlns="https://service.service.com"> <username>string</username> <password>string</password> <reportid>int</reportid> <templatevalues>xml</templatevalues> </getreportresults> the problem i'm facing when go chose data type in variable list in ssis, there no xml data type have use string. funny part can use so...

javascript - How to detect more then 2 second the touchscreen was pressed? -

using google chrome , canary. how detect more 2 second touchscreen pressed? (with mouse works real-touch screen failing, tested on surface pro 3) $(document).ready(function() { var clickstart; var clickstop; $(document).bind('contextmenu', function() { console.log('touch screen, has no right click.'); return false; }); $(document).mousedown( function() { return false; }); // usb mouse pointer works, real-touch screen not working $('#vip_anytime').on('mousedown', function(e) { clickstart = e.timestamp; }).on('mouseup', function(e) { clickstop = e.timestamp- clickstart; if(clickstop >= 2000) { console.log('>>> after 2 second of hold'); } else { console.log('>>> before 2 second of hold'); } }); }); try touchstart , touchend events. $('#vip_anytime').on('touchstart', function(e) { ...

html - how to open a div link into the same div -

i want links on <div id="content"> open on same <div id="content"> . don't want links open new pages , don't want go out of index file. in other words, want use homepage browser. there easy way it? you need use templates , routing angularjs https://scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating think it's best solution

ios - Bluetooth Low Energy without Services & Characteristics is possible? -

i'm starting build connected device (raspberry pi) able share data iphone. possible sockets , without using services & characteristics? well can that,open l2cap socket; after can use write and read system call make sure framing described in bluetooth spec(pg 1845 follows commands),for ex att read-req consists of opcode 1 octet 0x0a , attribute handle read occupies 2 octets, , read system call can analyze att-read-response opcode being 0x0b , rest being attribute value

object - Returning properties on a Javascript Constructor function -

i trying solve problem have following piece of code: var piggie = new animal(animal.pig); how can constructor function (new animal) object properties (animal.pig)? i have tried solution: function animal(type) { this.typeof = type; return { pig: 'pig' }; } but animal.pig undefined? js fiddle here: http://jsfiddle.net/bufr2b4c/ for animal.pig have value, have create property on constructor function itself. function animal(type) { this.typeof = type; } animal.pig = "pig"; your code creating object when constructor runs , setting pig on that object. (and discarding constructed animal instance go).

android - How to find out the average speed, while the speed value is generating per second -

i have code displays value of current speed using gps system. speed value changed every second, want generate average value of speed. have code generating value of average speed reference time, instead want display average speed values reference distance covered avg speed = distance covered in total time. code below: private void actualizetextfield() { // todo auto-generated method stub textview tf = (textview) findviewbyid(r.id.textview3); if (count > 0) { float timeover = (system.currenttimemillis() - starttime); tf.settext(string.valueof(math.round(pointaverage * 3.6 / (timeover / 1000)))); } else { tf.settext("0"); } } how can generate accurate values of average speed. i'm not sure if understand problem, isn't you're looking "pace" instead of "speed"? speed has given formula , it's referenced time (distance/time) - ...

php - Laravel deleting polymorph relations having possibly wrong relations -

i have model represents report user. report model has polymorphic relationship can contain either recipe or comment. the goal able delete comment or user , have related reports removed eloquent. with current setup (seen below) not work, when deleting comment report remains , causes error since points non-existing comment. what doing wrong? need "belongsto" relationship on polymorphic model? if how build relationship when relation morphable? models polymorphic model class report extends model { public function reportable() { return $this->morphto(); } public function user() { return $this->belongsto('app\user'); } } recipe model class recipe extends model { public function user() { return $this->belongsto('app\user'); } public function reports() { return $this->morphmany('app\report', 'reportable'); } } comment model class recipecomment extend...

css - How to change the background color of Radscheduler -

i have query regarding radschedular. i'm using outlook skin radschedular. need change background color yellow white. having yellow color currently. how change same white. guys please shed light me. i'm stucked in lion's den now. please add below class style sheet. .radscheduler_outlook .rscontenttable td { background-color: white !important; }

c# - DataGridViewComboBox value is not valid linq -

im filling datagridview comboxcolumn code: (dgvhopdong.columns["mancc"] datagridviewcomboboxcolumn).datasource = ql.nhacungcaps.select(n => new { mancc = n.mancc, tenncc = n.tenncc }).tolist(); (dgvhopdong.columns["mancc"] datagridviewcomboboxcolumn).displaymember = "tenncc"; (dgvhopdong.columns["mancc"] datagridviewcomboboxcolumn).valuemember = "mancc"; and error is: datagridviewcomboboxcell value not valid? and dont know why. thank much! the value type missing. (dgvhopdong.columns["mancc"] datagridviewcomboboxcolumn).valuetype = typeof(string);

html - wrapper moves right if I add css: top -

when add top style rule wrapper goes down left, don't understand it, please me. js fiddle click me .svg[for="nav-trigger"] { position: absolute; color:white; height: 13px; width: 16px; background-image: url(../assets/menu.svg); background-repeat: no-repeat; right: 0; top: 0; margin: 30px 30px 0 0; z-index: 2; cursor: pointer; } .nav-trigger + .site-wrap { transition: 0.2s linear; } .nav-trigger:checked ~ .site-wrap { top: 80%; } thank you, tim4497 well, it's not wrapper moving whole html. margin width of scroll bar not showing. if insteed of using overflow-x: hidden; on body use overflow: hidden; fixed don't know if generate other problems don't know final results going be

How to get a version of pgAdmin III working correctly with the PostgreSQL 9.4 (Ubuntu 14.10 x64)? -

i have installed postgresql-9.4 , pgadmin iii on ubuntu 14.10 x64 : sudo apt-get update && sudo apt-get dist-upgrade sudo apt-get install postgresql-9.4 sudo apt-get pgadmin3 however using pgadmin postgresql faced warning warning: server connecting not version supported release of pgadmin iii. pgadmin iii may not function expected. supported server versions 8.4 9.3. 1) how version of pgadmin iii use? 2) how uninstall current version of pgadmin , install correct version of pgadmin ? thank you. it seems known bug: link the bug thread suggests try , use pgadmin 1.20 . can download here: link

c# - Troubles read encrypted string which get from Web Request using StreamReader -

so want json string specific url, , json string encrypted become .txt file. want encrypted string , decrypt inside application. here httpwebrequest code response string: public string getresponse(url) { string responsestring = ""; httpwebrequest webrequest = httpwebrequest.create(url) httpwebrequest; httpwebresponse response = (httpwebresponse)webrequest.getresponse(); using (streamreader reader = new streamreader(response.getresponsestream())) { responsestring = reader.readtoend(); } return responsestring; } but response unreadable string (only "o") i try convert byte array before convert base64 string, still, response string not right. thanks help. unfortunately, didnt realize response string includes added character "/0" have remove first, able decrypt string. thank much.

php - how to call my second entity with property? -

i've problem sonataadminbundle . i have file admin.yml : sonata.admin.produit: class: kayser\platformbundle\admin\productionadmin tags: - { name: sonata.admin, manager_type: orm, group: "produits", label: "les pains & viennoiseries" } arguments: - ~ - kayser\platformbundle\entity\product - ~ calls: - [ settranslationdomain, [kayserplatformbundle]] sonata.admin.produit: class: kayser\platformbundle\admin\productionadmin tags: - { name: sonata.admin, manager_type: orm, group: "produits", label: "les pains & viennoiseries" } arguments: - ~ - kayser\platformbundle\entity\productimage - ~ calls: - [ settranslationdomain, [kayserplatformbundle]]` and productionadmin.php : class productionadmin extends admin { // fields shown on create/edit forms protected function configureformfields(formmapper $formmapper) { $for...

c# - What should i do if i want to create multiple overloads of CRUD methods? -

if have class represent mapping specific table in db in somehow .. class contains 30 properties . i have created crud methods . and find myself need ( update ) method should update 2 fields . what should in manner simple example? using exist method ,filling whole object , update fields including intended 2 fields ?(useless work) -create static method name(but want keep method name cuz it's expressive ) !!and takes 2 parameters ? i go by creating 2 separate interface , create overloaded functions each interface. group properties based on usage, want status updated time separate other common properties. public interface icommonproperties { public string p1{get; set;} public string p2{get; set;} public string p3{ get; set; } } public interface itrackable { public string status{get; set;} } public class finalclass : icommonproperties, itrackable { public string p1{get; set;} public string p2{get; set;} public string p3{get; set;} pu...

ruby - Append new lines to a csv from json.parse -

more sysadmin (chef) ruby guy, may 5 minute fix. working on task write ruby script pulls json data multiple files, parses it, , writes desired fields single .csv file. pulling metadata aws accounts , putting in accountant friendly format. got lot of stackoverflow on how solve problem single file, json.parse help . my issue trying pull same data multiple json files in array. can loop through each file code below. require 'csv' require "json" delim_file = csv.open("delimited_test.csv", "w") aws_account_list = %w(example example2) aws_account_list.each |account| json_file = file.read(account.to_s + "_aws.json") parsed_json = json.parse(json_file) delim_file = csv.open("delimited_test.csv", "w") # next line problem if ran code multiple times delim_file << ["ebsoptimized", "privatednsname", "keyname", "availabilityzone", "ownerid"] parsed_jso...

junit - JUnitParamsRunner - cannot pass variable parameters or array of Objects to the test()? -

i found cannot declare public void test(obj...objects) , use junitparamsrunner parameterize test..exception thrown @ runtime. works fine if change public void test(obj obj1, obj obj2) idea? below code: private static object[] testingparam() { return new object[] { new object[] { new obj("123"), new obj("123") } ]; } @test @parameters(method = "testingparam") public void test(obj...objects){ //do test } though don't have chance test this, appears based on usage documentation may need obj[] array instead of object[] array match vararg. note object[] , obj[] not covariant , cannot cast 1 another. private static object[] testingparam() { return new object[] { new obj[] { new obj("123"), new obj("123") } }; } conversely, if trying ignore varargs , treat parameter naive array, need third array wrapper: private static object[] testingparam() { return new object[] { // <-- call testing method...

mysql - Bash - get a reverse count of loop in output -

i want count of loop in reverse in output know how many loop remaining miss finish. #!/bin/bash datenow=$(date +"%f") logfile="table-"$datenow".log" rm -f table.sql mysql --login-path=myloginpath -h xhost -n -e \ "select count(*) database.table a.field = 0;" | tee -a $logfile mysqldump --login-path=myloginpath-h xhost database table > table.sql read -p "insert host separated comma ',' : " localcs mysql --login-path=myloginpath -h xhost -n -e \ "select n.ipaddress database.hosts n n.hosts in ($localcs);" > ip.txt ip in $(cat ip.txt); mysql --login-path=myloginpath -h $ip "database" < "table.sql" echo $ip | tee -a $logfile && mysql --login-path=myloginpath -h $ip -n -e \ "select count(*) database.table a.field = 0;" | tee -a $logfile done something this: 100 (mysql output) 99 (mysql output) 98 (mysql output) ..... you need know how many lines in stre...

real time - Video codec for realtime on electronique board -

i had make researches concerning video codecs. found hevc , vp9 being biggest codecs nowadays. use electronique board can capture video, , want carry video on ip stream using wifi. in order receive on mobile phone later, first in computeur make me happy. of in "real time" (<0.2s). but question : which codec should use on electronique board ? knowing it's composed to: - cpu cortex a9 @ 800mhz (x2) - 1go ram whithout forget neon in cpus. ps: use linux, ffmpeg & vlc any ideas ? hevc , vp9 , not biggest codecs. talked about, nobody uses them because impractical. avc far 'biggest' (most used) codec. may difficult pull off on limited cpu. try starting x264 ultrafast.

forms - yii2 remove optgroup from dropdownlist -

how can remove optgroup checkbox field <?= $form->field($model, 'survey_type')->dropdownlist([$surveytypelist],['prompt'=>'select survey type','id'=>'survey_type_dropdown']) ?> provides following html <label class="control-label" for="survey_type_dropdown">type</label> <select id="survey_type_dropdown" class="form-control" name="surveys[survey_type]"> <option value="">select survey type</option> <optgroup label="0"> <option value="2d">2d</option> <option value="3d">3d</option> </optgroup> </select> <div class="help-block"></div> you have send $survytypelist variable, not array. just remove [] .

actionscript 3 - AS3 method call to javascript + NO SERVER COMMUNICATION -

code below jscript, believe don't have error on integrating code. <script type="text/javascript" src="./js/swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; var params = {}; params.allowscriptaccess = "always"; params.allownetworking = "all"; var attributes = {}; attributes.id = "map-moa"; swfobject.embedswf("./video/map.swf?v=1.3", "map-moa", "1560", "980", "9.0.0", false, flashvars, params, attributes); </script> $(".goto-path").on("click",function(){ // alert("goto booth #"+$(this).data('booth_id')); sendtexttoas3(); // call flash (as3) method }); function sendtexttoas3(){ var isie = navigator.appname.indexof("microsoft") != -1; var flash = (isie) ? window["map-moa"] : document["map-moa"]; console.log(flash) try{ flash...

ios - Xcode Project Forcibly Closes when a Debug Session is started -

Image
pressing (right arrow) button, begin debug session, closes project window rather starting session. for reason, hovering on lower-right corner of button, , pressing there, starts debug session without forcibly closing project window. it's xcode bug people know already. happens when run xcode in full screen mode. x (close button) sits above run button invisibly. easy fix run windowed , not in full screen.

javascript - jQuery change text of all next elements -

i next specific class elements , change text of them. number of entry because i've made ajax request delete record in datatabse , don't want reload page. first actual entry number know text (or entry number) should replaced (for loop) $entryheadcontent = $this.closest('.entry').find('.entry-head').text(); $entryid = parseint($entryheadcontent.split('|')[0].replace(/ /g,'')); then go through next entry-heads change actual entry number (decrease number 1). alert($this.nextall('.entry-head').length); // 0 $this.nextall('.entry-head').each(function(index){ alert($this.nextall('.entry-head').length); (i = entryid; <= $this.nextall('.entry-head').length; i++) { index.text().replace(i, (i -1)) alert('index: ' + index + ' | '); } }); but somehow code don't seems executed don't it. why? $this form (test). i'm still in ajax request (in .done part of ...

html - DIV as filling block in another DIV -

i have css .nav { width: 200px; line-height: 50px; float: left; } .content { margin: 0px 0px 0px 230px; } .container { border: 1px solid red; } and here html <body> <div class="container"> <div class="nav">some text <br>more text <br>even more text </div> <div class="content"> <h1>home</h1> <p>text paragraph</p> </div> </div> </body> this gives me menu on left , content on right. , red box around content on right, half menu on left. but have red box around complete nav-div can help? thanks teddy add overflow:auto container div's css: .container { border: 1px solid red; overflow:auto; } jsfiddle example floating child div removes flow of document , container collapses if didn't exist. adding overflow restores behavior you're after.

extjs - Render data points in a Sencha Chart in a specific color -

i want render of datapoint in charts in different color other, depending on values in store. problem i'm experiencing not marker rendered in different color line marker can see in fiddle: https://fiddle.sencha.com/#fiddle/lmu is there way change color of actual datapoint? thanks in advance! change renderer function - renderer: function (sprite, config, rendererdata, index) { var items = rendererdata.store.getdata().items; if (items[index].data.hidden && config.type ==='marker') { // check config.type (data point return marker type , lines return line) return { strokestyle: 'yellow', linewidth: 5 }; // added linewidth can see different color } }