Posts

Showing posts from April, 2010

php - WIRIS Editor save as img src instead of mathml in ckeditor -

i using wiris editor plugin in ckeditor. the equations type saved .png in wiris_plugin/cache_folder. is there way call images img src tag , store in database by default, our plugins work in full mathml mode ( http://www.wiris.com/plugins/docs/full-mathml-mode ) storing formulas mathml in database. however, if prefer, can store them html img tags changing wiriseditorsavemode=image in configuration.ini file detailed in documentation link provided earlier.

java - Double convert to Fraction -

i want double convert value fraction (in java). example: 0.33333 -> 1/3 i have many examples fraction found, not me. numbers between 0 1. has perhaps have idea? tahnks, i guess want approximate fraction representation of double value (like example) a simple way try denominators 1 one: double doubleval = 0.33333; double negligibleratio = 0.01; for(int i=1;;i++){ double tem = doubleval/(1d/i); if(math.abs(tem-math.round(tem))<negligibleratio){ system.out.println(math.round(tem)+"/"+i); break; } } this prints 1/3 . if set double doubleval = 0.6363636; , prints 7/11 . you can change negligibleratio bigger value if want more succinct fraction result.

ios - Can't use SDWebImage -

xcode: version 7.2 os x: 10.10.5 i'm newbie ios , trying use sdwebimage in objective-c following official installation guide, error: undefined symbols architecture x86_64: "_objc_class_$_sdwebimagemanager", referenced from: objc-class-ref in viewcontroller.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) i downloaded zip file , unzip-ed it, , added file project. also, added dependency "imageio.framework" , linker flag "-objc". screenshot i've read these questions: how install sdwebimage undefined symbols architecture arm64: “_objc_class_$_paytabcardreaderviewcontroller”, referenced from: objc-class-ref in viewcontroller.o don't download , unzip. horrible way things. use cocoapods , carthage or @ least git submodules . "unzip way" makes code harder maintain: cannot know version imported (when go project in year), noone knows

joomla3.0 - how to space between images in carousel slider 360 -

how space between images in carousel slider 360 joomla module : carousel ck demo & download files. i want insert space between image. thanks try use css. should work div element something div.carouselck_images{ margin: 10px; }

javascript - Adding a custom header to HTTP request using angular.js -

i novice angular.js, , trying add headers request: var config = {headers: { 'authorization': 'basic d2vudhdvcnrobwfuoknoyw5nzv9tzq==', 'accept': 'application/json;odata=verbose' } }; $http.get('https://www.example.com/applicationdata.svc/malls(1)/retailers', config).success(successcallback).error(errorcallback); i've looked @ documentation, , seems me should correct. when use local file url in $http.get , see following http request on network tab in chrome: get /app/data/offers.json http/1.1 host: www.example.com connection: keep-alive cache-control: max-age=0 if-none-match: "0f0abc9026855b5938797878a03e6889" authorization: basic y2hhzhn0b25lbwfuoknoyw5nzv9tzq== accept: application/json;odata=verbose x-requested-with: xmlhttprequest if-modified-since: sun, 24 mar 2013 15:58:55 gmt user-agent: mozilla/5.0 (x11; linux x86_64) applewebkit/537.22 (khtml, gecko) chrome/25.0.1364.172

java - Process custom device event in Eclipse RCP -

i have eclipse rcp product working keyboard , mouse. want support custom hardware in product. enable device in eclipse rcp product, have written jni code. jni code initializes device & driver (which working correctly). after calling jni method rcp application code starts receiving events in display.readanddispatch() method. don't understand is, how events widget class. swt widgets have windowproc methods handles events. these methods handles predefined events , private (package private) methods, can't event override them. at http://www.eclipse.org/articles/article-writing%20your%20own%20widget/writing%20your%20own%20widget.htm page, in native widget section, explained adding hook windowproc method in c++ code. tried doing in following way: jniexport jint jnicall java_com_aiit_iadss_framework_event_spacemouseeventmanager_initinternal (jnienv *env, jobject obj, jlong hwnd ) { fprintf(stderr, "initializing space mouse module!"); //code

sql - Query that looks for contract status in another table and flags accordingly -

i have following 2 tables: table contract number other field 1 2 b 3 c 4 d … … table b contract number contract status date of contract status 1 status-1 1/1/2016 1 status-2 1/2/2016 1 status-3 1/3/2016 2 status-1 1/1/2016 2 status-3 1/2/2016 2 status-4 1/3/2016 2 status-5 1/4/2016 3 status-1 1/1/2016 3 status-2 1/2/2016 4 status-3 1/1/2016 4 status-4 1/2/2016 4 status-5

mysql - How to execute 2 more query in php -

i have 2 queries executed simultaneously. should do? :-). here code: $sql1 = mysql_query("select tregmk.kmk,tmmatakuliah.nmk,ifnull(tmmatakuliah.sks,0) sks tregmk join tmmatakuliah on (tregmk.kmk=tmmatakuliah.kmk) left join v_all_nilai_kk on ((tregmk.kmk=v_all_nilai_kk.kmk) , (v_all_nilai_kk.stambuk=$_session[stambuk]) , (v_all_nilai_kk.nilai > 2)) (tregmk.tahunajarn=$thajaran) , (tregmk.semester=$smster) , (tregmk.fakultas=$fakpilihan) , (tregmk.prodi=$prodi) , (tregmk.jenjang=$jenjang) , (v_all_nilai_kk.kmk null) , (tmmatakuliah.nokur=$no_kur)"); $sql2 = mysql_query("select trkrs.nid,trkrs.iplalu,trkrs.sksdicapai,trkrs.sksrencana,trkrs.sksdiambil, trkrs.ipk,trkrs.konsentrasi,trkrs.tanggal,tdkrs.kmk,tdkrs.statskmk,tdkrs.tanggal,tmdos.nid,tmdos.nama, tmmhs.nasert trkrs join tdkrs on

python 2.7 - Getting an error of "No module named oauth2 " -

i trying run python tool authenticate me linkedin, in order me download linkedin network might able analyze inside of gephi. obtained such file here: linkedin-1-oauth.py github i cloned , 2 other files has in gist. did terminal doing git clone [url here] 3 of files. put api , secret keys in corresponding places. i did pip install oauth2 , updated httplib2 suggested here: pip install oauth2 , update httplib2 i did command line, downloaded , installed files in same directory downloaded linkedin files gist, in user folder. when trying pip install oauth2 , following error message: downloading/unpacking oauth2 running setup.py egg_info package oauth2 requirement satisfied (use --upgrade upgrade): httplib2 in /usr/lib/python2.7/dist-packages (from oauth2) installing collected packages: oauth2 running setup.py install oauth2 error: not create '/usr/local/lib/python2.7/dist-packages/oauth2': permission denied complete output command /usr/bin/python -c

C#/.Net Create Excel File From XML -

i have seen working example in past data/xml data created. saved .xls extension. when open it, excel file. i don't remember how xml tags formed or were. i've searched , looked around haven't succeeded yet. i don't want use library, either 1 free microsoft or open source or other third party one, thing. anyone has idea acomplishing ?

android - The constructor ArrayAdapter<String>(LayoutNext, int, String[]) is undefined -

i try implement items spinner android.support.v4.app.fragment class. compiler error the constructor arrayadapter(layoutnext, int, string[]) undefined how can fix this? here code: public class layoutnext extends fragment implements onclicklistener,onitemselectedlistener{ timepicker timepicker; private spinner spinner_next; public arrayadapter<string> adapter; public static fragment newinstance(context context) { layoutnext f = new layoutnext(); return f; } public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { viewgroup root = (viewgroup) inflater.inflate(r.layout.layout_next, null); timepicker = (timepicker) root.findviewbyid(r.id.timepicker1); timepicker.setis24hourview(true); timepicker.setcurrenthour(0); timepicker.setcurrentminute(0); string[] items_next = { "next", "from t

internationalization - Is there any Python package which allows parsing .po files (messages, including context comments)? -

i need merge/update/delete .po files messages , need python package allow me parse .po files including: messages, plurals, location, context , comments. i want simple tool check differences between files. use gui done not sure if there such tool add new translation or remove not used translation. i search articles not found how it. please recommend python package parse .po (could other language) or tool such important task keep translations. the polib package good. parses file , presents several ways access data, including iterator loop through msgid, msgstr pairs whatever need. here quick start documentation . it can parse .mo if .po isn't available, specially handle obsolete message strings, iterate on translated strings, , other nice features.

compilation - how is linking done in c++? -

i using proxygen library facebook build simple client example . in directory have 2 object files how link them : using: g++ -std=c++11 -o my_echo curlclientmain.o curlclient.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread i think ma missing linker flag -lgflags in above example. maybe after including -someflag out compilation . how know possilble library flags posiible 1 have used -lproxyhttpserver. in short these libs defined or located. using ubuntu. here error message in function `main': /home/kshitij/proxygen/httpclient/samples/curl/curlclientmain.cpp:91: undefined reference `proxygen::httpconnector::httpconnector(proxygen::httpconnector::callback*, folly::hhwheeltimer*)' /home/kshitij/proxygen/httpclient/samples/curl/curlclientmain.cpp:102: undefined reference `proxygen::httpconnector::connect(folly::eventbase*, folly::socketaddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::asyncsocket::optionkey

Getting process ID with java apache default executor -

i'm writing code runs commandline using default executor of apache. found way exit code couldn't found way process id. my code is: protected void runcommandline(outputstream stdoutstream, outputstream stderrstream, commandline commandline) throws innerexception{ defaultexecutor executor = new defaultexecutor(); pumpstreamhandler streamhandler = new pumpstreamhandler(stdoutstream, stderrstream); executor.setstreamhandler(streamhandler); map<string, string> environment = createenvironmentmap(); try { returnvalue = executor.execute(commandline, environment); } catch (executeexception e) { // , on... } returnvalue = e.getexitvalue(); throw new innerexception("execution problem: "+e.getmessage(),e); } catch (ioexception ioe) { throw new innerexception("io exception while running command line:" + ioe.getmessage(),ioe); } } what should in order process

http - gwan v7.12.2- files in www folder can't be visited when with query string -

for example: http://123.456.789.123/page.html, 200 ok http://123.456.789.123/page.html?, 404 not found. http://123.456.789.123/page.html?debug, 404 not found, too. our website, using same version, not show behavior: http://www.gwan.ch/en_timeline.html? http://www.gwan.ch/developers? both request have same effect as: http://www.gwan.ch/en_timeline.html http://www.gwan.ch/developers the support of query string static contents (as opposed servlets) has been implemented in year 2013.

c# - Missing UPN and PUID claims -

i'm trying access particular resource microsoft graph using following code: private const string _userurl = "https://graph.microsoft.com/v1.0/me"; public static async task<userprofile> getuserprofile() { using (var client = new httpclient()) { using (var req = new httprequestmessage(httpmethod.get, _userurl)) { var token = await gettoken(true); req.headers.add("authorization", string.format("bearer {0}", token)); req.headers.tryaddwithoutvalidation("content-type", "application/json"); using (var response = await client.sendasync(req)) { var content = await response.content.readasstringasync(); userprofile profile = jsonconvert.deserializeobject<userprofile>(content); return profile; } } } }

javascript - How load canvas from json with events? -

i save canvas json json.stringify(canvas) , when use canvas.loadfromjson(json) , canvas object exists , right, events on canvas elements not work , default canvas settings (as renderonaddremove, selection) not work; wrong? sorry english.

debian - Ceph gatherkeys KeyNotFoundError: Could not find keyring file: /etc/ceph/ceph.client.admin.keyring on host node1 -

i have started learning ceph , got error quickly. have spent 4 days solve problem unfortunately without success. read official documentation quick ceph deploy , same error in 5th point. not work when setup public_network in ceph.conf: ceph-deploy mon create-initial because ceph-deploy gatherkeys not work. show me same error (i have tried on debian 8.2 , centos 7): [ceph_deploy.gatherkeys] [warnin] unable find /etc/ceph/ceph.client.admin.keyring on node1 [ceph_deploy] [error ] keynotfounderror: not find keyring file: /etc/ceph/ceph.client.admin.keyring on host node1 i have 4 nodes in tutorial: admin-node, node1, node2, node3 have ssh conection without password. steps: 1. ceph-deploy new node1 (ok) 2. cange ceph.conf in my-cluster folder: osd_pool_default_size = 2 public_network = 10.0.0.0/24 (ok) 3. ceph-deploy install admin-node node1 node2 node3 (ok) 4. ceph-deploy mon create-initial (error) can explain me doing wrong? it has been happe

Is it possible to get a value out of a literal string in c#? -

i have literal string contains details of json array need extract value in c# the string looks following: "{\"field1\":[],\"field2\":333,\"field3\":\"string\".... now field2 field wish in isntance, have no idea how in c# check out newtonsoft.json package on nuget.org, can parse json , can retrieve keys name

jQuery Show current div on input focus -

i have 2 inputs on form , want show respective panel when input on focus. i using bootstrap form divided in 2 columns: left column input , right column panel needs shown when input on focus. previously firing panels on page when 1 input selected tried use $(this).parent().next().('.js-panel-tip').show(); didn't work. how can target respective panel of selected input? jsfiddle js: $('.js-show-panel-tip').focus(function() { $(this).parent().next().('.js-panel-tip').show(); $(document).bind('focusin.js-panel-tip click.js-panel-tip',function(e) { if ($(e.target).closest('.js-panel-tip, .js-show-panel-tip').length) return; $(document).unbind('.js-panel-tip'); $('.js-panel-tip').fadeout('medium'); }); }); $('.js-panel-tip').hide(); html: <div class="container"> <form> <div class="row"> <div class="col-md-6

javascript - Nodejs referencing module.exports -

i'm trying js code shared between browser , nodejs server. that, use these practises: http://caolanmcmahon.com/posts/writing_for_node_and_the_browser/ the problem when want export function, not object. in node like: var constructor = function(){/*code*/}; module.exports = constructor; so when require used can do: var constructor = require('module.js'); var oinstance = new constructor(); the problem when try reference module.exports object in module , use reference overwrite function. in module be: var constructor = function(){/*code*/}; var reference = module.exports; reference = constructor; why doesn't work? don't want use easy solution insert if inside clean code, want understand why illegal, though reference===module.exports true. thanks it not work because reference not point module.exports , points object module.exports points to: module.exports \ -> object / reference w

sql azure - Publishing a web role with node.js and msnodesql gives sql error IM002 -

i publishing node app using publish-azureserviceproject. not related sql server working ok. upon running query though, error im002 ("data source name not found , no default driver specified") it looks proper drivers not installed in production environment? after had same problem when running service locally, sorted out after installed driver here so question is, need install driver on production well, , if so, how? that indeed problem. logged in remote desktop role , installed sql native client.

ios - swift : show another view controller on swipe up in first view controller -

Image
hi checked many questions regarding swiping in have doubts . in app have 2 pages 1. user view controller 2. question view controller user page looks now want implement show questions view controller while swiping users screen bottom. i new ios, me in achieving this. edit: the problem while swiping should start showing other view controller. if swiped till middle of screen finger still touching screen, should show 2 view controllers.can achieve using push/pop this first you'll have add uipangesturerecognizer "questions bar" can pan show questions view. to handle multiple view controllers, can use container view controller: var pendingviewcontroller: uiviewcontroller? { didset { if let pending = pendingviewcontroller { addchildviewcontroller(pending) pending.didmovetoparentviewcontroller(self) pending.view.frame.origin.y = uiscreen.mainscreen().bounds.height view.addsubview(pendin

In java protected membes access from diff package -

in java, how can access protected members in different package? package p1 class base protected int x package p2 import p1.* class derived extends base int x class subderived extends derived int x from subderived main want access x of p1.base protected specification can use inheritance can't use reference access base x . access derived x can use super.x , subderived , how can access base.x ? protected members accessible derived , sub-derived classes without qualifiers: rather writing base.x = 123; you can write x = 123; and compile fine, long in method of derived class. however, in order work, need remove members same name derived class itself: otherwise, base member hidden , , cannot accessed through more 1 level of inheritance hierarchy through normal syntax of language, i.e. without using reflection .

UWP App with multiple frames using the MVVM pattern -

is there library / framework simplify universal windows platform app development of application contains multiple frames. i mean, using mvvm light or bezysoftware mvvm-navigation application highly tied idea of navigating between different pages hosted single frame. the ui try develop consist of multiple content frames (main, left, right) content varies. need let me navigate between different views (by placing these views appropriate frame) , provide same features have bezysoftware mvvm-navigation , so: handling of view model state persistence the ability activate / query deactivate view models back button feature few different options: combination of single navigation service injected view model , user controls areas need repeated view view (e.g. tabs, status bars, etc). route, every time create new view paste in common user controls need appear. able expose bindable properties said user controls. combination of contentcontrol , datatemplate , , datatemp

function - Replace hover event with click in JQuery -

i'm using following jquery code control style elements on mouse hover drop down menu solution: $(window).load(function () { // on hover show or hide $("#menu ul li").hover(function(){ $(this).children("ul").show(); $(this).children("ul").css('background-image', 'none'); }, function(){ $(this).children("ul").hide(); }) // on hover show or hide $("#menu ul ul li, #menu ul ul li ").hover(function(){ $(this).css('color', '#666'); }, function(){ $(this).css('color', '#fff'); }) }); see working example: http://www.youmeusdesign.co.uk/menu_test i modify can replace hover function click function. when client using touch interface not support hover functionality. windows phone example. ios works ok device has classes handle hover events. i've tried mo

slickgrid - Slick Grid: Slick grid using with Bootstrap popup calendar issue -

i using slick grid bootstrap . have slick grid in page , onclik of button of page 1 bootstrap pop open thenin popup have choose date insert in cell. calendar coming in behind popup. what should do. please add follwing code in page solve issue here ui-datepicker-div id hash symbol need prefix ui-datepicker-div { z-index: 99999 !important; /* must > popup editor (950) */ }

batterylevel - Significance of EXTRA_LEVEL in Android BatteryManager class -

what value of extra_level batterymanager class in android signify? trying understand change of 1% in level signify. example galaxy nexus battery capacity 1750 mah. mean, change of 1% signify flow of 17.5 mah of electric charge? what value of extra_level batterymanager class in android signify? quoting the documentation: "extra action_battery_changed: integer field containing current battery level, 0 extra_scale." does mean, change of 1% signify flow of 17.5 mah of electric charge? not precisely, though may close. batteries not discharge linearly, example. device manufacturers concerned ensuring reported level reasonably accurate in terms of indicating how charge available. not concerned maintaining accuracy respect battery capacity printed on label on side of battery.

f# - Deedle series.ValuesAll raise Error: OptionalValue.Value: Value is not available -

the valuesall function of deedle series according doco returns collection of values, including possibly missing values. note length of sequence matches `keys` sequence. however following code raise error optionalvalue.value: not available. expected behaviour? expecting valuesall can return double.nan #i "..\..\packages\deedle.1.2.4" #load "deedle.fsx" open system open system.globalization open system.collections.generic open deedle let ts = [datetime.now.date => double.nan; datetime.now.date.adddays(1.0) => 1.0] |> series ts.print() ts.valuesall > 27/01/16 12:00:00 -> <missing> 28/01/16 12:00:00 -> 1 val ts : series<datetime,float> = 27/01/16 12:00:00 -> <missing> 28/01/16 12:00:00 -> 1 val : seq<float> > ts.valuesall ;; val : seq<float> = error: optionalvalue.value: value not available > there different implementations valuesall here , c#-friendly valuesall

javascript - Cant find the issue with my synax "Uncaught SyntaxError: Unexpected token <" -

i messed in syntax somewhere im still kinda new ajax, jq i cant figure out syntax error is, ive been looking @ time now, , thought ask guys. $(function (){ var $beskederul = $('#beskeder'); //var $besked = $('#besked'); function addnybesked(data){ $beskederul.append('<li>['+ data.tid +' besked: '+ data.besked + '</li>'); } $.ajax({ type: 'get', url: '../mmudkast/code/getmessage.php', success: function(beskeder){ beskeder = json.parse(beskeder); $.each(beskeder, function(i, data) { addnybesked(data); }); }, });

Kendo ui grid inline and popup mixed and template on popup -

i saw link great explanation onabai, i´m trying set template temporary popup , can´t make work: $(".k-grid-popup", grid.element).on("click", function () { // temporarily set editable "popup" grid.options.editable = "popup"; // insert row grid.addrow(); // revert editable inline grid.options.editable = "inline"; }); how set template of popup? regards. while can access grid options directly, change options should made using setoptions method. function notify grid of options change , able make internal change handle event according the new options. $(".k-grid-popup", grid.element).on("click", function () { grid.setoptions({editable: "popup"}); grid.addrow(); grid.setoptions({editable: "inline"}); }); i don't have working example of code can't tell if need change else in code.

javascript - develop CMS in Ember js -

i new in emberjs, feel ember , structured mvc framework, is possible create content management system in ember ? i want create new pages, section in pages, thing ember using routes pages, , want dynamic pages, page may have different styles, this.route('admin',{ resetnamespace: true },function(){ this.route('dashboard',{ resetnamespace: true }); }); can dynamically generate routes thank in advance is possible create content management system in ember ? yes, is. i want create new pages, section in pages, thing ember using routes pages, , want dynamic pages, page may have different styles, that's possible. can dynamically generate routes thank in advance you can use dynamic query params able have custom pages. example, in admin panel can have input fields many things such page html, page style, page javascript, page name. store these things in database. if navigates example app.com/pages/mynewpage que

dynamic - in c#, how to call a function according to db value without if/else -

i trying call function according db value without using if/else or case. sample code below , think explain better. logoobj.data ms = logoapp.newobj(logoobj.dataobjtype.item); // item the "item" information comes select query. "item" "customer" well. therefore, dont want write code below. if(datatable_result.rows[0][0].tostring()=="item") ms = logoapp.newobj(logoobj.dataobjtype.item); else if(datatable_result.rows[0][0].tostring()=="customer") ms = logoapp.newobj(logoobj.dataobjtype.customer); ......... ......... ......... can have piece of below, because need logoobj.data ms = logoapp.newobj(logoobj.dataobjtype.xxxxxdb_valuexxxxx); you can use enum.parse : var enumvalue = enum.parse(typeof(logoobj.dataobjtype), datatable_result.rows[0][0].tostring(), true); //true = ignore case ms = logoapp.newobj(enumvalue); if have potential items in database not match of enum values, should instead use enum.tryparse

ruby on rails - Puma or Unicorn VS Webbrick load test benchmark shows no improvement -

the setup ok, running rails application on heroku(free tier). i have 2 separate application releases, lets call them staging , fake-production . in staging , using webbrick server. procfile web: rails s -p $port in fake-production , using puma server. procfile is bundle exec puma -c config/puma.rb i have configured puma run 2 workers , 1 thread per worker. config/puma.rb defined below (taken heroku's setting puma webserver ) workers integer(env['web_concurrency'] || 2) threads_count = integer(env['max_threads'] || 1) threads threads_count, threads_count preload_app! rackup defaultrackup port env['port'] || 3000 environment env['rack_env'] || 'development' on_worker_boot # worker specific setup rails 4.1+ # see: https://devcenter.heroku.com/articles/deploying-rails-applications- with-the-puma-web-server#on-worker-boot activerecord::base.establish_connection end my database.yml configured h

.net - How to add URL comment to word document using c#? -

Image
this code. can put comment want put url in comment. how can this? using microsoft.office.interop.word; using microsoft.office.core; private void button3_click(object sender, eventargs e) { // open doc file. microsoft.office.interop.word.application application = new microsoft.office.interop.word.application(); microsoft.office.interop.word.document document = application.documents.open(@"e:\temp3.docx"); object comment = "www.google.com" + environment.newline; object missing = system.reflection.missing.value; microsoft.office.interop.word.comment var = document.comments.add(document.words[1], comment); try { document.hyperlinks.add(var.range,ref missing,ref missing,ref missing,ref missing,ref missing); } catch (exception ex) { messagebox.show(ex.tostring()); } document.close(); application.quit(); } but result this and bad paramete

Force camera to be in portrait mode using cordova / ionic app -

hey hi guys working on hybrid app, invoking camera app want camera in portrait mode only. tried doing changing config file as <preference name="orientation" value="portrait"/> but camera open starts rotation how prevent it exists plugin force orientation https://github.com/gbenvenuti/cordova-plugin-screen-orientation just force portrait before entering camera mode, , disable after exit. // set either landscape screen.lockorientation('landscape'); // allow user rotate screen.unlockorientation(); i dont know if going work, because camera native, if embed camera in app, works sure. please post results ;)

Passing variable from jQuery to PHP on the same page -

please bear me, i'm new php. i'm using mixture of php , jquery on same page. need pass variables jquery php . examples came across describe how pass variables php file on server don't want. far manged convert object json using jquery $.tojson(); question is: possible pass jquery data php code if both jquery , php reside on same page? here code far: var myobject = {name: 'tomas', age: 38}; var encoded = $.tojson( myobject); var name = $.evaljson( encoded ).name; var version = $.evaljson(encoded).age; no not possible since php not client side script rather server side script. means time data given client php script have finished running. following demonstrates relationship between php , javascript: server -> php -> client (browser) -> javascript therefore, impossible have javascript communicate php on same page. can use ajax call server side file said - i'm afraid as can in terms of php , javascript communication

php - Expression is not allowed as field default value -

i trying make $app available whole class. first "expression not allowed field default value" second on line 5 get: unidentified variable $app how can achieve goal? class usercontroller extends xcontroller { var $app = yii::app();; public function init() { $test = $app; you can not call method set default value variable in php, if static method. change set in constructor: use yii; class usercontroller extends xcontroller { var $app; function __construct() { $this->app = = yii::app(); } public function init() { $test = $this->app; } } as sidenote, should not use var keyword in php versions > 4, see this question explanation.

How to create this 'for each loop' in Ruby? -

given: class author < activerecord::base has_many :articles end upon receipt of json file includes author's articles, i'd destroy articles in database author, not included in json file. how can create 'for each loop'? article_collection = @author.articles.all unless article_collection.blank? article_collection.each |article_from_collection| # how can check on next line if it's id included in params? if article_from_collection.arti_id "is not part of" params[:author][:articles_attributes] article_from_collection.destroy end end end how can check on 5th line, on basis of arti_id included in params, whether article arti_id exists in json input? should perhaps build collection of arti_id s in parameters , use .include? see each article in db, if in collection? i tried 2 lines below. first returns false irrespective whether article included in json or not. second line returns error typeerror exception: no implicit

How do I find the smallest epoch time that is in today (local timezone) with Perl? -

perl time function great, how find smallest epoch value that's in today? since epoch in seconds imagine there many epoch values correspond given day. how find lowest in timezone? it's not supported use of timelocal , should have no problem using information want. use time::local qw( timelocal ); $epoch = timelocal(0,0,0, (localtime)[3,4,5]); i don't know of time zone day 2 midnights, can't test that. i tested time zone day no midnight (2013-10-20 in america/sao_paulo), , worked fine.

input - CSS for a checked radio button's labels -

i'm using css supplied in post behaves ganging hides , shows content based on inputs being checked or not. here css input#show, input#hide { display:none; } span#content { display:none; } input#show:checked ~ label[for="show"] { display: none !important; } input#show:checked ~ span#content { display:block; } input#hide:checked ~ span#content { display:none; } and html <label for="show"> <span>[show]</span> </label> <input type=radio id="show" name="group"> <span id="content">content <label for="hide"> <span>[hide]</span> <input type=radio id="hide" name="group"> </label> </span> see working example here: http://jsfiddle.net/khnne/466/ but, css seems being ignored: input#show:checked ~ label[for="show"] { display: none !important; } i want hide l

How bluemix resolves to Secure Gateway clients? -

while using secure gateway integrate bluemix , on-prem applications, can use ibm client installer, docker or datapower. for now, let consider ibm client installer & docker. while configuring client either through docker or installing client, don't specify details of host on secure gateway client running. provide gateway id & security token. want understand how resolution happens? in other words, how bluemix connects gateway client establish connectivity on-prem resources. it other direction: secure gateway (sg) client connect bluemix environment. thus, administrator of on-prem resources has full control. client knows connect to. the official documentation secure gateway has more details.

javascript - filter array of objects on click by 'last month' and 'last week' using moment.js -

i have datecreated 2015-12-11t11:12:14.635z coming database every object in array i want filter array last week , last month problem if today 19th march, search 11th 18th last 7 days , seems search last 7 days calculating 24 hours * 7 searches need start 00:00:01 each day. now 1st want calculate last week first.. based on current date using moment.js , convert above format can filter data basically, want calculate last week based on current timestamp. the dates should be: var last7daystart = moment().startof('day').subtract(1,'week'); var lastmonththisday = moment().startof('day').subtract(1,'month'); var yesterdayendofrange = moment().endof('day').subtract(1,'day'); then if javascript filter use lodash , do: var javascriptarrayofobjectswithdates = [ { date : '2015-12-11t11:12:14.635z', anotherproperty: 0 }, { date : moment().subtract(1, 'day' ).format(), testthis: 'wor

Need clear path about celery daemon process -

i tried set celery , celerybeat running daemon . django project running kombu broker . store results in db configured in settings.py. i need clear guidance setup process. locally run worker , beat . has run daemon. i tried steps mentioned in tutorial , while running sudo /etc/init.d/celeryd start , prints error tommy@tommy-lenovo-g570:/var/www$ sudo /etc/init.d/celeryd start ("\nthe 'celeryd-multi' command deprecated, please use 'celery multi' instead:\n\n$ celery multi start worker1 --uid=tommy --gid=tommy --workdir=/var/www/project/ --pidfile=/var/run/celery/%n.pid --logfile=/var/log/celery/%n.log --loglevel=info --cmd=/var/www/project/manage.py\n\n",) celery multi v3.1.20 (cipater) > starting nodes... unknown command: '--executable=/usr/bin/python' type 'manage.py help' usage. > worker1@tommy-lenovo-g570: * child terminated errorcode 1 failed i need recover error. couldn't find location of error also.

R: How come that "is" is TRUE, but "as" is impossible? -

the class "ecdf" inherits class "stepfun". if f such empirical cumulative density function, both is.stepfun(f) , is(f,"stepfun") true , , as.stepfun(f) doesn't expected. conversion of f "stepfun" as(f,"stepfun") impossible because of "metadata", if strict false : f <- ecdf(1:10) class(f) # [1] "ecdf" "stepfun" "function" is.stepfun(f) # [1] true is(f,"stepfun") # [1] true identical(f,as.stepfun(f)) # [1] true g <- as(f,"stepfun",strict=false) # error in as(f, "stepfun", strict = false) : # internal problem in as(): “ecdf” is(object, "stepfun") true, metadata asserts 'is' relation false so how is related as , meaning of "metadata" here? i may have found relevant information. @ this nabble archive but has 2 problems: 1) as() s4 method not work (problem 2 not relevant) locally :-)

In swift,is it a global variable or property? -

global variables variables defined outside of function, method, closure, or type context.《the swift programming guide》。 so question: class dog { var name: string? func run(){ } } name global variable or property? @implementation dog{ nsstring *name; - (void)run{ } } name global variable or property? since class type, name property in swift example. in objective-c example, name global variable since properties defined in @interface scope , requires @property declaration. (instance variables don't require declaration have inside block inside @interface or @implementation scopes.)

wcf - Royal Mail Shipping API C# -

i'm trying integrate royal mail soap api .net code. have followed advice here consume wcf royal mail api in c# console application , here c# wcf namespaces move header & use ns prefix . i have created custom iclientmessageformatter able attach namespaces beginning of soap envelope, still can't seem work. keep receiving following error. not establish trust relationship ssl/tls secure channel authority 'api.royalmail.com', , inner exception is: remote certificate invalid according validation procedure. i using visual studio 13 , .net version 3.5, i've tried numerous other versions no further progress. when debug can see normal message been passed royalmailmessage when runs onwritestartenvelope can't see changes _message object. i've created trace see soap request been sent. i have sent xml request royal mail support validate reason failing due namespaces not been declared in envelope , missing prefixes. royalmail.cs internal class royalmail