Posts

Showing posts from May, 2011

objective c - Where is an ideal location to store the root url in an iOS app to get access to an external API? -

where ideal location store root url in ios app access external api? i'm thinking of using nsbundle not sure if right. or should using constant variable? thanks in advance! you have few options: create static class built interact api , keep url there. you can use constant variable defined in 1 of headers , import it you can use constant variable defined in prefix.pch (i don't recommend this) when build production grade apps use 1st one. takes little bit longer, cleans code more. let's i'm interacting api has todo list on server somewhere. want request first todo list item each todo list item title , content. i'll first create todo list class has 2 properties , 1 method: @property (nonatomic, strong) nsstring *title; @property (nonatomic, strong) nsstring *content; + (mytodolistitem*)todolistitemfromdictionary:(nsdictionary*)dict; all 1 method convert dictionary create in networking class json response todolist item. now ne

android - layout_width in table row -

i have tablelayout multiple rows. rows may have 2 or 3 elements. <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <tablerow android:layout_height="wrap_content" android:layout_width="match_parent" android:weightsum="2"> <textview android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="1" android:text="@string/spielfortsetzung" /> <textview android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="1" android:text="@string/loesung" /> </tablerow> <tablerow android:layout_height="wrap_content" android:layout_width="match_parent"> <te

outlook - Display Exchange multiple room / resource calendars in one SharePoint calendar - Group or Team Calendar -

setup: sharepoint 2013 enterprise server on-premise , exchange 2010 server. i want able pull in multiple room calendars exchange 1 single sharepoint calendar. allow users @ room availability in 1 screen , them book meeting @ time they'd it. ideally able book meeting right calendar. want able out of box if possible. one other use set calendar entire team can see availability in 1 screen. know can these things in outlook client wanted know if possible ootb in sharepoint. i've tried bunch of things including activating hidden feature group work lists (which no longer accessible via ui in 2013, used available 2010) , creating calendars group team turned on, etc. i've tried hidden calendar webpart allows show personal calendar - not interested in that. i've tried page viewer trick , point url owa url, give me 1 calendar , not multiple , have set owa single sign on - rather not if don't have to. i know there's bunch of webparts can buy (or code 1 mys

java - What is the HTTP status return code for a successful DELETE statement in REST? -

i studying how spring handle rest web services (but don't know if spring related answer or more generically related rest concept). so doubt is: http status return code successful delete statement? is 204 or 200 ? i know 200 means request correctly fulfilled reading online seems me expect after successful returning content , not after delete. somewhere found 204 status obtained after successful put or delete . true? can't understand, means the response empty , why empty respons means put or delete operation gone succesfull? there no strict rules on http status code correct 1 each method. depends on happened, information need send client, etc. can think of few examples: a successful delete , no further information. 204 no content a successful delete , have warning related orphan resources should deleted too. 200 ok . you accepted delete request, might take long time , you're going asynchronously. client should check later. 202 accepted . you ac

caching - Android glide load bitmap -

in app, have image view, image content server in format of base64 encoded string. store locally , decode bitmap. bitmap loaded image view. makes app scroll slow. found reason behind no caching done bitmap. 1 recommended solution use glide. did not find method load bitmap using glide. found following method glide.with(context).load("http://goo.gl/gegyud").into(pollwebview); can load bitmap using glide? you can pass file glide. glide.with(context).load(new file("your/file/name.jpg")).into(pollwebview);

java - Selenium Hub Pause Data Stream -

i'm looking way pause data stream of selenium hub. idea wait till hub has finished processing test/batch, put on hold, send kill command node, on headless vm restart, upon reconnect allow data stream continue. idea allow nodes/vm's restart , refresh, potentially avoiding hangups , connection timeouts. thoughts? instead of pausing data stream, can create java class implements testsessionlistener . interface has methods can tell when test starting , ending. can write custom code restart machines after each test or based on other logic. you can refer selenium grid extras project uses this. more simple example on creating grid plugin refer grid plugin tutorial

python - Popen.communicate() throws UnicodeDecodeError -

i have code: def __executecommand(self, command: str, input: str = none) -> str: p = sub.popen(command, stdout=sub.pipe, stderr=sub.pipe, stdin=sub.pipe, universal_newlines=true) p.stdin.write(input) output, error = p.communicate() if (len(errors) > 0): raise environmenterror("could not generate key: " + error) elif (p.returncode != 0): raise environmenterror("could not generate key. return value: " + p.returncode) return output and unicodedecodeerror in line output, error = p.communicate() : traceback (most recent call last): file "c:\python34\lib\threading.py", line 921, in _bootstrap_inner self.run() file "c:\python34\lib\threading.py", line 869, in run self._target(*self._args, **self._kwargs) file "c:\python34\lib\subprocess.py", line 1170, in _readerthread buffer.append(fh.read()) file "c:\python34\lib\encodings\cp1252.py", line 23, in decode

Android ContentProvider to access photos on phone -

i'm trying write android contentprovider interface images (jpgs) on phone. fields i'd out might filename text, created_date date, modified_date date, image blob (for starters). i'm trying make simple gallery app, master activity shows thumbnails in gridview, , detail activity shows 1 image + meta data. maybe showing exif tags (if any) in jpg file. i've followed example in udacity course on android apps, there contentprovider against sqlite database on phone. boils down actual sql, "fits" cursors , queries. i'm having difficult time applying non-sql, -- in case -- set of files. i know there's standard contentprovider mediastore can (should) used access photos , videos, want (and need to) design own cp. however, don't know begin. understanding far write class photoprovider extends contentprovider, following model of weatherprovider . contract , dbhelper classes, analog of those? hope can point me in right direction.

javascript - HTML form disappears after updating angularJS -

i have run across interesting issue. have decided update angularjs try , latest stable version. upon updating form in html seems have disappeared. first form in html <form name="form1"><button></button></form> <form name="form2"></form> in above instance object form1 no longer exists button still there. if drop blank form before form1 2 forms exist no empty 1 created. i have been able track change down angular-route.js file between 1.2.4 , 1.2.5. suggestions or ideas appreciated.

javascript - Is the angular scope binding &(ampersand) a one time binding? -

is angular scope binding &(ampersand) 1 time binding? see referred one-way binding, one-time? let's have: <my-custom-directive data-item="item" /> and directive declared follows: .directive('mycustomdirective', [ '$log', function ($log) { return { restrict: 'e', templateurl: '/template.html', scope: { dataitem: '&' } controller: function ($scope) { // .... } }]) the reason i'm asking if binding one-time because seems i'm observing, is. if item in parent scope updated, 1 in directive not updated. am right in saying binding 1 time? to achieve want, directive keeps copy without affecting parent scope's item -- did this: .directive('mycustomdirective', [ '$log', function ($log) { return { restrict: 'e', templateurl: '/template.html', scope: { dataitemoriginal: '=' }, link: function ($

c# - microsoft .net encrypted file format -

the examples i've seen of doing encryption .net describe creating streams, put in file. best practices require putting more in ciphertext file in addition output of cipher algorithm. there standard format file, place initialization vector, hash value if appropriate, , i've forgotten? or different format created each application?

pointers - C in PIC32, Passing a Struct Variable between 2 *.c File -

i have hit wall , speed. i have "filea.c" file , "fileb.c" file pass variables between. furthermore, "filea.h" , "fileb.h" headers respectively. a variable uint16 storage1.cntlog1.posedge in "filea.c" "fileb.c". how do using pointer? below code snippet of filea.h header file , pass fileb.c variable posedge reference. there 2 varibales posedge 1 in header , other in c file. do. typedef struct { uint16 posedge; } s_posedge; typedef struct s_cntlog1 { s_posedge cntlog1; } s_cntlog1; this snippet of filea.c typedef struct { uint16 posedge; } s_cntlog2; private s_cntlog1 storage1; private s_cntlog2 *storage2 = null; storage1.cntlog1.posedge = storage2->posedge; what tried........ tried using uint16 sharelog(void) { return (storage1.cntlog1.posedge); } and declaring in header "filea.h", "#include f

AutoHotkey script for automatic windowed-fullscreen on a specific app -

here's i'm @ : #noenv ; recommended performance , compatibility future autohotkey releases. sendmode input ; recommended new scripts due superior speed , reliability. setworkingdir %a_scriptdir% ; ensures consistent starting directory. settitlematchmode, 3 loop { ; apparently loop recommended app-as-a-trigger. send, ^!a winget, p_exe, processname, forged alliance, style, style, { if(style & 0xc40000) { winset, style, -0xc40000, winmaximize, } sleep, 100 } } return obviously i'm trying make when forgedalliance.exe runs it's window borders removed , maximised. i had working script triggered hotkey : lwin & f:: winget style, style, if(style & 0xc40000) { winset, style, -0xc40000, winmaximize, } else { winset, style, +0xc40000, winrestore, } return and wish triggered app running. i tried : if processexist("forgedalliance.exe") { } return but did not work, condition returned true (always executed code) tho

android - OutOfMemory error, and no idea how to set up bitmaps -

sorry if question bit obvious, i've created app, contains bunch of customized buttons on mainscreen. in beginning, worked fine, made something, no idea what, unfortunately i've forgotten i've done. now, im getting annoying outofmemory error, , i'm not pro in programming, i'm stuck in fixing this. i've tried setting managing bitmap memory, downloaded sample app, got lost in there, didnt found looked mainscreen. i've tried put code fom developer site in mainscreen.java, think not way works: //.......old code(not important)........ i happy if me, i'm stuck 3 hours on problem. update i'm trying scale down images , followed ( android dev link ) i'm far (following code mainscreen, mainactivity): //.................... @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds =

Dealing with next line character in C -

i have written program check if 2 given strings palindromes. it works fine test cases sometimes include new line char appended @ end of string , need ignored. example: two passed strings are: india\n aidni and response should yes, these palindromes. my code looks this: #include <stdio.h> int main(void) { char arr1[100]; char arr2[100]; int = 0, j = 0; int len1 = 0, len2 = 0; scanf("%s", arr1); scanf("%s", arr2); while (arr1[i] != '\0') i++; len1 = i; while (arr2[j] != '\0') j++; len2 = j; if (i != j) { printf("%s", "no"); return 0; } else { int count = 0; (i = 0; < len1; i++) if (arr1[i] == arr2[len1-i-1]) count++; if (count == len1) printf("%s", "yes"); else printf("%s", "no"); } return

javascript - Suppress / Silence Sammy.js route -

i've been trying suppress normal routing behavior in sammy.js router, far i've been unsuccessful. this other answer isn't helpful 2 reasons: the upvoted answer "unacceptable" in situation, 1 of "soft" requirements route can silenced without knowledge be. in other words, route should defined normally, , internals of sammy should check option whether trigger route handler or not. the second answer - var new_location = '#foo'; app.trigger('redirect', {to: new_location}); app.last_location = ['get', new_location]; app.setlocation(new_location); - doesn't work. as simple example, parent object has method defined: "navigate": function( href, options ){ var sammyapprouter = window.router; if( !options ){ options = {}; } if( options.silent ){ sammyapprouter.trigger( "redirect", { "to": href } ); sammyapprouter.last_location = [ "get&qu

Creating a dynamic Prolog list of arguments with the C++ interface -

im trying create dynamic list of arguments in c++ program , call rule in prolog using c++ interface swi-prolog. it's this: //includes int main { // other declarations plterm myvariable; pltermv myvector(3), vectorargs(2); pltail mylist(myvector[0]); //here want receive texts keyboard or otherwise in char* variables //and store in "myvector",but don't know how correctly. //i think not work anyway. vectorargs[0]= myvariable; vectorargs[1]= mylist; //myrule receives variable , list 3 interchangeable elements. plcall ("myrule",vectorargs); //the true program not simple xd cout<<"\nmy variable: "<<(char *)myvariable<<'\n'; return 0; } the result has "myvariable" first position of "vectorargs" , "mylist" second containing list "[text1, text2, text3]". got success us

How to remove None when iterating through a list in python -

i have 2 unequal lists , i'm using itertools loop through them , i'm trying use filter function remove none generated in list1 @ end of day contains 2 elements instead of 3 (counting none) keep getting error: type error: nonetype object not iterable import itertools list1 = [['a'],['b']] list2 = ['a','b','c'] l = list(itertools.chain(*list1)) print(l) a, b in itertools.zip_longest((b in list1 b in a),list2): filter(none, a) print(a,b) not entirely clear want. understand question , comments, want use izip_longest combine lists, without none elements in result. this filter none zipped 'slices' of lists , print non- none values. note way can not sure whether, e.g., first element in non_none list came first list or second or third. a = ["1", "2"] b = ["a", "b", "c", "d"] c = ["x", "y", "z"] zipped in izip_lon

Grayscale conversion algorithm of OpenCV's imread() -

what grayscale conversion algorithm opencv's cv::imread("image.jpg", cv::imread_grayscale); use? in opencv 3.0: cv::imread_color : image decompressed cv::jpegdecoder jcs_rgb (three channel image) , icvcvt_rgb2bgr_8u_c3r() function swap red , blue channels in order bgr format. cv::imread_grayscale : image decompressed cv::jpegdecoder jcs_grayscale (one channel image), details of color conversion , other preprocessing/postprocessing handled libjpeg . finally, decompressed data copied internal buffer of given cv::mat . ergo no cv::cvtcolor() called after reading image cv::imread_grayscale .

sql - How to combine to values from two records -

hi guys have following code should @ event cost, figure out transaction table if been paid , display unpaid balance. select casestudy_client.cleint_fname first_name, casestudy_client.client_sname surname, casestudy_client.client_phonenumber phone_number, casestudy_event.event_totalcost- casestudy_transaction.transaction_value unpaid_balance casestudy_client inner join casestudy_event on casestudy_client.client_id = casestudy_event.event_clientid inner join casestudy_transaction on casestudy_event.event_id = casestudy_transaction.transaction_eventid casestudy_event.event_eventstage ='complete' , casestudy_event.event_totalcost > casestudy_transaction.transaction_value; this works if have multi part transaction fails pick matching event id , assumes event. in test data have event costs £500, 1 transaction has value of 400 , 1 transaction value of 99. current output shows 2 records 1 unpaid balance of 100 , other 401.

javascript - Remove or hide the "all" category in a portfolio -

http://turnkey.advicemedia.com/semi-custom/ i'm trying figure out how ether hide or remove "all" category under portfolio. ideal scenario when goes portfolio page starts out blank , have chose 1 of 3 categories. add jquery website, this: code1 - <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script> and after jquery reference, add code: code 2 - <script> $(document).ready(function(){ $("li[data-filter='all'])".remove(); $(".projects_holder .mix").hide(); }); </script> copy code <html> <head> // paste code 1 here // paste code 2 here <head> </html>

vb.net - Is it OK to return as object when using generics? -

i'm trying grasp on generics , interfaces. there performance implications accepting generic , returning object? public interface interface1 sub load(reader sqldatareader) end interface public interface interface2 function insert(of t)(byval record t) object end interface the object returned need access load() method.

SQL: Select the minimum value from multiple columns with null values -

i have table 1 id col1 col2 col3 -- ---- ---- ---- 1 7 null 12 2 2 46 null 3 null null null 4 245 1 792 i wanted query yields following result id col1 col2 col3 min -- ---- ---- ---- --- 1 7 null 12 7 2 2 46 null 2 3 null null null null 4 245 1 792 1 i mean, wanted column containing minimum values out of col1, col2, , col 3 each row ignoring null values. in previous question ( what's best way select minimum value multiple columns? ) there answer non null values. need query efficient possible huge table. select id, case when col1 < col2 , col1 < col3 col1 when col2 < col1 , col2 < col3 col2 else col3 end min yourtablenamehere assuming can define "max" value (i'll use 9999 here) real values never exceed: select id, case when col1 < coalesce(col2, 9999)

php - How to Save and retrieve HTML 5 canvas (Fabric.js) into MySQL blob -

i want save , retrieve html 5 canvas have drawn using fabric.js, javascript library, mysql table using php has field namely cnvs_obj of blob type. have seen lot of tuts , q/a sessions none has step step way of teaching. how can this, thankful you. here canvas example. edit: here complete code: <canvas id="c" style="border:1px solid black;" width="500px" height="300px" ></canvas> <button onclick="myfunction()" id="btn2">click me</button> <script type="text/javascript" src="fabric.min.js"></script> <script type="text/javascript"> var canvas = new fabric.canvas('c'); $(function () { //canvas.stateful = true; var wel = new fabric.text('welcome fabricjs', { fontfamily: 'delicious_500', backgroundcolor: 'red', left: 80, top: 100 }); canvas.add(wel); }); canvas.rendera

java - jboss & maven: maven build fails due to libraries not opening -

i building jboss ea 6.3 quickstart project "greeter". i run maven clean install jboss-as:deploy in project dir instructed whilist jboss server running. i following errors: [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3. 1:compile (default-compile) on project jboss-greeter: compilation failure: compi lation failure: [error] error reading c:\users\boris\.m2\repository\org\jboss\spec\javax\faces\j boss-jsf-api_2.1_spec\2.1.28.final-redhat-1\jboss-jsf-api_2.1_spec-2.1.28.final- redhat-1.jar; error in opening zip file [error] error reading c:\users\boris\.m2\repository\org\hibernate\javax\persiste nce\hibernate-jpa-2.0-api\1.0.1.final-redhat-2\hibernate-jpa-2.0-api-1.0.1.final -redhat-2.jar; error in opening zip file [error] error reading c:\users\boris\.m2\repository\org\jboss\spec\javax\transac tion\jboss-transaction-api_1.1_spec\1.0.1.final-redhat-2\jboss-transaction-api_1 .1_spec-1.0.1.final-redhat-2.jar; error in opening zip file [erro

android - start an activity after button click -

i want start activity once after application starts. did code: boolean isfirstrun = getsharedpreferences("preference", mode_private) .getboolean("isfirstrun", true); if (isfirstrun) { //show start activity startactivity(new intent(mainactivity.this, firstlaunch.class)); toast.maketext(mainactivity.this, "first run", toast.length_long) .show(); } getsharedpreferences("preference", mode_private).edit() .putboolean("isfirstrun", false).commit(); but didn't work thing want. want when click on button , launch activity. main activity launches to start activity, need use intents. , can call when button clicked so: button mybutton = (button) findviewbyid(r.id.my_button); mybutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(currentactivity.class, nexta

c# - Binary Search with Strings -

i have object array , want search date / day property (user decides) using binary search. **edit: read sharesarray[mid].date values (and day values) text file , examples are: 05/02/2015, 14/10/2014.the searchstring value gained user in same format date values. ** this first attempt trying date property: int high, low, mid; high = sharesarray.length - 1; low = 0; while (low <= high) { mid = (low + high) / 2; if (string.compare(sharesarray[mid].date, searchstring, true) == 0) { break; } else if (string.compare(sharesarray[mid].date, searchstring, true) > 0) { high = mid - 1; } else if (string.compare(sharesarray[mid].date, searchstring, true) < 0) { low = mid + 1; } i have tried last else if statement else , doesn't make difference. also, matter way round string1 , string2 in string.compare part? summarizing answer q&a in comments of question, bit of additional context. for binary s

java - Wildfly (8.2.final): How to read a classpath resource? -

i have property file in classpath of application. src/main/resources/default.properties in ejb, has singleton , startup annotations, try read file following thread.currentthead().getcontextloader().getresource("default.properties"); this doesn't work. works in glassfish though. is there way read classpath resource in wildfly? i found solution. the call thread.currentthead().getcontextloader().getresource("default.properties"); doesn't work, following works. inputstream = thread.currentthread ().getcontextclassloader () .getresourceasstream ( "default.properties" ); i don't know why so, may help.

bash - combine find and grep into a single command -

how combine below 2 1 line without changing first one? # find / -name sshd_config -print # grep -i <sshd_config path> permitrootlogin i came following, don't know whether gives correct result in different cases cat `find / -name sshd_config -print` |grep permitrootlogin don't cat $(...) [ $() modern replacement backticks] -- doesn't work reliably if filenames contain special characters (spaces, wildcards, etc). instead, tell find invoke cat you, many filenames passed each cat invocation possible: find / -name sshd_config -exec cat -- '{}' + | grep permitrootlogin ...or, better, ignore cat altogether , pass filenames grep literally: find / -name sshd_config -exec grep -h -e permitrootlogin -- /dev/null '{}' + replace -h -h if want filenames shown.

mouseevent - Qt: How do I notify changing mouse coordinates to parent object -

Image
i have little problem qt class qgraphicsscene : detect current mouse coordinates made new class qgraphicssceneplus qgraphicsscene base class. have redefined slot function mousemoveevent(qgraphicsscenemouseevent* event) , received coordinates seem correct. want notify parent qmainwindow class, qgraphicssceneplus object stored, whenever mouse coordinates change. best way this? tried define signals , slots, didn't work. slot function wasn't found during execution of program. here code far: qgraphicssceneplus.h #ifndef qgraphicssceneplus_h #define qgraphicssceneplus_h #include <qobject> #include <qgraphicsscene> #include <qgraphicsscenemouseevent> class qgraphicssceneplus : public qgraphicsscene { public: qgraphicssceneplus(qobject* parent = 0); public slots: void mousemoveevent(qgraphicsscenemouseevent* event); public: int mx = 0; int = 0; }; #endif // qgraphicssceneplus_h qgraphicssceneplus.cpp #include "qgraphicssce

html - How do I make a row of divs with rows? -

i trying make row of divs, each div has 2 rows. have following code: index.html <!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title>row of divs</title> <link href="style.css" rel="stylesheet"/> </head> <body> <div class="inline"> <div class="block"> <p> abc <br> def </p> </div> <div class="block"> <p> ghi <br> jkl </p> </div> <div class="block"> <p> mno <br> pqr </p> </div> <div class="block"> <p> stu <br> vwx </p> </div> </div> </body>

rest - Related Resources with Django and Tastypie -

edit 2: have made progress , have updated code follows: i have these 3 models in models.py: class variables(models.model): variableid = models.integerfield(db_column='variableid', primary_key=true) variablename = models.charfield(db_column='variablenamecv', max_length=255) class meta: managed = false db_table = 'variables' class results(models.model): resultid = models.bigintegerfield(db_column='resultid', primary_key=true) variable = models.foreignkey('variables', related_name='results', db_column='variableid') units = models.foreignkey('units', related_name='units', db_column='unitsid') class meta: managed = false db_table = 'results' class units(models.model): unitsid = models.integerfield(db_column='unitsid', primary_key=true) unitstype = models.charfield(db_column='unitstypecv', max_length=255)

C++ Poker: skipping over If statements, and disregarding values -

i have been creating poker in c++, , noticed after have determined (or thought) player's hands, shows royal flush (or 9, in terms of hand_ranking). tested , came out if statements determining hands being skipped over. why these statements not registering, , how can fixed? p.s. know code kind of long, if don't feel looking @ please carry on. int hand_ranking = 0; bool one_pair_bool; int one_pair; bool two_pair_bool; int two1_pair; int two2_pair; if (min_all == min2_all){ one_pair = min_all; one_pair_bool = true; if (mid_card == max2_all){ two_pair_bool = true; two1_pair = min_all; two2_pair = mid_card; } else if (max2_all == max_all){ two_pair_bool = true; two1_pair = min_all; two2_pair = max2_all; } else{ two_pair_bool =

encoding - How to mark specific frames in a video stream/insert frame metadata to later recognize it on the receiving side -

sorry rather complicated question topic. describe here endgoal clarify why marking video frames. i need overlay infographic effects on video stream received internet/satellite (h264). effects should synced video frames appear natural. main problem infographics context depended, different each receiving client. impossible overlay them @ stream source , stream in infographics embedded. the idea came insert myself video encoding chain, mark specific frames synch data (how?) , decode on receiving side. to more specific = markers should "tag1" "tag2" "tag3", , receiving party show infographic tag1, tag2, tag3. the problem is, not standard task, insert metadata frames (i know ffmpeg this, whole media file). next problem stream not media file, rather live camera, cannot preprocessed , saved. do have idea start, or idea how task accomplished without messing encoding pipeline?

c# - Add Object to existing Xelement -

i have object obj 2 properties p1, p2. , xelement like: <root><aa><bb>bb</bb></aa></root> i'd make xelement as: <root><aa><bb>bb</bb><cc><p1>val1</p1><p2>val2</p2></cc></aa></root> i make new xelement obj xelement x = new xelement("cc",new xelement("p1", obj.p1),new xelement("p2", obj.p2)); and insert in aa element. ther better way serializing obj , convert xelement? (because object can change in future) . help. here attempt use xmlserializer: xelement xelem = reqret.requestdefinition; xelem.descendants("aa").tolist().foreach(reqitem => { using (memorystream ms = new memorystream()) { using (textwriter tw = new streamwriter(ms)) { xmlserializer ser = new xmlserializer(typeof(obj)); ser.serialize(tw, objval); schelem =

Unable to understand "Popen" in python -

i python newbie , looking around understanding popen . have following python code snippet tries directory name , open them. but, not understanding parameters given in popen. directory = sys.argv[1] if directory == "": print "proper usage python mycode.py <directory_name>" p = subprocess.popen(["find", "./" + directory, "-name", "log*"], stdout=subprocess.pipe) output, err = p.communicate() foutput = output.split("\n")

css - User defined background color using PHP -

i'm trying figure out how change background color of table using php. know have value's wrong somewhere can't figure out where. think i'm in ballpark of getting right i'm missing where. appreciated. background color: <form action= "post3.php" method="post"> author * : <input type="text" name="author"><br/> email : <input type="text" name="email"><br/> title * : <input type="text" name="title"><br/> background color: <input type = 'radio' name ='bgcolor' value= 'blue' <?php print $blue_status; ?> >blue <input type = 'radio' name ='bgcolor' value= 'red' <?php print $red_status; ?> >red <p> tag: <input type="checkbox" name="tag[]" value="general interests&quo

ios - How to Implement native module in react-native? -

i following guide http://facebook.github.io/react-native/docs/nativemodulesios.html#content and website: http://colinramsay.co.uk/2015/03/27/react-native-simple-native-module.html but not matter add .h , .m files error: class classname not exported did forget use rtc_export_module()? even if same code examples react-native documentation, can guide me add .h , .m files , link them project? thanks. there has been change in native module api , seems docs haven't been updated accordingly. example in article, somestring.m should this: // somestring.m #import "somestring.h" @implementation somestring rct_export_module(); rct_export_method(get:(rctresponsesenderblock)callback) { // change depending on want retrieve: nsstring* somestring = @"something"; callback(@[somestring]); } @end this ends desired result , can call js in same way before. looks happened: https://github.com/facebook/react-native/commit/0686b0147c8c8084e4a226b7ea0

java - Build once and deploy for many environments -

Image
we have legacy system 50 -60 maven modules, of these modeules have used maven resource plugin filter properties (replace tokens @ build time in property files). painful when comes build different environments, because have build application each time when need deploy different environments. we have new requirement build application once , deploy many environments. best solution this? think of externalizing filter properties, biggest issue replace token of existing property files of application (see application.properties) file below. want keep existing property files , pick values external config file. any appreciate it. e.g filter.properties injected maven. generic.sharepoint.host=xxxxx generic.deploy.apps.host=xxxxx generic.deploy.apps.url=xxxx generic.deploy.trusted.host=xxxx generic.deploy.trusted.url=xxxx generic.deploy.orderentry=xxxxx application.properties generic.sharepoint.host=${generic.sharepoint.host} generic.deploy.apps.host=${generic.deploy.apps.host} ge

php - Sending email with one or more recipient in codeigniter -

i have field in table contains email of users. field looked : | no_request | addresed_to | +--------------------------------------------------------------------------+ | 001 | email1@domain.com, email2@domain.com, email3@domain.com | i use mvc concept using codeigniter php. create model : public function sendemail($no_request){ $this->db->select('approved_to'); $this->db->where('no_request', $no_request); $query = $this->db->get('tbl_requestfix'); return $query->row(); } and controller : public function sendrequestkeatasan($name, $email_user, $addressed_to, $complaint) { $config = array( 'protocol' => 'smtp', 'smtp_host' => 'smtp.xxx.xxx, 'smtp_port' => 25, 'smtp_user' => $email_, 'mailtype' => 'html', 'charset' => &

android - How do I get album id's from the Facebook graph api? -

i sending request following url: https://graph.facebook.com/v2.3/me/albums ? the response getting "data": [ { "id": "x", "from": { "id": "x", "name": "robert s" }, "name": "profile pictures", "link": "link", "cover_photo": "x", "privacy": "everyone", "count": 11, "type": "profile", "created_time": "2010-09-04t07:02:31+0000", "updated_time": "2015-04-08t23:49:48+0000", "can_upload": false }, { "id": "x", "from": { "id": "x", "name": "robert s" }, "name": "cover photos", "link": "link", "cover_photo": "x", "privacy": "everyone", "count": 1, "type": "cover", "cre

Error using Java OpenCV library with size -

i newly working opencv in java on eclipse , working on eye tracking software, using base code 1 else has created , plan tweek having error few lines of code , can not figure out why. here entire class package have; import java.awt.*; import java.awt.image.bufferedimage; import java.io.bytearrayinputstream; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.*; import org.opencv.core.core; import org.opencv.core.mat; import org.opencv.core.matofbyte; import org.opencv.core.matofrect; import org.opencv.core.point; import org.opencv.core.rect; import org.opencv.core.scalar; import org.opencv.core.size; import org.opencv.highgui.highgui; import org.opencv.highgui.videocapture; import org.opencv.imgproc.imgproc; import org.opencv.objdetect.cascadeclassifier; class facepanel extends jpanel{ private static final long serialversionuid = 1l; private bufferedimage image; // create constructor method

.net - Determine remote device endpoint UDP Clojure CLR -

trying perform equivalent c# code in clojure clr using system.net; ipendpoint sender = new ipendpoint(ipaddress.any, 0); endpoint remote = (endpoint) sender; recv = sock.receivefrom(data, ref remote); what i've tried in clojure not work: (let [ sender (ipendpoint. (ipaddress/any) 0) ^endpoint remote ^endpoint sender recv (.receivefrom sock data (by-ref remote)) ] (println (.tostring remote)) ;; data... ) it shows 0.0.0.0:0 i'm thinking ref not working not sure of hint / cast syntax. i've looked @ here info on ref https://github.com/richhickey/clojure-clr/wiki/clr-interop , here specifying types: https://github.com/clojure/clojure-clr/wiki/specifying-types i translated msdn article cited in comments on question. (ns test.me (:import [system.net iphostentry dns ipendpoint endpoint ipaddress] [system.net.sockets socket sockettype protocoltype])) (set! *warn-on-reflection* true) (defn f [] (le