Posts

Showing posts from June, 2014

android - ImageView setBackgroundRessource not update even with inflate -

i'm trying update imageview gridview border, doing have xml file works : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#158cdb" /> </shape> </item> <item android:left="3dp" android:right="3dp" android:top="3dp" android:bottom="3dp"> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> </shape> </item> </layer-list> so launch activity, timer launched , after 15 secondes, try update imageview, tried code : public void highlightfooditem(int id) { imageadapter ia = (imageadapter) _grid.getadapter(); (int = 0; < ia.getcount(); i++) { view currentview...

vb.net - Visual Basic get all profiles from registry sub folder -

i trying find every sub folder of profiles program called autocad. i have managed specify specific profile, able find profiles. this have far 1 particular profile (its default profile on computers) dim readvalue2014 string = my.computer.registry.getvalue( "hkey_current_user\software\autodesk\autocad\r19.1\acad-d001:409\profiles\<<unnamed profile>>\dialogs\appload\startup", "numstartup", nothing) unnamed profile default profile. can see there other folders after need value numstartup from. so need way list of sub folders folder profiles. i assume can string other sub folders on end of list of profiles. i have no idea how this. thanks you might want use registrykey class instead of my. helper classes. registrykey softwarekey = registry.currentuser.opensubkey("software") registrykey autodeskkey = softwarekey.opensubkey("autodesk") and on... , finally: dim profilenames() string = profileskey.getsub...

rails: delayed-job progress bar -

i trying show user progress bar task running in delayed job. populating large amount of data using delayed job in database this. class importschoolsanddistricts < struct.new(:import, :content) def perform total = content.size content.each_with_index |record,index| # create records here import.update_attribute(:progress, (index + 1)/total*100) end end end end :import instance of import model attribute progress . use progress attribute display user status of job percentage. but update of progress not occurring continuously. updating twice: once @ beginning , once @ end, values getting progress 0% , 100%. since using ruby 1.9, cannot use progress_bar https://github.com/d4be4st/progress_job (requires ruby 2.0.0)

c++ - Crash cause of own template -

why program crashing when use template? i'm doing wrong? that's test program, because actual program big posting here. first qdebug test1 displayed second not. #include <qcoreapplication> #include <qdebug> #include <qmutex> class mutexlocker { public: mutexlocker(qmutex& m) : _m(m) { _m.lock(); } ~mutexlocker() { _m.unlock(); } private: qmutex& _m; }; template<typename t> class threadguard { public: threadguard() { _mutex = new qmutex(); } ~threadguard() { delete _mutex; } void set(const t& other) { mutexlocker m(*_mutex); q_unused(m); _r = other; } void set(int i, int j) { mutexlocker m(*_mutex); q_unused(m); _r[i] = j; } t r() const { mutexlocker m(*_mutex); q_unused(m); return _r; } const threadguard<t>& operator=(const t& other) { set(other); return *this; } private: threadguard(const thre...

php - Facebook V2.3 to getFriends list -

is there solution complete facebook friends list without asking app permission? submitted review many times facebook not approving. we need in 1 of our applications. as stated in facebook api documentation, can't http://webcache.googleusercontent.com/docs/graph-api/reference/v2.3/user/friends

apache pig - Pig DUMP command hangs -

this i'm trying grunt> mydata = load '/user/sunil/pigdev/player.csv' using pigstorage(',') ( id:int, name:chararray, age:int, gender:chararray, game:chararray, location:chararray); grunt> describe mydata; data: {id: int,name: chararray,age: int,gender: chararray,game: chararray,location: chararray} grunt> dump mydata; it initializes , loads everything, creates jar well(as can see in console logs). but, hangs forever below log message in console. 2015-06-10 18:32:30,163 [main] info org.apache.pig.backend.hadoop.executionengine.mapreducelayer.mapreducelauncher - 0% complete i checked log files( nodemanager , proxyserver , yarn-resourcemanager ), don't see error message. i'm using cdh version : hadoop 2.5.0-cdh5.3.0 pig version : apache pig version 0.12.0-cdh5.3.0 (rexported)

javascript - local storage not giving correct results -

i trying build post notes. reading head first series. did code. somehow it's no working. <form action="post"> <input id="note_text" type="text" placeholder="enter note"> <input type="button" id="add_button" value="add note"> </form> <ul id="postitnoteslist"> <li>this first note.</li> <li>this second note.</li> </ul> and here js window.onload=init; // add sticky page function addstickytopage(value) { var sticky = document.createelement("li"); span.setattribute("class", "sticky"); document.getelementbyid("postitnoteslist").appendchild(sticky); } // create , sticky note localstorage function createsticky() { var value = document.getelementbyid("note_text").value; var key = "sticky_" + localstorage.length; localstorage.setitem(key,...

Does HDFS sink support writing to sequence file in Spring XD? -

i use hdfs sink in stream processing writing data of binary key-value pair hdfs. result, thin wrapper format sequence file suffice. hdfs sink module support writing key-value hdfs sequence file @ all? thanks in advance! looks yet addressed: https://jira.spring.io/browse/xd-992 . can vote up. if want contribute, welcome. please refer spring xd documentation , https://github.com/spring-projects/spring-xd-modules examples on how develop modules. also, fyi: there hdfs-dataset sink module supports avro/parquet format. https://github.com/spring-projects/spring-xd/blob/master/modules/sink/hdfs-dataset/config/hdfs-dataset.xml

javascript - FadeIn div on scroll inside a div -

thats script: function init() { window.addeventlistener('scroll', function(e){ var distancey = window.pageyoffset || document.documentelement.scrolltop, shrinkon = 70, header = document.queryselector("header"); if (distancey > shrinkon) { classie.add(header,"smaller"); } else { if (classie.has(header,"smaller")) { classie.remove(header,"smaller"); } } }); } window.onload = init(); with one, able fadein "menu"-div, when scroll down inside <>body<>. want same scrolling inside "wrapper"-div. @ moment "menu"-div doesn´t fadein when scroll down inside "wrapper"-div, because dont scroll <>body<>. so, question: there simple way add beside <>body<>-scroll "wrapper"-div scroll, fadein same "menu"-div @ script? thats classie....

c# - Dependency Injection in asp.net 5 custom classes, what is the correct way? -

trying understand di. what correct way use services/dependency objects in custom classes? do need create each class service , add dependency objects? or should using [fromservices] (previously, [active] before beta4 ) attribute. or there service object should passing access them? what trying understand, how code own classes use di controllers etc. [fromservices] mvc concept. not available other parts of asp.net 5 stack. if want pass dependencies down chain have few options: pass service provider. quite anti-pattern because objects need depend on di container , not inverting control. pass interfaces in constructors. "pure" di might end parameter nightmare (objects take 10 arguments in constructor). similar previous 1 group dependencies in factories. more di aligned , less parameter nightmare can create factory nightmare. inject top large level objects (for example: repositories, entire systems, etc). approach nice tradeoff between dependency nig...

html - Conversion from MathML equation to flash? -

i beginner @ , need guidance. the website working works in flash. using html equation editor , want users able enter equations , use them in flash environment display. mathml source code of equation saved. i'm confused how take equation developed html equation editor , use in flash environment. user must able edit equation (changing around mathml source code). there method display mathml in flash or have export equation png image use , edit in flash environment. thanks. disclaimer: work on tool. maybe alfred's equation editor (alfredeq) ask.

Self Hosted WCF Rest service ERROR : Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported -

i have wcf rest service that's self hosted. works fine until decided have use jtoken ( newtonsoft.json.linq.jtoken ). got error : type 'newtonsoft.json.linq.jtoken' recursive collection data contract not supported. consider modifying definition of collection 'newtonsoft.json.linq.jtoken' remove references itself. i've seen answers post , one , others. fact is, i'm hosting services within internal program (in company work, can't show :-( ). i'm doing it's self hosted, implementations , interfaces of services aren't wcf service library, class library, can't access menu they're talking in answers (where there's : "reuse types in specified referenced assemblies"). i couldn't find solution , use jtoken. here's service contract : [servicecontract] public interface isearchservice { [operationcontract] [webinvoke(method = "post", requestformat = webmessageformat.json, resp...

swift2 - Swift do-try-catch syntax -

i give try understand new error handling thing in swift 2. here did: first declared error enum: enum sandwicherror: errortype { case notme case doityourself } and declared method throws error (not exception folks. error.). here method: func makemesandwich(names: [string: string]) throws -> string { guard let sandwich = names["sandwich"] else { throw sandwicherror.notme } return sandwich } the problem calling side. here code calls method: let kitchen = ["sandwich": "ready", "breakfeast": "not ready"] { let sandwich = try makemesandwich(kitchen) print("i eat \(sandwich)") } catch sandwicherror.notme { print("not me error") } catch sandwicherror.doityourself { print("do error") } after do line compiler says errors thrown here not handled because enclosing catch not exhaustive . in opinion exhaustive because there 2 case in sandwicherror enum. ...

c# - Getting selected items from a listbox using the index instead of value -

when fill listbox, this: sqldataadapter adapter = new sqldataadapter("select [ddlvalue], [storedvalue] [tmpdropdowns] ddlname = 'ddlhobbies' order [sortorder] asc", conn); adapter.fill(ddlhobbies); hobbies.datasource = ddlhobbies; hobbies.datatextfield = "ddlvalue"; hobbies.datavaluefield = "storedvalue"; hobbies.databind(); and when want retrieve items, this: var selectedhobbies = hobbies.items.cast<listitem>().where(item => item.selected); string strhobbies = string.join(",", selectedhobbies).trimend(); unfortunately, gives me this: strhobbies = "fishing,skiing,pool,birdwatching" i "unfortunately" because objective use strhobbies in "where" clause in sql string. so, sql string should like: select * mytable hobbies in (strhobbies) so, there's 2 pieces problem. how change "var selectedhobbies" line pull in storedvalue rather ddlvalue how restructure "str...

javascript - tricky setTimeout sequence -

set of settimeout calls intervals 0,1,2,3. function f() { settimeout(function a() {console.log(10);}, 3); settimeout(function b() {console.log(20);}, 2); settimeout(function c() {console.log(30);}, 1); settimeout(function d() {console.log(40);}, 0); } f(); output: (from chrome. hope same in other browsers) 30 40 20 10 can explain why ordering not 30, 40, 10, 20? said browsers maintain minimum 10ms or (spec says) 4ms interval. if so, validate output time metrics or whichever convenient explain behavior. minute detail missing understand awesome feature of language? edited: i know these functions asynchronous. , have read john resig' blog couple of times. , know settimeout' callback not guaranteed execute @ interval specified. to more precise, expect explanation can explain behavior in terms of execution queue, event loop, call stacks , timers. in order understand how timers work internally there’s 1 ...

java - Timezone name stored in database is incorrect using hibernate/JPA -

i using hibernate 4.2 jpa , oracle 11g database. using simple java program store date timezone information in database.below defination of table create table "aw"."aw_request_details_test" ( "id" number, "request_type" varchar2(20 byte), "requestor" varchar2(20 byte), "requestor_region" varchar2(20 byte), "requestor_type" varchar2(20 byte), "event_datetime" timestamp (6), "event_type_id" number, "printed_mtrl" varchar2(1 byte), "is_location_usa" varchar2(1 byte), "is_analyst_attestation" varchar2(1 byte), "analyst_attestation" varchar2(500 byte), "analyst_disclosure" varchar2(500 byte), "analyst_derv_pos" varchar2(1 byte), "analyst_pos_details" varchar2(500 byte), "last_modified_by" varchar2(20 byte), "last_modified_date"...

How do i pass data from main activity to my database in android -

mainactivity @override public void onlocationchanged(location location) { log.d(tag, "firing onlocationchanged.............................................."); mcurrentlocation = location; mlastupdatetime = dateformat.gettimeinstance().format(new date()); string lat = string.valueof(mcurrentlocation.getlatitude()); string lng = string.valueof(mcurrentlocation.getlongitude()); } database.java public void insertsettings(string lattitude, string longitude) { sqlitedatabase db = getreadabledatabase(); contentvalues values = new contentvalues(); values.put(lattitude, lattitude); values.put(longitude, longitude); db.insertorthrow(locate_table, null, values); } i need pass string lat , string lng database... new..so pardon mistakes , please help.

geolocation - How to use AngularJs to load user location, which can be used in the entire application? -

in angularjs, after call geolocation , call remote service determine location (city, state, country), how can reuse data in entire application? what mean is, getting geolocation , determining city async, ideally, want things once. after that, every time new page opened, controller asking geoservice city or something. but how can it? i have tried create service, exposes property, city. in next controller, property has no value, , have recall methods. thought service should singleton. i could, use cookie after first time loaded. but want know, how other people handle kind of thing? thanks! you should sharing service data across multiple controllers, that: app.service('cache', function ($http, $q) { var mycache={}; return { getdata: function (key) { var deferred = $q.defer(); if (mycache[key]) { deferred.resolve(mycache[key]); } ...

c# - Reading remote Windows event logs takes a very long time -

i have written c# program connects remote host , reads windows event logs. system.diagnostics.eventlog eventlog = new system.diagnostics.eventlog(); eventlog.log = "application"; eventlog.machinename = "remotemachinename"; if (eventlog.exists(eventlog.log, eventlog.machinename)) { foreach (eventlogentry entry in eventlog.entries) { console.writeline(entry.message); } } however, due extremely large number of events, when run code, takes time fetch eventlog.entries . update: there way read logs since particular time (say, logs created since past 1 hour) instead of reading logs? plan read logs , later filter logs created since past 1 hour, not solution. the short answer no. eventlog class offers no way take last x entries or entries past y date or effect. additionally you're not allowed receive eventwritten event remotely me gives 1 simple far ideal work around limit logs size. if you're consistently pulling log don...

java - H2: executeBatch doesn't work -

i have following code string query = "insert student (age,name) values (?,?)"; conn.setautocommit(true); ps = conn.preparestatement(query); (student student:list) { ps.setint(1, student.getage()); ps.setstring(2, student.getname()); } int[]temp=ps.executebatch(); system.out.println("temp:"+temp.length);//returns 0 the code executed. no errors no exceptions. table student empty. use h2 1.3.176 in embedded mode. wrong? you forgot add batch set of parameters: string query = "insert student (age,name) values (?,?)"; conn.setautocommit(true); ps = conn.preparestatement(query); (student student:list) { ps.setint(1, student.getage()); ps.setstring(2, student.getname()); ps.addbatch(); // <-- } int[]temp=ps.executebatch(); system.out.println("temp:"+temp.length);

petrel - Ocean SDK Academic license -

i'm studying @ hw university, , topic of individual project (diploma research) develop petrel plug-in ocean framework. aim of project "automatically" locate , configure horizontal wells in particular way. unfortunately use ocean sdk specialized license needed. our university has got petrel runtime license, not "developer" license. possible obtain kind of academic license happens microsoft products @ dreamspark ? may limited period of time ? you should go http://www.ocean.slb.com , ocean website , use contact link provide request schlumberger. use "hw" identify university. if herriot watt can tell in past gifted ocean developer licenses organization.

javascript - D3 cannot append to SVG from within function -

i attempting append shapes on svg block within function call using following code... function generatenodes(){ var data = [[0,0],[100,100]]; d3.select("svg").selectall("circle") .data(data) .enter().append("circle") .attr("class","test") .attr("r", 5) .attr("cx", function(d){ return d[0]; }) .attr("cy", function(d){ return d[1]; }); } however nothing appearing in svg after call generatenodes() in console. when try.. d3.selectall(".test") it returns array of length 0 implying nothing has been inserted dom. this leads me presume issue either .enter() or .data() functions not being used correctly. i tried coding example in jsfiddle seems working, makes above code more confusing. http://jsfiddle.net/llbf3x0c/ any or advice appreciated.

postgresql - Reference Local Variable In PL/PGSQL Dynamic SQL Inside Function -

i have pl/pgsql function data processing. need first select each row table, , retrieve column names , associated values of each column. un-pivoting records horizontal state. necessary since going key/value store instead of being stored horizontally. here abstract of function have far: create or replace function myfunc() returns int $body$ declare x record; aesql varchar; aeval varchar; y information_schema.columns%rowtype; begin x in select * mytable loop y in select * information_schema.columns table_schema = 'public' , table_name = 'mytable' loop execute 'select cast(x.'||y.column_name||' varchar) aeval'; end loop; -- add processing aeval once dynamic sql figured out end loop; return 1; end; $body$ language plpgsql volatile; i have troubleshot far enough understanding execute statement should crud query or...

excel - To find all possible combinations of strings present in a column range (order does not matter ,repetition not allowed) -

i want possible combinations of values present in column range , print them in excel sheet: please note order of combination not matter i.e ab=ba here example of data in column1 combinations found: f1 f2 f3 f4 the possible combinations of these : f1f2 f1f3 f1f4 f2f3 f2f4 f3f4 f1f2f3 f1f2f4 f1f3f4 f2f3f4 f1f2f3f4 this first stack overflow answer: this might not elegant approach, works. first eliminate repetitions in data. inclination use vbscript dictionary -- can in pure vba this. if have n distinct items -- count 0 2^n -1 in base 2, each of corresponds combination (subset). seem want throw out subsets of size less 2. wrote function this, sub test with. sub assumes data starts in a1 , contiguous. prints results in column b: sub additem(c collection, x variant) dim long = 1 c.count if c(i) = x exit sub next c.add (x) end sub function base2(number long, width long) string 'assumes width long enough hold number dim n long, lo...

mingw - perl ExtUtils::CppGuess fails to build -

i'm trying install extutils::cppguess on windows 8.1 using activeperl, keep getting errors. i've tried can find on internet, nothing working. when run cpanm extutils::cppguess then in build.log cpanm (app::cpanminus) 1.7036 on perl 5.020002 built mswin32-x64-multi-thread work directory c:\users\anthon~1/.cpanm/work/1433950037.5028 have make c:\perl64\site\bin\dmake.exe have lwp 6.08 falling archive::tar 2.04 searching extutils::cppguess () on cpanmetadb ... --> working on extutils::cppguess fetching http://www.cpan.org/authors/id/e/et/etj/extutils-cppguess-0.09.tar.gz -> ok unpacking extutils-cppguess-0.09.tar.gz entering extutils-cppguess-0.09 checking configure dependencies meta.json checking if have extutils::makemaker 6.58 ... yes (7.04) configuring extutils-cppguess-0.09 running makefile.pl checking if kit complete... looks generating dmake-style makefile writing makefile extutils::cppguess writing mymeta.yml , mymeta.json -> ok checking dependencies...

android - Image into SQLite and not to gallery -

i have requirement store image in android app , shouldn't appear in gallery.so, decided have sqlite database in app 'assets' folder , store imagepath database. problem is, if not sdcard, how imagepath? or there way hide images captured app appearing in gallery. below code using store images in external directory. photo = new file(environment.getexternalstoragepublicdirectory(environment .directory_pictures), imagename); //imagename=current timestamp i'm using method save images internal storage (and save returned path sqlite) private string savetointernalstorage(bitmap bitmapimage, string filename){ contextwrapper cw = new contextwrapper(getapplicationcontext()); // path /data/data/yourapp/app_data/imagedir file directory = cw.getdir("imagedir", context.mode_private); log.d("dir", directory.tostring()); // create imagedir file mypath=new file(directory,filename); log.d("path", mypath.to...

linux - How can I apply a CSS stylesheet to all page views in XULRunner -

i trying develop display device (expected installed in public transports) able show (more or less fixed) web page in chromeless embedded browser on linux platform (i using archlinux ). after lot of tries mozilla firefox , focusing on use of small xulrunner application using following simple xul document: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="epl browser" width="1920" height="1080" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <browser type="content" src="http://www.example.org//" flex="1"/> </window> this works expected, want apply page (whatever web page choose) css rule removing unwanted scrollbars, following: body { overflow: hidden; } when using mozilla firefox , simple, needed put in chrome/usercontent.css file inside firefo...

hadoop - Hive JOIN of query with subquery takes forever -

lately have been playing bit hive. things have been progressing well, however, when try convert like 2015-04-01 device1 traffic other start 2015-04-01 device1 traffic violation deny 2015-04-01 device1 traffic violation deny 2015-04-02 device1 traffic other start 2015-04-03 device1 traffic other start 2015-04-03 device1 traffic other start into 2015-04-01 1 2 2015-04-02 1 2015-04-03 2 i tried using following query reason reduce stage of query gets stuck @ 96% no matter how long wait. select pass.date, count(pass.type), count(deny.deny_type) firewall_logs pass join ( select date, type deny_type firewall_logs device = 'device1' , date '2015-04-%' , type = 'traffic' , subtype = 'violation' , status = 'deny' ) deny on ( pass.date = deny.date ) pass.device = 'device1' , pass.date '2015-04-%' , pass.type = '...

change value in hash using an array of keys in ruby -

i wondering if possible access value of hash array of keys described in post ruby use array tvalues index nested hash of hash . aim not access value change value. understood keys.inject(hash, :fetch) returns value of hash-value determined key-array , not it's reference. how can accomplish modify value? i know it's bad style modify object instead of making copy , working immutables in severel cases seems more comfortable short way. thanks lot. use last key nested hash, assign using last key. keys[0...-1].inject(hash, :fetch)[keys.last] = value ruby doesn't have references can't reassign value directly. instead have reassign object pointer, means going 1 level of nesting.

c# - how to use namespace of external project? -

currently : i have following using in program. using mtx; which allows me use mtx.* properties. refers file in "externals" folder. path : externals/mtx.dll needed : however, debugging purposes, i'd have whole mtx solution in external , use it. path : externals/mtx/(solution in there folders) how can so, instead of using refers mtx.dll , refers solution , build has part of own? i think misunderstanding concepts , mixing things. let me explain own explanation: i have following using in program. using mtx; allows me use mtx.* properties. refers file in "externals" folder. path : externals/mtx.dll the using keyword allows use classes inside namespace without typing whole namespace everytime. has nothing dll classes, can use public dlls insidea class using whole namespace + class name adding project reference. needed : however, debugging purposes, i'd have whole mtx solution in external , u...

java - Model.Finder<I, T> Deperecated Play! 2.4 -

i building application using latest version of play!. when defining finder( in model.finder) ide gives me warning finder deprecated. can't find information in documentation model.finder being deprecated of alternative using it. has experienced similar issue , know of alternative? according github model.finder not deprecated, 1 of constructors: /** * @deprecated */ public finder(class<i> idtype, class<t> type) { super(null, type); } make sure use correct constructor, pointed out @biesior: public static finder<long, foo> find = new finder<>(foo.class);

unit testing - How do I test array element types using BDD Javascript? -

i writing javascript unit test using bdd style. want test value is array has string elements i can first condition with value.should.be.an('array'); is there way test second condition using idiom? i think clean way use array.prototype.every, give boolean value indicating if every value in array string. can use value in assertion. value.every(function(el){ return typeof(el) === 'string'; }).should.be.true;

JPA Version column isn't updating after merge() -

i'm updating entity via entitymanager#merge() new jpa version number jpa isn't being reflected correctly in returned entity. @stateless @transactionattribute(transactionattributetype.required) public class leadservice { @persistencecontext(name = "joose") private entitymanager em; public lead createorupdatelead(lead lead) { if (lead.getid() != null) { em.merge(lead); } else { em.persist(lead); } return lead; } how should deal this? thanks!

can't get answer of ajax with Javascript -

this question has answer here: how return response asynchronous call? 21 answers i have this: var = makerequest(url); function makerequest(url) { var http_request = false; if (window.xmlhttprequest) { http_request = new xmlhttprequest(); if (http_request.overridemimetype) { http_request.overridemimetype('text/xml'); } } else if (window.activexobject) { try { http_request = new activexobject("msxml2.xmlhttp"); } catch (e) { try { http_request = new activexobject("microsoft.xmlhttp"); } catch (e) {} } } if (!http_request) { console.log('falla :( no es posible crear una instancia xmlhttp'); return false; } http_request.onreadystatechange = alertcontents; http_request.open('get', url, true); http_request.send(null); function alertconten...

How to create an array of methods in rails -

def id_attachment_require_upload? !object.id_attachment? end ... def work_attachment_require_upload? !object.work_attachment? end i want make below. array = %w(id address work) array.each |a| def #{a}_attachment_require_upload? !object.#{a}_attachment? end end is there way me create array of methods automatically in rails save me redundant work. arup's answer looks it's way go i'm not sure if object.#{a}_attachment? work. if does, learned new today. can use public_send . array = %w[id address work] array.each |a| define_method "#{a}_attachment_require_upload?" !object.public_send("#{a}_attachment?") end end

javascript - How to use the RichFaces calendar dayClassFunction in client mode? -

richfaces allows specify custom javascript function via dayclassfunction attribute control css classes of days: http://docs.jboss.org/richfaces/4.3.x/4.3.4.final/vdldoc/rich/calendar.html yet doesn't work in client mode, after full server roundtrip styling gets updated. doesn't work mean function isn't being called until server roundtrip occurs. how 1 enable in client mode?

javascript - Google Map Mark Not Working -

i following tutorial of google map on google developer , trying make google map mark. after made that, pin on map shows white rectangle, instead of map pin. here link made here code: head.php: <head> <title><?php echo $title; ?></title> <meta charset = "utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style/sponsor_enquiry_style.css"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> <script type="text/javascript" src="script/script.js"></script> <script type="text/javascript" src="script/map.js"></script...

interface - HuggableInterface in PHP and PSR-8 -

on php framework interop group site (the maintainer of psrs), there draft psr-8 huggable interface : namespace psr\hug; /** * defines huggable object. * * huggable object expresses mutual affection huggable object. */ interface huggable { /** * hugs object. * * hugs mutual. object hugged must in turn hug other * object calling hug() on first parameter. objects must * implement mechanism prevent infinite loop of hugging. * * @param huggable $h * object hugging object. */ public function hug(huggable $h); } the draft quite short not provide examples of implementation. purpose of implementing interface? having fun! see merge date: crell on apr 1, 2014 merge in interface definitions. it's joke :) (april fools' day.)

android - Adobe AIR app with ALIPAY -

we developing application adobe air in-app purchase (of game add-ons). need implement alipay inside app. downloaded documentations, looks there no native extension air. thought using php + stagewebview (to show ui user paument) . here has experience alipay + as3? create api on own server maps alipay api or hit alipay api directly. shouldn't use stagewebview more displaying simple page since have absolutely no control on , cannot retrieve data or response browser in as3. if planning upload ios app store, can't use alipay. must use apple's in-app purchase system. if don't, apple reject app. don't know google play store off top of head, believe recommended same though not enforced way apple does. additionally, natively supported , users expect when using android or ios device. there various air native extensions (ane) can use implement (just searching , should find some)

javascript - Adding function into JSON object -

i have json object; let’s call model; has 2 properties of type array. model has function “hasanyfilterselected” checks if of array property populated.i have search button & 2 drop downlist on ui. when user clicks on search button, there steps occurs: 1>push selected values drop down list model’s array properties. 2>model.hasanyfilterselected() checks if of array has values, in debugger see model populated values. 3>if yes, refresh kendo grid executing datasource.read() 4>kendo grid calls “getfilters” method returns model, again in debugger see model populated values. 5>then somehow hasanyfilterselected() gets called again , time model array properties undefined. looks kendo trying serialize model again , time model has different instance im not sure. $(function () { var model = { selectedtaxyears: [], selectedstates: [], hasanyfilterselected: function () { return !(this.selectedtaxyears.length =...

sql server - Bad Image Format Exception when creating record in database -

Image
i'm using entity framework(model first) in c# project ,and using sql server database.when i'm trying add record in table encounter exception. what's problem? your error unrelated line. if view documentation exception, says: the exception thrown when file image of dynamic link library (dll) or executable program invalid. together message, "bad il range," think have corrupted assembly somewhere. possible solutions look @ exception details determine file exception thrown if it's file built project, try clean solution , rebuild if it's library, reinstall it check if have processing assemblies, obfuscator -- see this post last resort : check viruses, hardware issues, , reinstall .net

Can't Create Azure File Share: The remote name could not be resolved: 'calcpaebooks.file.core.windows.net' -

i can't create azure file share. followed instructions in http://blogs.technet.com/b/canitpro/archive/2014/09/23/step-by-step-create-a-file-share-in-azure.aspx http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx#faq7 http://blogs.msdn.com/b/cie/archive/2014/06/06/new-azurestorageshare-the-remote-name-could-not-be-resolved-fileservices-file-core-windows-net.aspx i went in azure preview portal , signed file share. got email form microsoft saying: "your subscription microsoft azure files preview has been activated" but, error message in azure power shell "the remote name not resolved: 'calcpaebooks.file.core.windows.net' " what doing wrong? you try create file share through gui in azure preview portal. select storage account, load detail page of storage account. in page, click files (services tab), load list of file shares (if any). in next page, click file shares (you sho...

linux - Error running bash script in supervisor -

i have bash script makes work supervising network stuff, works great when run manually, when put in supervisor ifs , whiles not work, stops before of programming sentences, echos, running cat, more , other things work fine, in minute put if nothing else work there on. please give me tips, need run script supervisor. thanks etan reisner, have fix problem, put here if else have same problem see why. problem simple (as usual) reading content of text files /sys/class/net/eth0/carrier , /sys/class/net/eth0/operstate detect when network cable plugged , unplugged , doing more (i don't know why, because if ran script manually worked great) when executed in supervisor stopped execution there after first more , changed cat , it. haft day spent solve that. hope if gets kind of trouble find answer , way can solve problem fast. regards

jquery - How to implement YADCF into a server side DataTable -

i trying add column filters server side datatables.js request (the database using huge). when add lines yadcf, have no functionality of text boxes. proper way add column filters php file? have: index.php <head> <link rel="stylesheet" type="text/css" href="css/jquery.datatables.css"> <script type="text/javascript" language="javascript" src="js/jquery.js"></script> <script type="text/javascript" language="javascript" src="js/jquery.datatables.yadcf.js"></script> <script type="text/javascript" language="javascript" src="js/jquery.datatables.js"></script> <script type="text/javascript" language="javascript" > $(document).ready(function() { 'use strict'; var datatable = $('#employee-grid').datatable( { ...

c# - Assign a raw HTML tag to a JavaScript variable -

i'm working on existing asp.net application , came across interesting piece of javascript i've been wondering about. a few variables being declared literals, , aren't in strings. example, done: <script type="text/javascript"> var jsondata = <asp:literal id="myjsonobject" runat="server" />; ...... </script> and in server side code(c#), these tags being altered jsontextwriter this: var stringbuilder = new stringbuilder(); var stringwriter = new stringwriter(stringbuilder); using (var jsonwriter = new jsontextwriter(stringwriter)) { jsonwriter.formatting = formatting.indented; jsonwriter.writestartobject(); jsonwriter.writepropertyname("someproperty"); jsonwriter.writevalue("somevalue"); jsonwriter.writeendobject(); } myjsonobject.value = stringbuilder.tostring(); this in turn causing jsondata variable able used json object in client side code. what i've no...