Posts

Showing posts from February, 2014

objective c - Recording avplayer playing live streaming byte data...in iOS -

i want save avplayer playing byte data save on document directory.(like recording) don't want record side voice song music. avaudiorecorder take speaker voice so, thats why want save player live streaming data. so, please give suggestion , source code apply in code.

html - IE8 outright ignoring CSS styling -

let's have css: .tbl-div > h1 { border-bottom: 1px solid black; display: block; font-size: 25px; margin: 10px -15px 30px -10px; padding: 0 0 0 40px; } .tbl-div > h1 > span { color: #006ec7; display: block; font-size: 14px; } so let's there's styling simple output div. dom such <div class="tbl-div"> <h1>*title*<br><span>*subtitle*</span></h1> *content goes here* </div> the idea header section there large text, below subtitle in smaller text , blue font. here's kicker. works everywhere iframe. once goes iframe, page utterly thinks css isn't there, , in case. appears giant string of text 25px in font. no other browser this. , it's these properties, , in iframe. what happening? i checked it, working fine me. make sure document structure proper. use iframe webpage this: <iframe src="file-containing-source.html"></iframe> ...

java - ZeroMQ: Disappearing messages -

we have java application acting server. client applications (written in c#) communicating using zeromq. (mostly) following lazy pirate pattern. the server has router socket, implemented follows (using jeromq): zcontext context = new zcontext(); socket socket = context.createsocket(zmq.router); socket.bind("tcp://*:5555"); the clients connect , send messages this: zcontext context = zcontext.create(); zsocket socket = zsocket.create(context, zsockettype.req); socket.identity = encoding.utf8.getbytes("some identity"); socket.connect("tcp://my_host:5555"); socket.send(new zframe("request data")); we have experienced lost messages when multiple clients sending messages @ same time. single client, there doesn't appear problem. are implementing right way multiple-client-single-server setup? update: example client , server exhibiting behaviour: server: import org.zeromq.zcontext; import org.zeromq.zmq; import org.zeromq.zmq.pol...

testing my Ruby gem: undefined method `configure' for Shoulda::Matchers:Module (NoMethodError) -

i'm working on first ruby gem , have bundled cucumber, rspec , shoulda-matches testing. when run rspec, following error: /app/my_gem/spec/spec_helper.rb:6:in `<top (required)>': undefined method `configure' shoulda::matchers:module (nomethoderror) here gemspec: # my_gem.gemspec ... gem::specification.new |spec| ... ... spec.add_development_dependency "activemodel" spec.add_development_dependency "bundler", "~> 1.8" spec.add_development_dependency "cucumber" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec" spec.add_development_dependency "shoulda-matchers" end my spec_helper.rb : require 'my_gem' require 'pry' require 'shoulda/matchers' shoulda::matchers.configure |config| config.integrate |with| with.test_framework :rspec # with.library :active_record with.library :active_m...

playframework 2.0 - Play Framework Json Transform recursivly -

since while fooling around following problem. i try recursivly transform through tree-like json structure. { "id": 21, "title": "title1", "children": [ { "id": 22, "title": "title1.1", "children": [ { "id": 33, "title": "title1.1.1", "children": [ { "id": 41, "title": "title1.1.1.1", "children": [ { "id": 42, "title": "title1.1.1.1.1", } ] } ] ...

openerp - trying to understand better the orm methods but i can store a value in a field -

i want store field's value 'por_sucursal' res_users class in field 'probando' pruebas value boolean , can store need filter in xml file. class pruebas(osv.model): _name = 'pruebas' _description = 'sucursales de la empresa' def dame_usuario2(self, cr, uid, ids, field_names=none, arg=false, context=none): if context none: context = {} var_pool = self.pool.get('res_users') if var_pool: ids = var_pool.search(cr, uid, [('id','=',uid)]) if ids: return ids[0].por_sucursal _columns = { 'name': fields.char('prueba', size=50, help="probando"), 'probando': fields.function(dame_usuario2, type='boolean', store=true, readonly = true), } pruebas() try following, class pruebas(osv.model): _name = 'pruebas' _description = ...

Read one value from website html > java jsoup -

i'm looking way best flying ticket price website parsing in java, @ start particular site : http://www.kayak.com/flights for example i'm looking flight gdaÅ„sk > barcelona random data: http://www.kayak.com/flights/gdn-bcn/2015-04-20/2015-04-27 things i've done: found div's i'd parsing @ browser in programmers mode: div class="sliderfilterlabel"> span id="low_price"> class="min">73 € on spot there should lowest price. tried parse using jsoup , i've found out code misses valuable me divs. how find or there more efficient way 1 number whole website. my code: document doc; try { // need http protocol doc = jsoup.connect("https://www.kayak.pl/flights/gdn,nearby-ibz,nearby/2015-04-20/2015-04-27").useragent("mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/41.0.2228.0 safari/537.36").get(); system.out.println(doc); there no code. after few tries js...

javascript - Refresh div without reload the page with jquery -

i have page in php , need refresh div of page <body> .... page code here .... ?><div id="chattext"> <div id="list"><ul><?php echo "ttt ".time(); ... code php ... </body> in head tag hage code <script> $(document).ready(function() { $.ajaxsetup( { cache: false, beforesend: function() { $('#chattext').hide(); //$('#loading').show(); }, complete: function() { //$('#loading').hide(); $('#chattext').show(); }, success: function() { //$('#loading').hide(); $('#chattext').show(); } }); var url='index.php'; var refreshid = setinterval(function() { $('#chattext').load(url + '#list'); }, 3000); }); the problem che ...

Spring Security 4.0.0 WebSocket issue adding tag <intercept-message pattern="/topic/**" access="hasRole('COORDINATOR')" /> generated exception -

i trying configure spring security websockets , getting problem when add next line <security:intercept-message pattern="/topic/**" access="hasrole('coordinator')" /> security-config.xml. exception org.springframework.beans.factory.beancreationexception: error creating bean name'org.springframework.security.messaging.access.expression.expressionbasedmessagesecuritymetadatasourcefactory#0' i appreciate guys can give me. i attach information below pom-xml <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.prueba</groupid> <artifactid>prueba</artifactid> <name>prueba</name...

postgresql - Postgres: \copy syntax error in .sql file -

i'm trying write script copies data crosstab query .csv file in postgres 8.4. able run command in psql command line when put command in file , run using -f option, syntax error. here's example of i'm looking @ (from this great answer): create temp table t ( section text ,status text ,ct integer ); insert t values ('a', 'active', 1), ('a', 'inactive', 2) ,('b', 'active', 4), ('b', 'inactive', 5) , ('c', 'inactive', 7); \copy ( select * crosstab( 'select section, status, ct t order 1,2' ,$$values ('active'::text), ('inactive')$$) ct ("section" text, "active" int, "inactive" int) ) 'test.csv' header csv i run , following syntax error: $ psql [system specific] -f copy_test.sql create table insert 0 5 psql:copy_test.sql:12: \copy: parse error @ end of li...

c# - How to save save high frame rate camera images with live preview -

i have 2 high speed usb3 cameras (ximea) , want code application image recording. framerates 500fps @ vga resolution want use 2mpx resolution @ 170fps. .net sdk tells me should "get" images in loop. problem have no idea how images , save them while still showing live preview. everytime add code update picturebox frame rate drops drastically. at moment utilize recording function called task.run(() => record()); and inside record() have loop getting bitmaps while(record == true) { camera.getimage(out myimage, timeout); //from ximea .net sdk info = camera.getlastimageparams(); timestamp = info.gettimestamp(); threadpool.queueuserworkitem(state => saveimage(myimage, filepath, timestamp)); } with saveimage being private void saveimage(bitmap myimage, string filepath, double timestamp) { try { lock(myimage) { myimage.save(filepath + timestamp.tostring("0.00000") + ".tif"); } ...

javascript - Where is the Configure function for the Express module in EasyRTC -

i'm new nodejs , maybe i'm putting cart before horse here, attempting run demo of easyrtc using nodejs. the easyrtc download page has "easy install instructions" list of actions perform run easyrtc out of box. i encountered problem second last step - run server.js - upon attempting run receive error claiming httpapp.configure() function not exist ( typeerror: undefined not function ). now, httpapp defined require("express"); , went on every file within /node_modules/express/lib and, error suggests, there no configure function defined anywhere... so, me being complete n00b , not knowing i'm doing? followed of steps in example - , aren't obtuse instructions. download , install node.js download easyrtc , place anywhere want get easyrtc dependencies using npm run easyrtc's server.js (i skipped on "create folder" , "navigate folder" steps here because... c'mon) am supposed manually create configure ...

Access VBA refer to a textbox on Active Form -

i know how refer item on form choosing form, i.e. forms!frmmyform![control].value . have code that finds form open, , executes code variable, , it's not working. think need refer control using activeform, rather explicit form name, things i've tried accomplish haven't worked. here's code. private sub orderbutton_click() ' docmd.setwarnings false ' currecord = forms!frm_ec_all![l#].value getid = forms!frm_mainmenu!associdbox ' me.lbox.value = currecord ' if currentproject.allforms("frm_ec_all").isloaded = true rightform = "frm_ec_all" elseif currentproject.allforms("frm_ec_ec#").isloaded = true rightform = "frm_ec_ec#" elseif currentproject.allforms("frm_ec_holds").isloaded = true rightform = "frm_ec_holds" elseif currentproject.allforms("frm_ec_l1").isloaded = true rightform = "frm_ec_l1" elseif currentproject.allforms("frm_ec_l1_l2").isloa...

cuda - what does the last parameter mean for cudaHostGetDevicePointer -

most explanations of last parameter is"flags extensions (must 0 now)".link here: http://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/html/group__cudart__memory_ga475419a9b21a66036029d5001ea908c.html#ga475419a9b21a66036029d5001ea908c so mean? me providing code explanations? the current documentation cudahostgetdevicepointer here . from documentation: flags provides future releases. now, must set 0. that means placeholder. in future cuda release (beyond cuda 7.0), there may use value. doesn't cause behavioral change, still required specify zero. specifying 0 should enable compatibility (no behavioral change) in future cuda release, if non-zero values result in difference in behavior. regarding use of the cudahostgetdevicepointer function: it used zero-copy mapped memory, accessible both host , device. access device, need device pointer, may different host pointer in non- uva environment. function provides device pointer asso...

ios - NSURLConnection (initWithRequest vs sendAsyncRequest) -

if both initwithrequest , sendasyncrequest asynchronous ways of connections whats major difference ? other completion handler , queue concept in sendasyncreq else ? 1 more advantageous ?? the sendasynchronousrequest simpler , easier use, saving implementing nsurlconnectiondatadelegate , nsurlconnectiondelegate methods. if need richness of delegate approach (e.g. challenge-based authentication, need cancelable requests, etc.), sendasynchronousrequest not job. if targeting ios 7 , later, consider nsurlsession , instead, too. can enjoy simplicity of block-based networking , still enjoy delegate methods if , when needed. requests cancelable. opens new opportunities (e.g. background sessions continue operating if app no longer active).

Change AcroFields order in existing PDF with iText? -

Image
i have pdf text form fields @ layered 1 on top of other. when fill fields via itext , flatten form, form field had created on top of other form field on bottom. for instance, have text field named "number_field" , underneath second text field titled "name_field". when set value fields via itext (so 10 number_field , 'john' name_field), number_field on top of name_field. how change order on page of these fields itext? possible? link example pdf: https://freecompany.sharefile.com/d-s84f6d63e7d04fe79 i have made following ticket in issue tracker @ itext group: a problem caused fact itext reads field items hashmap , hence there no way predict in order flattened. isn't problem. don't think problem occurs in case don't flatten pdf, because in case, appearance stored in widget annotations , it's pdf viewer decide field covers 1 in case of overlapping fields. however, if form fields overlap, can't predict...

sharepoint - Sub-sites can't access to style library -

i have got site , multiple sub-sites under it. problem i'm having js files located in style library of master site, , users don't have access master site getting access denied errors. i'm guessing might related sub-sites don't have direct access style library of master, i'm not sure. (i'm not sure whether makes sense or not, i'm newbie.) does have solution this? thanks in advance. if users don't have access style library in parent or root site, you're going need give them access. can set library unique permissions , give read access. have several site collections set way, resources stored in single style library , given open access allow users in subsites access.

java - Threeway Duel to the Death -

working on project intro java class, heres gist of needs -- in land of puzzlevania, aaron, bob, , charlie had anargument on 1 of them greatest puzzler of time. endthe argumentonce , all, agreed on duel death. aaronis poor shooter , hits target probability of 1/3. bob isa bit better , hits target probability of 1/2. charlie expertmarksman , never misses. hit means kill , person hit drops outof duel. compensate inequities in marksmanship skills, itis decided contestants fire in turns starting aaron,followed bob, , charlie. cycle repeat until there oneman standing. , man remembered greatest puzzlerof time. a. write function simulate single shot. should usethe following declaration: voidshoot(bool& targetalive, double accuracy, int&num_alive); simulate shooting @ targetalive thegiven accuracy generating random number between 0 , 1. if therandom number less accuracy, target hit andtargetalive should set false. appendix 4 illustrates how...

android - Smaller Custom RatingBar: Material Design -

i building app uses non-clickable (indicator) ratingbar. now, when ratingbar clickable, has 2 different modes. when clicked icons turn red (red accentcolor in styles). when not clicked, stars ugly gray black outline. when rating bar set unclickable (indicator), stars permanently black-and-gray. additionally, make stars smaller. can both of above things without defining custom drawables? if must define custom drawables, how can access preexisting "clicked star" drawable, not need create own? thanks <ratingbar style="@style/ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numstars="5" android:rating="3.5" android:stepsize="0.5" /> and add in styles xml file <style name="ratingbar" parent="android...

Why does Powershell -match any string with $null -

found while debugging powershell script. ps c:\temp> "hello" -match $null true but > "hello" -eq $null returns false why, when using -match , string match $null ? i believe because $null gets coerced empty string -match expects string pattern on rhs (right hand side). , empty string match anything.

node.js - node-gyp Error cannot find module '/node_modules/node-gyp/bin/node-gyp.js' -

why looking node-gyp.js in absolute path, when node-gyp installed in /usr/bin/node-gyp? if find /usr -name node-gyp.js the result is /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js /usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js as can seen, have node-gyp.js in 2 places. how can direct node-gyp search these places? it node-gyp installation trouble. using old version of npm; after upgrading npm, node-gyp installed , runs ok.

find - Search a string for a wildcard year C++ -

i'm looping through text file, reading each paragraph string. want process paragraphs contain year, if no year found want continue looping through file. when year found, want know index year found. i'm trying avoid boost or regex code simplicity. assume years of interest in 1900s , 2000s, simplicity. tried following code, wildcard characters not working reason. is because wildcard characters not work numbers? string sparagraph = "aramal et al. (2011), title"; int iindex; if (sparagraph.find("19??")!=string::npos) iindex = sparagraph.find("19??"); else if (sparagraph.find("20??")!=string::npos) iindex = sparagraph.find("20??"); else continue; without using regex or boost code might making code more readable, not more simple. a "simple" one-pass pseudo algorithm: map<int, std::vector<int>> years; string par = " ... " //inefficient didn't want have add more com...

presenceOfElementLocated in selenium unable to locate presence of Webelemnt -

webdriver driver =new firefoxdriver(); driver.get("http://www.goibibo.com/"); webdriverwait driverwait=new webdriverwait(driver,60); webelement mydynamicelement=driverwait.until(expectedconditions.presenceofelementlocated(by.xpath("//*[@id='hdr_user_signin']/span/a[2]"))); boolean number=mydynamicelement.isdisplayed(); system.out.println(number); answer got 'false' though put wait of 60 sec. don't know why unable locate presence of element.... mydynamicelement has been located successfully, hidden. not asking selenium find if element displayed presenceofelementlocated . meaning presenceofelementlocated , visibilityofelementlocated not same. believe looking visibilityofelementlocated . see api doc here

csv - DATEPARSE in Tableau turning all months into January -

i have been connecting tableau csv data source. have 2 date columns. when tell tableau date columns imports entirety of both columns nulls. tried import them strings , create calculated date column out of each dateparse. i ran ([close time] string csv) dateparse("mm/dd/yyyy hh:mm:ss",[close time]) and named column "close_time_dt" the result was: close time '05/30/2013 11:20:50' '05/30/2013 18:01:53' '06/05/2013 02:02:49' close_time_dt '1/30/2013 11:20:50 am' '1/30/2013 6:01:53 pm' '1/5/2013 2:02:49 am' clearly wrong, tried dateparse("m/d/yyyy hh:mm:ss", [close time]) and got same result. in advance help i had similar problem. source csv format dates date/month/year (07/01/2015). when used dateparse function first entered dateparse("dd/mm/yyyy",[servdate]) but did not handle month , make july or in 1 case put dates in same month (...

amazon ec2 - Is there anyway to access values from the EC2 tags in cloud-init -

i know can access tags via metadata , cli tools, there anyway access them whilst running cloud-init? ideally i'd tag called hostname , use set machine host name. thanks this command can run userdata (or time, really) access instance id metadata, , use pull tag called "hostname". assign variable, or use output directly set hostname of instance. aws ec2 describe-instances --output text --query 'reservations[*].instances[*].tags[?key==`hostname`].value' --instance-id `curl -s http://169.254.169.254/latest/meta-data/instance-id`

javascript - Why would we declare a 2nd variable in the below code? -

why declare second variable ( val ) when can use parameter of function variable? here's how looks on codecademy: var dividebythree = function (number) { var val = number / 3; console.log(val); }; dividebythree(6); i've made changes below: var dividebythree = function (number) { number = number / 3; console.log(number); }; dividebythree(6); and works pretty fine!! in example, not need preserve original value of parameter. however, may find easier use variables in future more complicated functions. here example: // function uses parameter "rawnumber" variable, uses variable "number" function testthis(rawnumber, p) { // convert input (string) integer // parseint returns nan or integer. truncates decimals var number = parseint(rawnumber); // check see if result nan or integer if (isnan(number)) { log(rawnumber + " not number.", p); // log imitation of console.log() } // ...

excel vba - VBA VBProjects Run Commands -

i trying use late binding in below code kick of stored public function exists in bound excel file can't seem remember or figure out object type should using. got rush , ended using below open , call code other spreadsheet. background have userform allows people schedule programs run @ night on different time intervals. worry below end being buggy @ point. any suggestions on object or how improve section of code within else statement? sub runexcel() dim oxlapp object dim lpath string dim wrtpswd string dim vbproj vbide.vbproject 'lpath = "c:\\support\manalyze.xlsm" lpath = sheets("nightly determinations").cells(fl, 3) wrtpswd = sheets("nightly determinations").cells(fl, 6) pflop = sheets("nightly determinations").cells(fl, 7) if pflop = "" set oxlapp = createobject("excel.application") oxlapp.visible = false set wb = oxlapp.workbooks.open(filename:=lpath, readonly:=false, writerespassw...

html - how to add a line break in javascript that works with paragraph -

i wrote function format string : var desc = document.getelementbyid('desc'); var parcontent = desc.textcontent.trim(); var temppar = ""; var j = 0; var k = 0; var built_val = ""; (var = 0; < parcontent.length ; i++) { if (j == 19 || == parcontent.length-1) { temppar = parcontent.substring(k, i); temppar = temppar.concat("- \n"); built_val = built_val.concat(temppar); temppar = ""; //restart j j = 0; //update k k = i; continue; } j++; } desc.textcontent = built_val; desc dynamic paragraph empty @ first filled (its data composed after page loads), j number of characters desired in 1...

c# - ActiveX component can't create object? .NET COM -

i trying reference .net com library in visual basic 6 application. have registered it, using regasm , have set comvisible true within class. when try run application following error: activex component can't create object. my library consists of simple function (since wanted test if run it), returns string "hello world". i had use different machine (machine 1) create c# .net class , copy class onto machine (machine 2) , there register dll , reference in project. tested project on separate machine (machine 3) received error. i need this, have tried un-register , re-register , still no avail. try this. from elevated command prompt: regasm /codebase /tlb assemblyname.dll . take note of .tlb file generated. regtlib file.tlb open vb6 project , reference .tlb file.

Confusion about Linux/Redhat source rpm -

i have following 2 packages installed on redhat enterprise 7.0 instance bind-license-9.9.4-14.el7_0.1.noarch bind-libs-lite-9.9.4-14.el7_0.1.x86_64 the "repoquery -i" command tells me source rpm of these packages bind. repoquery -i bind-license-9.9.4-14.el7_0.1.noarch name : bind-license version : 9.9.4 release : 14.el7_0.1 architecture: noarch size : 26019 packager : red hat, inc. <http://bugzilla.redhat.com/bugzilla> group : applications/system url : http://www.isc.org/products/bind/ repository : rhel-7-server-rpms summary : license of bind dns suite source : **bind-9.9.4-14.el7_0.1.src.rpm** description : contains license of bind dns suite. similarly if use yum downloader download source rpms of above 2 packages bind source rpm ( bind-9.9.4-14.el7_0.1.src.rpm ) downloaded. however if try update bind here get yum update bind loaded plugins: product-id, subscription-manager package(s) bind available, not...

asp.net mvc - Generate report from session -

i use rdlc generate report dataset normally, time want gerenrate report data before saving database. can generate rdlc report data before updating in data base? there way session (instead of dataset) rdlc report you can use dataset / datatable created , populated @ runtime data collected wizard , use reportdatasource report. please note if wizard collects very small number of data can pass them reportparameter , don't recommend solution.

php - Symfony's annotations ignored by firewall -

i have accountcontroller.php file in symfony 2.6.6 works annotations : <?php use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\method; use sensio\bundle\frameworkextrabundle\configuration\security; /** * @route("/login", name="account_login") * @method({"get", "post"}) */ public function loginaction(request $request) {} /** * @route("/login_check", name="account_login_check") * @method({"post"}) */ public function logincheckaction() {} /** * @route("/logout", name="account_logout") * @method({"get"}) */ public function logoutaction() {} /** * @route("/register", name="account_register") * @method({"get", "post"}) */ public function registeraction(request $request) {} my access_control in firewall: access_control: - { path: ^/account/login, roles: is_au...

javascript - Jquery conflict in Magento broke my add to cart button -

i'm having issues add cart button in magento product description page only. grid page still works perfectly. have several jquery files added xml vendor dependencies. when remove jquery.js button works fine slider , lightbox break. clue on how fix this? i've read several posts on no conflict not clear explanation. <action method="addjs"><script>prototype/prototype.js</script></action> <action method="addjs"><script>jquery-1.11.2.min.js</script></action> <action method="addjs"><script>lib/jquery/noconflict.js</script></action> <action method="addjs"><script>bootstrap.min.js</script></action> <action method="addjs"><script>jasny-bootstrap.min.js</script></action> <action method="addjs"><script>lib/ccard.js</script>...

html - From a CSS perspective, what state is an input button in when you click, hold down for a second and then drag away? -

Image
above have button in 3 states, normal, hover, , third state called? need put css style this? the button seems in state after right click too. really simple probably, know, can't figure out. the state looking focus state there 4 states in gif presented normal (light pink) hover (darker pink, mouse hovering) active (when still holding on, dragging away) focus (not pink anymore still focused blue rectangle) cannot replicate gif exactly, here jsfiddle demonstrating these 4 states.

c++ object instantiated/passed to method as reference or pointer or valueA -

i#ve looked @ couple of posts here on still dont quite it. here's little bit of code (note: wasnt trying implement linked list): #include <iostream> class node { int data; public: node(void); node(int data); void setdata(int data); int getdata(void); }; class list { node thenode; node* thenode2 = null; public: list(node& param, node* param2); void addnode(node& param); void addnode2(node* param); node* getnode(void); node& getnode2(void); }; node::node(void) { this->setdata(20); }; node::node(int data) { this->setdata(data); }; void node::setdata(int data) { this->data = data; }; int node::getdata(void) { return data; }; node* list::getnode(void) { return thenode2; }; node& list::getnode2(void) { return thenode; }; list::list(node& param, node* param2) { thenode = param; if (param2 != null) { thenode2 = param2; } std::cout...

PHP Encryption Method Comparison -

i asked create method encryption / decryption of url string. produced 1 liner , shot out. i provided code developer , asked opinion. looked @ find more complex function. my questions: what specific differences here? are there shortfalls found in short solution? we encrypting json encoded array , passing via query string url. long solution: public function encrypt($message, $key = 'defaultkey') { //create instance of mcrypt resource $td = mcrypt_module_open('tripledes', '', 'ecb', ''); //create random intialization vector , initialize $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), mcrypt_rand); mcrypt_generic_init($td, $key, $iv); // create timestamp , add it. $t = new \datetime('now'); $message = $t->format("ymdhis") . $message; // pkcs7 padding //get block size of cipher $b = mcrypt_get_block_size('tripledes', 'ecb'); //wha...

angularjs - How do I test if a promise was resolved or rejected using Jasmine? -

i have function calls api service. want mimic case network call failed , rejects promise. the method (in coffeescript): find: (collection, query) deferred = $q.defer $http.post config.server + "/api/v1/find/#{collection}", {} .success (result, status, headers, config) -> deferred.resolve result .error (result, status, headers, config) -> deferred.reject result deferred.promise i understand how setup successful condition: it "should make request correct url", () -> $httpbackend.expectpost(server+"/api/v1/find/foo").respond(200) entitysvc.find "foo", {} $httpbackend.flush 1) should testing failure of network call or should tested service designer, if so, how check if promise rejected? 2) expectpost assertion testing proper url being built , called input, in previous question, don't know deferred being resolved. how can accomplish this?

Store a C# Object into an AutoCAD entity's XRecord -

i'm trying find way can store c# class autocad entity xrecord. example, have following class: public class exampleclass { private int x; private int y; public exampleclass(int x, int y) { this.x = x; this.y = y; } #region getters , setters } and create instance of it: exampleclass objtostoreinxrecord = new exampleclass(3, 5); what best way store autocad entity's (for example line in drawing) xrecord this: exampleclass objrecoveredfromxrecord = getxrecordfromentity(entity e) where getxrecordfromentity(entity e) helper method can write takes entity e, gets xrecord of object stored earlier, , returns it. i don't have handle on how xrecord works , how xrecord relates autocad's named object dictionary (nod). i've seen implementations object stored in xrecord serialized binary formatter , serialized data stored in entity's xrecord i'm looking better way. serialize object , add xrecord. works ...