Posts

Showing posts from January, 2013

how to integrate google calendar in my android application? -

i trying integrate google calendar in app add events google calendar not know how integrate. please 1 me in advance if want use calendar in app directly, can use github library offers lot of customization: caldroid android-week-view but if wish use calendar, should work these intents: try in code: calendar cal = calendar.getinstance(); intent intent = new intent(intent.action_edit); intent.settype("vnd.android.cursor.item/event"); intent.putextra("begintime", cal.gettimeinmillis()); intent.putextra("allday", true); intent.putextra("rrule", "freq=yearly"); intent.putextra("endtime", cal.gettimeinmillis()+60*60*1000); intent.putextra("title", "a test event android app"); startactivity(intent); add permission.. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"...>

html - Hide dynamic div when overflow -

basically have div list divs contains images , texts <div id='item-list' style="height: 700px; overflow: hidden"> <div id='item-1' style="overflow: hidden"> *some images , texts* </div> <div id='item-2' style="overflow: hidden"> *some images , texts* </div> <div id='item-3' style="overflow: hidden"> *some images , texts* </div> ... </div> my item-list has static height don't want change. item div added in dynamically whenever user creates item, newest items prepended top of list. i want hide items whenever item list exceeds height of 700px. try use overflow hidden instead of hiding whole item div, crops item until height limit. example: have 10 items icons , texts , list contents exceeds height, instead of hiding whole div of item-10, crops item-10 div can see icons not text. what should if want hide whole of item-10? note every item

batch file - yammer data export using windows code -

Image
i try export data using data_export_api_code_1_windows my reference link : https://developer.yammer.com/docs/data-export-api i'm using verified admin privilege account i create .bat file , copy script on replace <access token> admin token , <directory> directory path files placed. and install wget windows , update path environment variable include gnu bin path. i'm using windows 10 but when run .bat open console , close without change , when try run cmd show image -ca-certificatei discover windows code in yammer reference incorrect , has mistakes. correct mistakes in code , execute, run , download files. correct code after fixing @echo off set at=<oauth access token> set dir=<export path> set exportsince=<datetime in iso- 8601 [2016-02-13t00:00:00z]> cd %dir% setlocal enabledelayedexpansion ::preform next export. send oauth 2 access token , store time of export in filename. set file_name=<[myfilename].zip> se

java - Zip multiple files, download it and then redirect to another page using servlet -

i have multiple files , want following things using servlet: zip multiple files. download it. then redirect servlet or jsp. i have achieved steps 1 , 2 i'm getting error on step 3. using code: /** * @see httpservlet#httpservlet() */ public downloadaj() { super(); // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub list<string> filenames = new arraylist<string>(); //..code add urls list filenames.add("e:/analyticsagent/avekbank.rar"); filenames.add("e:/analyticsagent/java_agent.jar"); //filenames.add("e:/analyticsagent/avanalytics.framework.zip"); byte[] buf = new byte[2048]; // create zip file bytearrayoutputstream baos = new bytearrayoutputstream();

php - Duration between type in and out in MYSQL -

Image
i new mysql try here query not accurate result select sec_to_time(sum(time_to_sec(time))) `officialbreaks` type='out' select sec_to_time(sum(time_to_sec(time))) `officialbreaks` type='in' any buddy have work on type of situation. out required timediff(time type=in, time type=out) 3:35:30 time type=in, 03:35:30 time type=out output 0 you can try per below- select distinct a.userid, (time_to_sec(b.time) - time_to_sec(a.time)) 'time_diffrence' (select userid,`time` mytable `type`='in') join (select userid,`time` mytable `type`='out') b on a.userid=b.userid it simple solution there can multiple out time against single in time , multile users etc. there can many combination query need change.

mysql - Updating multiple rows in one column in a database -

Image
i have database data i want edit column lab_no , add 0 (0) after 8 records... how can because records many. thank you assuming records begin epi8, can this: update [tablename] set lab_no = replace(lab_no, 'epi8', 'epi80');

serial port - C#: DataReceived Event handler for serialPort not firing -

i'm writing basic application, 1 of tasks communicating arduino uno card. write serial communication separate module, forms calls input arduino, , module handle creating , opening of serialport , reading data it. testing purposes wrote program arduino prints elapsed milliseconds every half second serialport. populate textbox of form output arduino after press button. create serialport in serialcomm class, , although attach datareceived event handler it, never seems fire. here code serialcomm class: class serialcomm { private list<string> availableports; private serialport arduino; private string receivedtext; public string[] portlist { { enumports(); return availableports.toarray(); } } public string receiveddata { { return receivedtext; } } public void initialiseserial() { arduino = new serialport(); arduino.baudrate = 9600;

Moodle: CSV bulk download of other fields in user profile not showing data -

Image
sample outcome: i'm wondering possible show gender male rather 2. shows number answer when uses multi select answers dropdown etc. i hope can point me right direction, help. i'm guessing old version of moodle? you use instead replace numbers values: select u.id, u.username, /* other user fields need */ d.user_profile_gender, d.user_profile_agegroup, d.user_profile_jobtitle, d.user_profile_department mdl_user u left join ( select d.userid, max(case when f.shortname = 'gender' , d.data = '1' 'male' when f.shortname = 'gender' , d.data = '2' 'female' else null end) user_profile_gender, max(case when f.shortname = 'agegroup' , d.data = '1' 'xxx' when f.shortname = 'agegroup' , d.data = '2' 'yyy' else null end) user_profi

Magento Review and Rating - not showing -

i need show review , rating in backend admin navigation panel under catalog similar link below: http://www.hostknox.com/images/tutorials/magento/ratings-and-reviews/4-zoom.jpg i have checked below steps: system > configuration > advanced > advanced - mage_review - enabled - mage_rating - enabled no changes have been made app/etc/modules/mage_review.xml is there else can can enable above mentioned ratings? go catalog=>reviews , ratings=>manage ratings after assign rating visibility every fields. show on front-end , back-end.

jquery - Does google bot trigger javascript click actions on site and solution to it? -

so our problem @ moment having reviews products on our site , optimize page load on desktop , mobile loading 10 reviews initialy , on each button click per user interaction load next 10 reviews. want google , other search engines index content other reviews not initialy showed. have stacked our code in vanilla javascript jquery( function() { ... document.getelementbyid("id").onclick( function(...) ); ... }); but after reading articles, found out google crawler can access content loaded on document ready. asking if had similar problem 1 , how did solve or if there other workarounds problem? i have read google crawler can execute javascript , google deprecated solution recommending before https://developers.google.com/webmasters/ajax-crawling/docs/learn-more . here found advice google: https://support.google.com/webmasters/answer/81766?hl=en under section develop progressive enhancement ps: html element "id" button, google suggestion indicat

javascript - how to update contents of a span tag? -

i creating web page user , select item clicking on button. details of item selected displayed in dropbox. @ moment can update quantity if user selects again. problem having is, if user first click on btnbuy1 (details displayed in dropbox), clicks on btnbuy2 (again, details displayed), when click on btnbuy2 again , details btnbuy2 updated details btnbuy1 disappears. $("#btnbuy0").click(function() { if (!sessionstorage['quantity0']) { sessionstorage['quantity0'] = 1; $("#dropbox").append('<span id = "0"><img class = "thumb" src="../images/21_metoyou.jpg" />' + teddy[0].desc + ", price £" + teddy[0].price + ", quantity: " + sessionstorage.getitem('quantity0') + "</span><br/>"); } else { sessionstorage[&

Facebook Like Button Issues -

i trying implement fb button @ end of blog posts. issue having works differently depending on whether or not logged in fb. when logged in fb , click button, appears work because button becomes disabled , text changes "you , 2 others this." however, when refresh page, doesn't stick. button again enabled , shows "2 others page". on other hand if logged out of fb , click button, fb login dialog opens , once logged in, button disabled , text goes "you , 2 others this." when refreshing page, works fine. button still disabled , text shows "you , 2 others this". any on appreciated.

java ee - Detecting the actual completion of programmatic deployment in JBoss 7.1.x -

i'm developing app performs programmatic deployment of ejbs in jboss 7.1.x. here's code snippet: // connect commandcontext cmdctx = commandcontextfactory.getinstance().newcommandcontext(...); cmdctx.connectcontroller(); modelcontrollerclient ctrlclient = cmdctx.getmodelcontrollerclient(); // deploy string command = string.format("deploy \"%s\" --name=%s --server-groups=%s", path, name, group); modelnode request = cmdctx.buildrequest(command); ctrlclient.execute(request); now, how can determine deployment has completed? call ctrlclient.execute(request) returns immediately, server continues process deployment time. need know when it's done, , maybe if succeeded or not. one idea have write own logging appender, , predefined messages, there nicer solution? instead of using cli api try org.jboss.as.controller.client.helpers.standalone.deploymentplan or org.jboss.as.controller.client.helpers.domain.deploymentplan api's. can see

ruby on rails - Delayed Job drives memory usage to 100% -

i'm using delayed job years i'm stuck memory usage. when i'm uploading lot files, jobs job usual according queue. memory more used @ time obviously. when it's done, memory usage still goes stuck @ 100%.. until restart jobs (which 4). is there obvious reason don't know not release memory after having done job? i don't know if it's linked jobs of paperclip's jobs. i'm using: rails (4.2.0) ruby (2.2.1) delayed_job (4.0.6) delayed_job_active_record (4.0.3) delayed_paperclip (2.9.1) thank you help!

c++ - Why does shifting more than the allowed bits still work? -

i have int8_t , wanted see happen if shift left further 8 bits. did: int8_t x = 1; std::cout << (x << 10); for reason returns 1024 if type contained enough bits represent number. thought when shift more given bits 0 in bits (or signed overflow/underflow leads undefined behavior). also, ran code give me maximum number of int8_t : std::numeric_limits<int8_t>::max(); // 127 the max number of type 127 shifting left can make go higher unsigned type! how possible? the arguments << being implicitly widened int , , result of x << 10 int .

Use a PHP FOR loop in a WHERE SQL Statement -

i want list results ($photostopromote[$i]) of statement within bit of sql query. at moment statement outputs text list of results, , sql picks 1 of $photostopromote if 1 photo has been selected on previous page. if more 1 photo has been selected statement lists them all, sql not find them , display images. do need use mysql_real_escape_string before putting sql? how can too? $photostopromote = $_post['promotephoto']; if(empty($photostopromote)) { echo("<p class=\"error\">you didn't select photos go , start again!"); } else { $n = count($photostopromote); echo("you selected $n photos(s): "); for($i=0; $i < $n; $i++) { echo($photostopromote[$i] . " "); } } $queryuserphotos = mysql_query("select photoid photos photoid='$photostopromote[$i]' , (auth = '5' or auth = '2' or auth = '4') order auth desc") or die("something went wrong...please try again later!"); w

symfony - How to redirect after create action in SF2 controller -

here action not working properly, entity created i'm rendering aileronsfrontendbundle:default:observation.html.twig as code shows, createaction should render home template, template rendering not one. /** * creates new observation entity. * * @route("/observation/new", name="observation_create") * @method("post") * @template("aileronsfrontendbundle:default:observation.html.twig") */ public function createaction(request $request) { $entity = new observation(); $form = $this->createform(new observationtype(), $entity); $form->bind($request); if ($form->isvalid()) { $entity->getobservator()->setip($request->getclientip()); $em = $this->getdoctrine()->getmanager(); $em->persist($entity); $em->flush(); $msg = array( 'type'=>'success', 'title'=>'merci !', 'text'=>

javascript - How to print in console message from a process executing in gulp-run? -

i using gulp-run in order execute command "vagrant up" (valid other command). when running "vagrant up" in command prompt log messages printed , when running same command gulp-run no messages printed in command propmt. my question: how show log messages process being called when using gulp-run in command prompt gulp-run executed? if know better way call command in gulp script, please let me know. gulp.task('test', function () { var cmd = new run.command('vagrant up', { cwd: '../util/vagrant_tools', verbosity:2 }); cmd.exec(); }) set verbosity option 3 .

.net - How to detect file transfer in Lync conversation -

i trying log lync convrsation using console application uses lync sdk access lync client. code looks similar this: public void getnotifiedaboutmessagesent() { var client = lyncclient.getclient(); foreach (var conversation in client.conversationmanager.conversations) foreach (var participant in conversation.participants) ((instantmessagemodality)participant.modalities[modalitytypes.instantmessage]).instantmessagereceived += participant_instantmessagereceived; } //event handlers void participant_instantmessagereceived(object sender, messagesenteventargs e) { logtext("message received"); } participant_instantmessagereceived event raised when message sent or received not raised when file sent (or received). there event similar on file transfer can subscribe or way notification when file sent on lync?

android - adding view elements within a tablerow -

i have screen has tablelayout defined in xml 3 stretch columns. in code populating table rows inside tablelayout based on backend data fetched @ runtime. want create action wherein clicking tablerow, details data shown expanding table row. , clicking tabelrow again, data should collapsed. have tried using code below, not working , don't tablerow details data displayed/expanded after click. appreciated. main.xml below <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.bfp.qu

php - Add additional content to WooCommerce layout? -

Image
i'm trying add additional content (such banner image, additional loop) woocommerce plugin, i'm having trouble trying output such said content. i'm trying make woocommerce output <div> s <img> tags in wrapper-end.php template area after <div> s, nothing comes up. i've tried placing content after <?php woocommerce_content(); ?> in woocommerce.php , duplicates every single page afterwards. i'm confused. possible? doing wrong? i'm trying this. can share experience? if don't use catch-all woocommerce_content() function, hooks instead, can customize every page individually copying files woocommerce/template yourtheme/woocommerce . see woocommerce docs more info. the templates show other hooks & filters can use place content.

android - Loading Sounds for SoundPool effectively (Global SoundPool?) -

i'm creating game has series of sounds played on different activities. loading sounds in oncreate hampers fps dramatically, i'm wondering there more efficient way load sounds, or way create global soundpool can called activities. if create public soundpool in main menu activity, can played in future activities? thanks andy i create separate sound class (sort of utils), has play, load, unload etc methods. access these of activities in static fashion. make sure use application context load sounds lest end leaking memory (if use activity context)

Configure Logstash to wait before parsing a file -

i wonder if can configure logstash in following way: background info: every day xml file pushed server, should parsed. to indicate complete file transfer afterwards empty .ctl (custom file) transfered same folder. the files both have following name schema 'feedback_{year}{yearday}_utc{hoursminutesseconds}_51.{extention}' (e.g. feedback_16002_utc235953_51.xml). have same file name 1 .xml , other .ctl file. question: is there way configure logstash wait parsing xml file until according .ctl file present? edit: there maybe way archiev filebeat? edit2: enough able configure logstash in way wait x minutes before starting process new file, if easier. thanks in advance your problem don't want start parser before file transfer hasn't been completed. so, why don't push data file (file-complete.xml) when find flag file (empty.ctl)? here possible logic script , runs using crontab: if empty.ctl exists: clear file-complete.xml add content

PHP sqlsrv in Zend server 8 -

i have zend server version: 6.1.0 running php version 5.4.16, want migrate scripts new server : zend server version: 8.0.2 php version 5.6.5 $link = mssql_connect($host, $user, $pass); $query = 'some valid sql'; on old server, code : mssql_query($query, $link); returns data. use code extensively, , returns data. on new server returns "warning: mssql_query() expects parameter 2 resource, boolean" , fails every time google, "do mean mysql?" please can tell me how resolve this?

c# - Is there a way to view Session state/variables in ASP.NET WebForm -

i developing webform project. in login form store user name in session variable session["username"] = txtuser.text; my question , there way view/hack session variable in browser? please share working step step. i'm thinking of security of web project. help. update : answers. based feedbacks, webproject secured right? i'll vote helpful answer/s. thanks! answer no. session server object. in can stored in memory or web server (default), or somewhere else, depending on mode. read here https://msdn.microsoft.com/en-us/library/ms178586.aspx

javascript - Semantic-UI components not initializing on Meteor -

i'm trying implement simple tab. the problem having while tab functions fine in cases, there 1 or 2 cases tab initialization doesn't seem work. one such case if user logs in , out of app. user needs logged in view tab component, reason disappearance , reappearance of tab causing issues. user can no longer change tabs. as shown in code below, tried putting tab initialization code within tracker.autorun . autorun called expected, tabs still don't work. <!-- mytemplate.html --> <template name="mytemplate"> {{#if currentuser}} <div class="ui secondary pointing menu"> <a class="item active" data-tab="first"> tab1 </a> <a class="item" data-tab="second"> tab2 </a> <a class="item" data-tab="third"> tab3 </a> </div> <div class="ui active tab segment" data-tab="

file - TCL, replacing strings in a textfile -

lets open file, parsed lines. use loop: foreach line $lines {} e.g., if file contained following string: xydata, name1 i want put acc_ after xydata acc_name1 , if file contains more 1 strings xydata , put vel_ , dsp_ , prs_ , on using textutil::split package tcllib , , ability of foreach iterate on multiple lists simultaneously package require textutil::split set line {xydata, foo, bar, baz, qux} set prefixes {acc_ vel_ dsp_ prs_} set fields [textutil::split::splitx $line {, }] set new [list] if {[lindex $fields 0] eq "xydata"} { lappend new [lindex $fields 0] foreach prefix $prefixes field [lrange $fields 1 end] { lappend new $prefix$field } } puts [join $new ", "] xydata, acc_foo, vel_bar, dsp_baz, prs_qux alternately, use single regsub call generates code set code [regsub -all {(, )([^,]+)} $line {\1[lindex $prefixes [incr counter]]\2}] set counter -1 puts [subst $code]

Python 3 Unicode len() function for Tamil characters -

when believe python 3 got right on unicode surprised while faced situation. >>> amma = "அம்மா" >>> amma 'அம்மா' >>> len(amma) 5 apparently tamil string "அம்மா" has 3 letters, return value of 5 len("அம்மா") in no way can accepted or appreciated. how other dravidian or brahmic scripts solve issue right string length? edit #1: considering comment of @joey question can rephrased below. how calculate grapheme length in python? we know swift or perl6 default 2> let amma = "அம்மா".characters.count amma: distance = 3 it may have 3 letters, has 5 characters: $ charinfo 'அம்மா' u+0b85 tamil letter [lo] u+0bae tamil letter ma [lo] u+0bcd tamil sign virama [mn] u+0bae tamil letter ma [lo] u+0bbe tamil vowel sign aa [mc] if need more specific need count number of characters in letter category.

java - Dynamically change Tab UIID not working properly in codenameone -

i using tab in 1 of form. if error occurred while saving form tab color should change. code have used below: for(integer tabindex: errortabindex){ if(index==0){ tabs.setselectedindex(tabindex); } button c = (button) tabs.gettabscontainer().getcomponentat(tabindex); c.setuiid("tab_button_error"); c.repaint(); index++; } this code set new uiid when click on tab instead of stick on new uiid style, reset previous uiid style. tab buttons used have 2 separate styles selected , unselected. later consolidated tabs behave single toggle button (radio button) 1 thing remained call setuiid implicitly made restore original "tab" style. invoke setuiid call on tab. after adding tabs invoke settabuiid(null) disable behavior.

C# mongodb serialize an object with a generic property -

i have class 1 property of generic type, public class factorrecord<t> { public string id { get; set; } public string factorname { get; set; } public t factorvalue { get; set; } public datetime datetimestamp { get; set; } } from question mongodb serialize generic types (classes) , know how serialize generic object, not sure how serialize in case in 1 property of generic type.

c++ - PIMPL idiom and copy semantic -

i'm using library contains lot of classes builded using pimpl idiom. found bad, in opinion, classes implemented using std::shared_ptr implementation. means objects "implicitly shared". question is: correct way implement pimpl? or pimpl , "implicitly shared" 2 different idioms , therefore should not mixed default? correct way handle copy semantic? imo, correct way implement pimpl use std::unique_ptr . it's more efficient , pimpl object should uniquely owned visible class, not shared (and don't have bother copy semantic). pimpl , "implicitly shared" 2 different idioms indeed. if still have use std::shared_ptr pimpl have explicitly define copy assignement operations (because compiler won't able generate correct ones).

cryptography - No padding for AES cipher in Java Card -

in javacard 2.2.2 api, can see symmetric ciphers implemented padding mode, example: cipher algorithm alg_des_cbc_iso9797_m1 provides cipher using des in cbc mode or triple des in outer cbc mode, , pads input data according iso 9797 method 1 scheme. but aes cipher, there no padding mode available ( alg_aes_block_128_ecb_nopad , alg_aes_block_128_cbc_nopad ). so how explain it's not supported algorithm? are these padding methods vulnerable known attacks using aes? if other padding modes available depends on java card api using implementation details specific java card. later api's have: a new getinstance method can used pad_pkcs5 ; additional constants such alg_aes_cbc_pkcs5 . the special getinstance method added because of explosion of modes , padding methods. older api implementations may indeed not have these methods, please again check availability. aes block cipher. different modes such cbc use cipher , padding - cbc_aes_pkcs7p

java - Wait for static initializer -

i want have static field in class automatically initialized when class loaded. something this: class servicebase { static object lock = new object(); static servicebase service; static void setservice(servicebase service) { synchronized (lock) { servicebase.service = service; lock.notifyall(); } } void f() throws exception { synchronized (lock) { while (service == null){ lock.wait(); } } //use service } } class serviceimpl extends servicebase { static { servicebase.setservice(ne serviceimpl()); } } the problem is f called before serviceimpl loaded, hangs in deadlock. what's best way of initializing service instance? (i cannot use spring or other huge frameworks) your approach overly complex. should not need worry synchronization or of that. the obvious simplification pass service instance constructor par

vb.net - Accessing subclass or subproperty using CallByName -

i can access class' subvalues using callbyname (in other words, can class.subvalue it). error when want class.subclass.subvalue using callbyname. possible using callbyname (or using smtg else)? here's typical code: class class1 public somevariable long=123 'now "class1" has "somevariable" end class class class2 public subclass new class1 'now "class2" has subclass "class1" end class sub test() dim c1 new class1, c2 new class2 'this works fine, , can c1.somevariable. it's ok. a=callbyname(c1,"somevariable",calltype.get) 'but error here... , can't c2.subclass.somevariable b=callbyname(c2,"subclass.somevariable",calltype.get) end sub -- edit: here actual question. -- i want load parameters file form's controls, , in file parameters written this: <controlname>.<property>=<value> | textbox1.text=sometext | button2.left

javascript - How to dynamically add rows to an html table using MVC razor syntax -

i'm trying dynamically add new rows table using idea marked answer here add table row in jquery i have far implemented 1 of table requirements below function onadditem() { $('#mydynamictable tr:last').after('<tr><td style="width: 78%;" class="itemname"><input type="text" style="width: 97%;" /></td><td style="width: 20%;" class="itemqty"><input type="text" style="width: 87%;" /></td></tr>'); $("#mydynamictable").show(); } i'm trying implement same <tr>..</tr> definition below i'm failing working. <tr class="tdborder"> <td class="tdborder"> @html.textbox("id", null, new { @width = 60 }) </td> <td> @html.textbox("name",

javascript - Parse timeline many to many -

i'm building parse app in javascript. for structure have following tables ads pic (many point ad) activities (many point ad) so ad can have many pics , many activities now want retrieve ads pics , activities included ad object not link (point) these objects. i managed working in following way: retrieve ads (loop) --> retrieve pics adid --> retrieve activities adid this not seem best way since involves lot of queries, steer me in direction can use 1 or 2 queries? screenshot 1 screenshot 2 you have join table , fetch required data. take reference here .

ios - How to remove UITableView top inset when embedded in ContainerView? -

Image
i working on iphone app. have problem top spacing inset of uitableview. see screenshot: there should no space between table view cells , buttons. i not know how fix this. uitableview embedded in containerview this: i think got container view constraints right. top space chapter button set 0 . i tried change settings of table view controller in storyboard. example adjust scroll view insets . not change when disable that. i tried set tableview insets directly in code in viewdidload() : tableview.contentinset = uiedgeinsets(top: 0, left: 0, bottom: 0, right: 0) however did not fix it. can help? have no idea look. this can solved disabling auto adjustment of scroll view insets. setting has applied viewcontroller which contains containerview (with uitableview inside of it) . not work when applied uitableview itself. this can done via storyboard: or via code in viewdidload() : self.automaticallyadjustsscrollviewinsets = false

How to write to named Linux pipe from PHP? -

i have following bash script: server_control_pipe="/var/custom_pipe_file_name" init_script="/usr/sbin/service [somedaemon]" mkfifo -m 666 "$server_control_pipe" while read line <"$server_control_pipe" echo "received $line" if [[ "$line" == 'stop' ]]; $init_script stop elif [[ "$line" == 'start' ]]; $init_script start elif [[ "$line" == 'stoppipe' ]]; break fi echo "waiting..." done echo "end" ...and following php script: <?php define('server_control_pipe', "/var/custom_pipe_file_name"); if(false === file_put_contents(server_control_pipe, "start\n", file_append)) throw new exception("could not write server control pipe"); when running php script, loop in bash script seems terminate , bash script outputs end. to try find out why that, replaced php script code: <?php defin

angularjs - Norton security seal in Angular partial -

i have received html code norton <table width="135" border="0" cellpadding="2" cellspacing="0" title="click verify - site chose symantec ssl secure e-commerce , confidential communications." style="position: absolute; left: 0; bottom: 10px"> <tr> <td width="135" align="center" valign="top"> <script type="text/javascript-lazy" src="https://seal.websecurity.norton.com/getseal?host_name=myhostname&amp;size=l&amp;use_flash=no&amp;use_transparent=no&amp;lang=en" script></script> <br /> <a href="http://www.symantec.com/ssl-certificates" target="_blank" style="color: #000000; text-decoration: none; font: bold 7px verdana,sans-serif; letter-spacing: .5px; text-align: center; margin: 0px; padding: 0px;">about ssl certificat

javascript - How to assign a value to a field of an object if I ignore their depth in the hierarchy? -

suppose have object this: obj = { a: { aa: 'aa', ab: 'ab', ac: { aca: 'aca', acb: 'acb' }, b: 'b', set: function obj_set(field, value) { var route = field.split('.'); ... } } and, can see, have method in object through can assign values object. obj.set('b', 'b2'); obj.set('a.ab', 'ab2'); obj.set('a.ac.acb', 'acb2'); as don't know how depth assignment be, can't reference field this['b'] , this['a']['ab'] or this['a']['ac']['acb'] . also, in javascript, when assign object variable copied , lose reference original object. then, can't this: var reference = this; (i = 0, length = route.length; < length; i++) { reference = reference[route[i]]; } reference = value; how can solve problem? thank you. you need save last key reference, because last reference primitive v

redis - WRONGTYPE Operation against a key holding the wrong kind of value Laravel -

hi using laravel redis .when trying access key method following error "wrongtype operation against key holding wrong kind of value" i using following code access key value - route::get('/', function () { //$redis = app()->make("redis"); $redis = redis::connection(); return $redis->get("doctor:8a772886-e7b2-442a-a0d5-621307510c6a"); }); could please try code sample , see if works you. return $redis->hgetall("doctor:8a772886-e7b2-442a-a0d5-621307510c6a");

How to Implement AntiCSRF Token in Spring MVC(3.2.5) Project [EDITED] -

i upgraded spring 3.0.6 3.2.5 , included spring-security-web-3.2.9.release.jar how implement csrf token , how configure it. refereed this blog cant understand configuration. csrf protection introduced in spring security 3.2 . according maven, spring security 3.2 has dependency on spring-core-3.2.6-release , no. have upgrade version of spring.

php - SQL find rows with closest higher values than each value in specified set of values -

i have statistics gathered each 6 hours in database each saved timestamp. have array of timestamp in code. need select value database each value in array of timestamp , row have closest higher or equal timestamp in array. to illustrate: table data id timestamp value 1 1400000027 10 2 1400000035 15 3 1400000043 20 4 1400000044 21 5 1400000048 30 6 1400000060 35 the array contains following timestamps: [1400000020, 1400000024, 1400000035, 1400000050] the rows need database based on input array are: id timestamp value 1 1400000027 10 1 1400000027 10 2 1400000035 15 6 1400000060 35 is there simple way in 1 query? , best solution in doctrine, since using symfony 2 , doctrine. this typically done distinct on in postgresql (if can use non-standard sql) select distinct on (ts_min) t.* unnest(array[1400000020, 1400000024, 1400000035, 1400000050]) ts_min left join table_name t on t.timestamp >= ts_min order

How to allow a number with digit limit and without decimal,and negative ina textfield using AngularJS directive -

here code.but not working in directive .please me show errors when run enter characters(other number) in 2 times allowed. eg press 'w' in 2 times allwed in textfield. error in code? here script var myapp = angular.module('myapp', []); myapp.directive('nksonlynumber', function () { return { restrict: 'ea', require: 'ngmodel', link: function (scope, element, attrs, ngmodel) { scope.$watch(attrs.ngmodel, function(newvalue, oldvalue) { var spiltarray = string(newvalue).split(""); if(attrs.allownegative == "false") { if(spiltarray[0] == '-') { newvalue = newvalue.replace("-", ""); ngmodel.$setviewvalue(newvalue); ngmodel.$render(); } } if(attrs.allowdecimal == "false") { newvalue = parseint(newvalue); ngmodel.$setviewvalue(newvalue); ngmodel.$render();

asp.net - How to get value of a Radiobuttonfor(created using loop) -

view the increment not work int = 0; foreach (var x in model) { <div> @if(x.mcchoices.any()) { foreach (var item in x.mcchoices) { @item.question_desc foreach(var choices in item.mcchoices) { @html.radiobuttonfor(model => choices.qc_selectedchoice, choices.qc_id) @html.displayfor(model => choices.qc_choice) } } } @{i++;} </div> whenever debug can't value of radiobutton controller model public class quizmaker { public string question_desc { get; set; } public string question_id { get; set; } public string qc_choice { get; set; } public string qc_id { get; set; } public string qc_selectedchoice { get; set; } public ienumerable<quizmaker> mcchoices { get; set; } } i can't value on post:( appreicated :)))) don't use foreach brokes model binding stephen muekle said. you

javascript - lodash find object inside object -

i trying return true if object exists with var primary={ "rhid": { "type": "numeric" }, "cd_doc_id": { "type": "numeric" }, "seq": { "type": "numeric" } } console.log(_.contains(primary, 'rhid')) but aways false. thanks you can use _.has method console.log(_.has(primary, 'rhid'))

PHP- What is the best way to pass NULL to a function? -

i have function trying pass null value to: function test($this=null, $that=null) { if ($this) { // } if ($that) { // else } } so, if trying pass value $that , can do: $that = 100; this('',$that); but '' best way pass null function? use null : $that = 100; test(null,$that);

performance - Draw a certain UI element only after it's fully loaded in Android -

i'm working viewpager in android. every fragment represents element, plotted inside corresponding page using library ( http://www.android-graphview.org/ ). if have been working viewpagers, know load 3 pages, 1 right, current 1 , 1 left. when start app, loads , draws 3 current plots (left, middle, right). every of these plots quite large, takes time load , draw them (about 3 seconds). if user swipes left, animation smooth, because 1 left preloaded , drawn. if user swipes left instantly again, graph not yet loaded , drawn, app freezes remaining time until data plotted. question is: can achieve smooth animations while graphs loading in background, , plot them once finished loading? tried asynctask, manages crash app once in every while. this oncreateview of page: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view v = inflater.inflate(r

javascript - AngularJS: RangeError when recursively calling function with $timeout -

i trying learn angularjs book 'angularjs novice ninja'. (i have programmed before, not javascript.) one example wants demonstrate events. uses recursive call of function timeout. when try code out, gives rangeerror: maximum call stack size exceeded. works without recursive call. doing wrong? thanks, pieter angular.module('myapp.controllers', []); angular.module('myapp.controllers').controller('messagecontroller', function($scope, $timeout) { $scope.messages = [{ sender: 'user1', text: 'message1' }]; var timer; var count = 1; $scope.loadmessages = function() { ++count; $scope.messages.push({ sender: 'user1', text: 'message'+count }); // line seems cause problem timer = $timeout($scope.loadmessages(), 2000); if (count==3) { $scope.$broadcast('event_no_data', 'not connected'); $timeout.cancel(timer); } }; timer = $

How to assign more than one Collection in a ObservableCollection using Inline C# Statement? -

i'm having collection of model public class mobilemodelinfo { public string name { get; set; } public string catagory { get; set; } public string year { get; set; } } here need assign morethan 1 collection within new observablecollection<mobilemodelinfo>() using single statement without using moblist.add() following statement observablecollection<mobilemodelinfo> moblist = new observablecollection<mobilemodelinfo>( (new mobilemodelinfo { name = "s4", catagory = "smart phone", year = "2011" }), (new mobilemodelinfo { name = "s5", catagory = "smart phone", year = "2013" }), (new mobilemodelinfo { name = "s6", catagory = "ultra smart phone", year = "2015" }) ); but generates compile time error, kindly assist me achieve via inline statement. note: don't suggest moblist.add() an observablecollection accepts parameters eithe

math - Java 8 Stream Matrix Multiplication 10X Slower Than For Loop? -

i have created module performs matrix multiplication using streams. can found here: https://github.com/firefly-math/firefly-math-linear-real/ i've attempted write benchmark in order compare stream loop implementation corresponding loop implementation in apache commons math. the benchmark module here: https://github.com/firefly-math/firefly-math-benchmark and actual benchmark here: https://github.com/firefly-math/firefly-math-benchmark/blob/master/src/main/java/com/fireflysemantics/benchmark/multiplybenchmark.java when run benchmark on matrices sized 100x100 , 1000x1000 turns out apache commons math (uses loop) 10x faster (roughly) corresponding stream implementation. # run complete. total time: 00:14:10 benchmark mode cnt score error units multiplybenchmark.multiplycm1000_1000 avgt 30 1040.804 ± 11.796 ms/op multiplybenchmark.multiplycm100_100 avgt 30 0.790 ± 0.010 ms/op multiplybenchmark.multiplyfm1000

javascript - Lodash sortByOrder with provided alphabet -

i need sort array of objects provided keys. sorting must case-insensitive , use provided alphabet. example let's take initial data looks this: var notordered = [{ date: "11-12-2015", name: "tomasz", age: 50, products: "fdgs", rate: 500 }, { date: "12-11-2015", name: "Łukasz", age: 54, products: "Łbdgs", rate: 110 }, { date: "11-12-2015", name: "jan", age: 24, products: "Żdgs", rate: 1000 }, { date: "11-12-2015", name: "Łucja", age: 18, products: "aebdgs", rate: 50 }]; var keys = ["date", "rate", "name"]; var directions = [true, false, true]; var alphabet = '01234567989aąbcćdeęfghijklłmnńoóprsśtuvwxyzźż' so result i'm looking is: var ordered = [{ date: "11-12-2015", name: "Łucja", age: 18, products: "aebdgs", rate: 50 }, { date: &qu

combobox - XPages DojoCombobox user is not allowed to enter a value which is not in the list -

Image
i have created dojo combobox dojo (djcombobox), i values in combobox works well. added screenshot how should like... but user can enter value not in list. it should in picture above , user cannot entered value not in combobox list. how can this. you should use <xe:djfilteringselect id="djfilteringselect1"></xe:djfilteringselect> instead of combobox.

javascript - Retrieving child directive scope from parent through element.find -

i can't use "require" because have directive can have many different parents cannot predict be. need in each parent able retrieve controller or scope of child directive , invoque method disable button. have plunker shows problem. https://plnkr.co/edit/od1mjzoq1ep54pj6k6ti?p=preview .directive('parent', function($compile, $rootscope) { return { restrict: 'e', scope: {}, templateurl: 'parent.html', link: postlinkfunction }; function postlinkfunction(scope, element, attributes) { var directive = element.find('child'); var directivescope = directive.isolatescope(); console.log(directivescope); } }) .directive('anotherparent', function() { return { restrict: 'e', scope: {}, templateurl: 'parent.html', link: postlinkfunction }; function postlinkfunction(scope, element, attributes) { var directive = element.find('child'); var directivescope = directive.isolatescope(); consol

swift - IOS Cant Reposition UIImageView at runtime -

i have looked @ other questions on regarding issue , code seems follow provided solutions don't know going wrong. ma trying reset position of image view when screen loads. size depend on base image. the image remains placed in interface builder. there no constraints on image view. does matter call from? have tried viewdidload() , viewwillload() , viewdidappear() code @iboutlet weak var camerapreview: uiview! @iboutlet weak var glassesoverlay: uiimageview! print("before") print("overlay x: \(glassesoverlay.frame.origin.x)") print("overlay y: \(glassesoverlay.frame.origin.y)") print("overlay w: \(glassesoverlay.frame.width)") print("overlay h: \(glassesoverlay.frame.height)") let glassesorigin = cgpointmake( (camerapreview.frame.width / 2) - (glassesoverlay.frame.width / 2), camerapreview.frame.height / 3) //let glassesorigin = cgpointmake( 179.0, 179.0) let glasseswidth = cameraprevie

php - Woocommerce not putting javascript in footer -

ok have custom wordpress theme , have installed woocommerce. javascripts added footer not being brought in: the plugins i've got running woocommerce , advanced custom fields my theme has add_theme_support( 'woocommerce' ); in my functions. i have woocommerce.php in theme folder i have copied directory in 'woocommerce' in theme override plugin files have not edited them. wp_footer(); in footer im tearing hair out why not bring in. i have no idea how or why has resolved itself.

.htaccess - redirect /subdirectory to /symlink/subdirectory where /symlink points to / -

i'm working on drupal7 multisite setup based on subdirectories example.com used main website , example.com/subsite standalone drupal install. subsite symlink located in root directory , pointing root directory give subsite access drupal core files. now have make static content available via example.com/subsite/static, created directory static in root directory. works fine. the problem is, example.com/static accessable , want prevent that. i tried redirect requests /static /subsite/static resulting in inconsistent behaviour , redirect loops. directory structure: / /{various drupal directories} /subsite -> / /static rewrite rule: rewriterule ^/static/(.*)$ /subsite/static/$1 [r,l] thx in advance is want? rewritebase / rewriterule ^static/(.*)$ /subsite/static/$1 [l,r=301] rewriterule ^subsite/static/(.*)$ /static/$1 [l] in first line redirect call /static/ /subsite/static/ . in second line rewrite call /subsite/static/ /static . if doesn

Apply modification only to substring in Ruby -

i have string of form "award.x_initial_value.currency" , camelize except leading "x_" result of form: "award.x_initialvalue.currency". current implementation is: a = "award.x_initial_value.currency".split(".") b = a.map{|s| s.slice!("x_")} a.map!{|s| s.camelize(:lower)} a.zip(b).map!{|x, y| x.prepend(y.to_s)} i not happy since it's neither fast nor elegant , performance key since applied large amounts of data. googled couldn't find anything. there faster/better way of achieving this? since "performance key" skip overhead of activesupport::inflector , use regular expression perform "camelization" yourself: a = "award.x_initial_value.currency" a.gsub(/(?<!\bx)_(\w)/) { $1.capitalize } #=> "award.x_initialvalue.currency"

visual c++ - How to solve SNMPAPI_NOOP error? -

i'm new around here hope find answer question. i'm supposed write winsnmp application, learned how process has , code working fine until comes receive message. this part of code got error. hsnmp_entity recsrcentity; hsnmp_entity recdstentity; hsnmp_context reccontext; hsnmp_pdu recsnmppdu; snmpapi_status snmprmsgn = snmprecvmsg(session, &recsrcentity, &recdstentity, &reccontext, &recsnmppdu); if (snmprmsgn == snmpapi_failure) { cout << "error: message not received." << endl; getchar(); snmpapi_status = snmpgetlasterror(session); // error code 8 : snmpapi_noop return snmpgetlasterror(session); } if needed can provide more of code.

R Shiny execute order -

i new shiny (and r matter) have managed app , running. i quite confused regarding "execution order" takes place when rstudio runs 2 scripts server.r , ui.r to mind there 4 sections of code (2 server.r script , 2 ui.r script): server.r: ###### section 1 shinyserver(function(input, output, session) { ###### section 2 }) ui.r: ###### section 1 shinyui(fluidpage( ###### section 2 ) ) my question is, assuming have above correct, sections run first, second, third, etc? add print statement in each section , run rstudio. message displayed in console. got [1] "section 1 of ui" [1] "section 2 of ui" [1] "section 1 of server" [1] "section 2 of server" as object access, tried following , see variables in each environment. ui.r vardefinedinsec1ui <- 1 print("* section 1 of ui") cat(ls(), "\n\n") shinyui(fluidpage( vardefinedinsec2ui <- 2, print("* section 2 o