Posts

Showing posts from September, 2012

ios - NSCFData gunzippedData crash -

i integrating payu in swift 2 based project using sample code source link: https://github.com/payu-intrepos/ios-sdk/releases/tag/v3.3 the app crashes following log in console, when payu webview code class payuuipaymentuiwebviewcontroller executed: webviewdidstartload url-----> 2016-01-07 19:07:59.788 mytestapp[14764:2080307] -[__nscfdata gunzippeddata]: unrecognized selector sent instance 0x7f80395de440 2016-01-07 19:07:59.809 mytestapp[14764:2080307] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfdata gunzippeddata]: unrecognized selector sent instance 0x7f80395de440' it unhandled exception. know means? cause of it? in xcode project add "-objc" in other linker flags in project build settings.

How can I extend ActiveRecord::Associations to a frozen_record in rails -

i'm using frozen record gem in rails upload yaml file containing fixed questions app. once they're uploaded want use salequalifier model grab each question, associate answer, , use state machine move through question tree. i've got frozen record gem working , yaml file uploads fine. when tried associating model new model (salequalifier) got 'method_missing': undefined method 'belongs_to' question:class (nomethoderror) as result added include activerecord::associations components in order let me associate new record salequalifier question belongs_to :sale_qualifier - throws: 'method_missing': undefined method 'dangerous_attribute_method?' question:class (nomethoderror) according search, error thrown when i've declared method beforehand. don't know defined, frozen_record gem files can see set frozenrecord following: module frozenrecord class base extend activemodel::naming include activemodel::conversion include a...

c# - SignalR Memory Leak -

Image
we have asp.net webapi signalr hub running on 2 servers redis backplane. typically our api consumes 3gb - 4gb of memory happens, there hugh memory spike 20gb. dont know reason yet, assume, can happen when there connection issues redis (it rare). i analyzed dump file , found following hints: to honest, dont understand it. seems has exception handling, dont understand why byte arrays big. i looking ideas how solve , have hope, had same issue.

Checking off pdf checkbox with itextsharp -

Image
i've tried many different ways, can't check box checked! here's i've tried: var reader = new itextsharp.text.pdf.pdfreader(originalformlocation); using (var stamper = new itextsharp.text.pdf.pdfstamper(reader,ms)) { var formfields = stamper.acrofields; formfields.setfield("isno", "1"); formfields.setfield("isno", "true"); formfields.setfield("isno", "on"); } none of them work. ideas? you shouldn't "guess" possible values. need use value stored in pdf. try checkboxvalues example find these possible values: public string getcheckboxvalue(string src, string name) throws ioexception { pdfreader reader = new pdfreader(src); acrofields fields = reader.getacrofields(); // cp_1 name of check box field string[] values = fields.getappearancestates("isno"); stringbuffer sb = new stringbuffer(); (string value : values) { sb.append(v...

cordova - Error when deploy a windows 7 app into emulator -

i developed app jquery mobile , compiled phonegap build. when try install windows 7 emulator got error like error- installation of application failed. run time error has occurred. fix capabilities in wmappmanifest.xml file. here wmappmanifest.xml <?xml version="1.0" encoding="utf-8"?> <deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" appplatformversion="7.1"> <app xmlns="" productid="{80a42ce2-0c9f-39d1-a273-bb2e5bdbe855}" title="pg build app" runtimetype="silverlight" version="0.0.1.0" genre="apps.normal" author="xxxxxx@gmail.com" description="" publisher="xxxxxx@gmail.com"> <iconpath isrelative="true" isresource="false">applicationicon.png</iconpath> <capabilities> <capability name="id_cap_contacts" /...

java - Codename one: Why am I getting "/ by zero" when trying to scale an image -

i trying scale image fit screen width. therefore trying load imported multi image in beforeterminalgui method here: @override protected void beforeterminalgui(form f) { imageviewer iv = findimageviewer(f); image = fetchresourcefile().getimage("stillstand.png"); i.scaledwidth(iv.getwidth()); iv.setimage(i); } which created when clicked beforeshow event in gui builder. (i saved gui builder after doing so) but getting error: java.lang.arithmeticexception: / 0 @ com.codename1.impl.javase.javaseport.scalearray(javaseport.java:3505) @ com.codename1.impl.javase.javaseport.scale(javaseport.java:3497) @ com.codename1.ui.image.scale(image.java:961) @ com.codename1.ui.image.scaledimpl(image.java:931) @ com.codename1.ui.image.scaled(image.java:896) @ com.codename1.ui.image.scaledwidth(image.java:835) @ com.codename1.ui.encodedimage.scaledwidth(encodedimage.java:536) @ userclasses.statemachine.beforeterminalgui(statemachine...

How to find a value in a sorted vector (C++) -

i have searched solution problem, did not find answer. following code learning purposes. want erase elements value 3 in vector: std::vector<int> v{1,1,2,2,2,3,3,4,4}; i tried solve this: //only excerpt code iterator erase(t const& elem) { return v.erase(std::remove(v.begin(), v.end(), elem), v.end()); } but in test case, expect have iterator point value 4, in code points value 3. removes first 3 vector. how can remove both values "3", iterator returned points 4? thank help! although std::remove work, doesn't take advantage of fact container sorted. that, need find range contains of target values. this: #include <algorithm> #include <vector> void remove(std::vector<int>& vec, int value) { auto lb = std::lower_bound(vec.begin(), vec.end(), value); auto ub = std::upper_bound(vec.begin(), vec.end(), value); vec.erase(lb, ub); }

java - ExecutorService awaitTermination shutdown signal in the Runnable instance -

i've few questions around executorservice , shutdown process. use case: use executorservice spawn fixed number of threads run method this: while (true) { try { this.currentthreadrunning = true; processmessage(); } catch (throwable e) { // keeping thread alive despite exceptions. } } these threads run infinitely, polling messages. what trying do? polling sqs queue messages , processing them. obviously, in case, executorservice's shutdown method not work. when shutdownnow() called, threads shutdown unceremoniously. hate it! is there way invoke awaittermination , verify, in runnable instance(in block?), if shutdown has been initiated , trigger same current thread? update: i've refactored code perform polling , spawning threads process them. thus, runnable instance's run method need not endless loop. , awaitermination lead definite closure of threads. , sure, i've triggered shutdownnow after awaittermination . ...

actionscript 3 - as3 - how to define instance child from base class? -

i have movieclip parent has movieclip instances inside. movieclip parent extends baseclass, , define 1 of children using instance name , defining base class. for example, if there child instance name of "player" inside of movieclip parent. from movieclip parent class define as player //or this.player but base class, method not work. how define base class? you can define player in base class, have disable "automatically declare stage instances" in as3 settings. when have option checked compiler blindly tries add named instances properties of linked class. if turn off, can control properties defined. reason turn feature off. example: class base extends movieclip { public var player:movieclip; } class symbolclass extends base { // linked symbol contains 'player' instance } if have "automatically declare stage instances" checked, can't because symbolclass try automatically declare player , conflict base playe...

How to add polylines to this particular Google Maps? -

can me need add , can make polylines between markers journey on site. in advance. try figure out myself , didn't sucseed. if can tell me nice. <!doctype> <html> <head> <title></title> <style type="text/css"> body { font-family: arial; font-size: 10pt; } </style> </head> <body> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var markers = [ { "title": 'nusay hotel, ashgabat', "lat": '37.9293938', "lng": '58.3841203', "description": 'day 01 - day 03 arrive ashgabat cordially welcomed upon arrival @ ashgabat airport , transferred our hotel. balance of day free @ leisure. ex soviet state, turkmenistan 1 part...

javascript - Simple onclick in a row using jquery -

i cant figure out doing wrong in code below: <table width='100%'> <script>$("#101m").on("click", function() {alert($( ).text());});</script> <tr id='101m'><td class='dayavailible'>a</td></tr> <script>$("#101a").on("click", function() {alert($( ).text());});</script> <tr id='101a'><td class='dayavailible'>a</td></tr> <script>$("#101e").on("click", function() {alert($( ).text());});</script> <tr id='101e'><td class='dayavailible'>a</td></tr> </table> any appreciated. your onclick event couldn't bind rows @ time when script occurs there no element present in html, either move javascript code after html or use $(function(){ ... }); dom ready. though suggest use modular code don't have write same code again , again. <sc...

ios - Why dulplicate symbol errors do not occur when linking both libsqlite3.dylib and libsqlcipher.a? -

i'm integrating sqlcipher ios project according tutorial: https://www.zetetic.net/sqlcipher/ios-tutorial/ there hot tip says:if libsqlite3.dylib or sqlite framework listed in link binary libraries list sure remove it, or you'll see duplicate symbol errors. tried add both libsqlite3.tbd(no dylib in xcode 7) , libsqlcipher.a link binary libraries , dulplicate symbol error not occur! why? , notice if click #import <sqlite3.h> line, xcode show sqlite3.h file in xcode's lib folder, not 1 in sqlcipher. however, sqlcipher work, database encrypted. libsqlite3.tbd text file defines platform architectures supported library, target platforms, dylib installation path , exported symbols. using .tbd file, decrease bundled application size library binary included on platform device not need linked application image. libsqlite3.tbd looks this: --- archs: [ armv7, armv7s, arm64 ] platform: ios install-name: /usr/lib/libsqlite3.dylib current...

android - How to make an animation with just telling the destination coordinats? -

i have textview rotate. rotation causes text view little bit translated. because of @ same time want 2 transitions in x , y direction. i know view should don´t know , when 1 wants translation can tell how far want transpose not to. mytextview.settranslationx(60); that function know , every other way have give how far not to. i want translate view left corner of device. ** know first thing comes mind distance between edge of screen , edge of view doesn´t work because rotation hasn´t finished , can´t wait because want smoothly animated.

c++ - Can not find the "fiostream.h" file -

i'm learning c++ now. here question: #include <fiostream.h> no matter used: #include <fiostream> #include "fiostream" #include "fiostream.h" i can not find "fiostream.h" file anywhere. where can find "fiostream.h" file? does "iostream.h" include "fiostream.h"'s functions? what's difference between "fiostream.h" , "iostream.h"? thank you~~ what's difference between "fiostream.h" , "iostream.h"? the difference “f”. neither header exists. iostream does, fiostream doesn’t (but fstream does).

Scala read first element of line separately -

i have following input on line: number of elements in array elements of array for instance 3 1 2 3 or 5 10 20 30 40 50 where 3 , 5 number of elements. i read in scala(first number of elements, elements). i tried doing this: val n = readint val = readline.split(" ").map(_.toint) however, doesn't read n correctly. so what's best way of reading this? you use combination of split(" ") , splitat(1) create tuple containing first element , rest: scala> val s = "3 1 2 3" s: string = 3 1 2 3 scala> val (array(nb), rest) = s.split(" ").map(_.toint).splitat(1) nb: int = 3 rest: array[int] = array(1, 2, 3) (obviously replace s readline in case).

jquery - WooCommerce - admin-ajax.php still needs a lot of time - how to dequeue -

Image
i have performance issue website currently. can see following chart: i added following code functions.php in order enqueue woocommerce styles , scripts on shop pages: function grd_woocommerce_script_cleaner() { // remove generator tag remove_action( 'wp_head', array( $globals['woocommerce'], 'generator' ) ); // unless we're in store, remove cruft! if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { wp_dequeue_style( 'woocommerce_frontend_styles' ); wp_dequeue_style( 'woocommerce-general'); wp_dequeue_style( 'woocommerce-layout' ); wp_dequeue_style( 'woocommerce-smallscreen' ); wp_dequeue_style( 'woocommerce_fancybox_styles' ); wp_dequeue_style( 'woocommerce_chosen_styles' ); wp_dequeue_style( 'woocommerce_prettyphoto_css' ); wp_dequeue_style( 'select2' ); wp_dequeue_script...

web services - Wsdl webservice with matlab -

i'm trying use function "createclassfromwsdl" matlab , gives me error : createclassfromwsdl('http://localhost/soapserver/server.php?wsdl') retrieving document @ 'http://localhost/soapserver/server.php?wsdl' struct contents reference non-struct array object. error in createclassfromwsdl>parsewsdl (line 74) se = deftypes.getextensibilityelements().get(0); error in createclassfromwsdl (line 34) [r, schema] = parsewsdl(wsdlurl); i have download software called soapui works can't found wrong... here simple wsdl file : <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:tns="http://localhost/soapserver" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/xmlschema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetnamespace="http://localhost/soapserver...

ASP.NET WEBAPI Production Environment | "The system cannot find the file specified" -

local environment { iis 7.5 | windows 7 | asp.net 4.0 | integrated pipeline} production environment {iis 8.0 | windows 2012 server | asp.net 4.x | integrated pipeline} webapi functionality works in local environment e.g. http://<domain>/api/towncity?startswith=marston but on production, received following "obtuse" error message. {"message":"an error has occurred.","exceptionmessage":"the system cannot find file specified","exceptiontype":"system.componentmodel.win32exception","stacktrace":null} any way improve error information? or know solution? many thanks, dave. okay, after investigation, published release web.config, didn't update web.config entities connection string. it therefore using local settings entity connection string. <add name="yourdatabasenameentities" connectionstring=" metadata=res://*/model.yourdatabasename.csdl|r...

java - Having difficulties while passing location from GPS to web service -

i'm creating android application current position , pass web service. have no errors now, problem can't pass location web service. here's code, if know problem kindly point out me please passing part on phpconnect class. ** public class mapping extends mapactivity { private mapview mapview; private mapcontroller mapcontroller; private locationmanager locationmanager; private locationlistener locationlistener; // ** declarations passing of data web service // progress dialog private progressdialog pdialog; // jsonparser object creation jsonparser jsonparser = new jsonparser(); // url pass location web private static string url_create_product = "http://student-thesis.netii.net/location_adding.php"; //private static string url_create_product = "http://10.0.2.2/thecalling/location_adding.php"; // json node names private static final string tag_success = ...

OCaml - compiling a program as a library -

i have ocaml program(with main method - generates executable) , want use library. i compiling program this: ocamlc -i somedir -g -unsafe lotsofcmofiles -o outputfile , program works fine. now i'm removing line makes executable(something let _ = ... ) , adding -a parameter compile command: ocamlc -a -i somedir -g -unsafe lotsofcmofiles -o outputfile.cma but somehow can't load generated .cma file ocamltop , ocamlbrowser shows empty list. when try load ocamltop : # #load "outputfile.cma";; error: reference undefined global `xyz' and i'm 100% sure xyz.cmo included in lotsofcmofiles . am giving parameter wrong while compiling? or else, should load program in ocamltop ? (i'll use library in program, i'm giving ocamltop outputs example) any helps appreciated. edit: can managed compile , load @cago, can load library, , when don't remove main let _ = ... line it's automatically run when load .cma . but still can't open mod...

python - Launch django unittest with a new database -

the question in title. how can run unit tests manage.py test command line without having type yes if old test database hasn't been destroyed(this happens when tests aborted). thanks try using --noinput option ( --no-input alternative alias in django 1.9+). ./manage.py test --noinput

visual studio - Installing asp.net MVC5 -

i having trouble installing asp.net mvc 5. here things did before approaching help. attempt 1: tried use link opened webinstaller says "microsoft web platform installer couldn't fine product tried install. either link clicked incorrect or may overriding feed different feed." https://www.microsoft.com/web/handlers/webpi.ashx/getinstaller/webnode11pack.appids attempt 2: microsoft asp.net , web frameworks 2013.1 - visual studio 2012 https://www.microsoft.com/web/handlers/webpi.ashx/getinstaller/webnode11pack.appids error: product supports english versions of visual studio 2012 , visual studio express 2012 web. products have: visual studio 2013 premium update 5 rc visual studio 2012 shell (integrated) i've got same problem, solve downloading direct link: http://download.microsoft.com/download/2/f/7/2f7fa65f-e8bb-42a2-99a2-7f355225d30c/aspnetwebtools2013_1setup.exe hope solve to. {}'s rodrigo reis

centos - Relocated path in a postinstall script -

i'm working on rpm package deploys files /opt , /etc. in of cases works perfectly, excepted given environment, writing /etc not allowed .... so used relocations in order deploy /etc files in other location : relocations : /opt /etc by specifying --relocate option can deploy /etc files location : rpm -ivh --relocate /etc=/my/path/to/etc mypackage.rpm now issue in postinstall script, there hard coded references /etc don't replaced when package deployed : echo `hostname --fqdn` > /etc/myapp/host.conf i hope there way (macro, keyword, ... ) use instead of hard coded paths in order perform substitutions during rpm execution. if have information on i'd appreciate help. thanks per advance ps : please note not duplicate of asked (and answered) questions related root path re-locations we're dealing several relocation paths , fact need handle each of them separately during rpm scriptlets many panu matilainen rpm mailing list answered quest...

c++ - Initialize a variable -

is better declare , initialize variable or declare it? what's best , efficient way? for example, have code: #include <stdio.h> int main() { int number = 0; printf("enter number: "); scanf("%d", &number); if(number < 0) number= -number; printf("the modulo is: %d\n", number); return 0; } if don't initialize number , code works fine, want know, faster, better, more efficient? initialize variable? scanf can fail, in case nothing written number . if want code correct need initialize (or check return value of scanf ). the speed of incorrect code irrelevant, example code if there difference in speed @ doubt ever able measure it. setting int 0 faster i/o.

join - SQL Subquery: Filter entries that return no rows -

i'm struggling on sql-query... have 3 tables: 1) jobs 2) paper1 3) paper2 paper1 , paper2 have colum job_id corresponding job-id referenced; job id 123 has paper1.job_id of 123 . now want see jobs have corresponding paper1 no paper2 (thus: unfinished, since paper1 , paper2 requirements job fulfilled). attempt this, didn't work out correctly: select id jobs (select id paper1 (job_id = jobs.id) != 0 limit 1) , (select id paper2 (job_id = jobs.id) = null limit 1) any appreciated; thanks. try: select job_id paper1 job_id not in (select job_id paper2 group paper2) group job_id;

swift - iOS 8 - Unable to symbolicate symbols coming from custom dynamic framework -

here have: - ios app called vacationspots (.app file) app dsym file dynamic framework named vsutilities (.framework file) dynamic framework dsym file here sample project source code: https://www.dropbox.com/s/nl32xlk98lnl1mv/vacationspots.zip?dl=0 i made app crash @ launch force unwrapping nil optional. below part of symbolicated crash report. notice vsutilities calls not symbolicated: thread 0 name: dispatch queue: com.apple.main-thread thread 0 crashed: 0 libswiftcore.dylib 0x00333470 0x1d1000 + 1451120 1 vsutilities 0x001c0bd8 0x1b9000 + 31704 2 vacationspots 0x0007a418 spotsviewcontroller.awakefromnib() -> () (spotsviewcontroller.swift:38) 3 vacationspots 0x0007a4b8 @objc spotsviewcontroller.awakefromnib() -> () (spotsviewcontroller.swift:0) 4 uikit 0x2940036a -[uinib instantiatewithowner:options:] + 1910 5 uikit 0x29641818 -[...

vim - Apply a set of lines to a template -

i want process set of lines , apply template each line. let's have following block of lines: case esac if fi and following output: <yyinitial> {case} { return new symbol(sym.case); } ... <yyinitial> {fi} { return new symbol(sym.fi); } so, thought of having template body apply each line, this: <yyinitial> {###place_holder###} { return new symbol(sym.###place_holder###); } and apply each line. what thought of selecting lines, putting in register ("a, instance), selecting template putting in register ("b) , call external script generates output. no luck (don't know how pass contents of register external script). any other approach welcome. this command job: :%s/.*/<yyinitial> {&} {\r\treturn new symbol(sym.&);\r}/ you remove % , if visual selected lines. create mapping or user command it, if used often.

javascript - How can I tell Google closure compiler to not remove a var -

i have following code: // ==closurecompiler== // @output_file_name default.js // @compilation_level advanced_optimizations // ==/closurecompiler== var l = window.location; var s = 'hash'; l[s] = 'whatever need now'; which gets compiled google closure compiler (advanced mode) this: window.location.hash="whatever need now"; but in case need keep using l[s]= ... in compiled code. is there way tell compiler keep using var or ignore couple of lines? compiler in action - demo it's small hack hash function work junos pulse. i'm having lot of trouble believing hack necessary, but: // ==closurecompiler== // @output_file_name default.js // @compilation_level advanced_optimizations // ==/closurecompiler== eval( "var l = window.location;\n" + "var s = 'hash';\n" + "l[s] = 'whatever need now';\n" ); *hack* *cough* :-) or: // ==closurecompiler== // @output_file_name default.js /...

sql server - Invalid length parameter passed to the RIGHT function -

about 2 weeks ago sql has been working past 6 months started throwing error without changing. spent couple days trying find out going on , did not make sense. eventually, tried "alter" on stored procedure (which had no effect) , dropped , recreated (which did fix it). then, 2 days ago, error came , time drop/create not fixing it. according guys, have not patched sql servers in 1.5 months there nothing changed there. have ideas or has had same issues? this line of code, in stored procedure: select labeltext + data cu_formlayout fl inner join cu_data dat on dat.layoutid = fl.id cross apply (select right(fl.xlabeltext,1) rightchar) ca2 cross apply (select case when ascii(rightchar) between 49 , 57 or ascii(rightchar) between 65 , 90 or ascii(rightchar) between 97 , 122 fl.xlabeltext + ': ' else fl.xlabeltext + ' ' end l...

How to avoid inserting duplicate records in table type sql server for a simple table with two rows key-1 and key-2 -

i created simple table 2 columns, let's id-1 , id-2. the combination must unique, solved because primary key. so 1,1 1,2 1,3 taken care of. but how can avoid combinations 2,1 , 1,2 , 1,3 , 3,1 not allowed? create 2 other columns computed based on lowest value of first column, put unique index on 2 computed columns. create table [dbo].[test1]( [id1] [int] not null, [id2] [int] not null, [id1a] (case when [id1]<[id2] [id1] else [id2] end), [id2a] (case when [id1]>[id2] [id1] else [id2] end), constraint [pk_test1] primary key clustered ( [id1a] asc, [id2a] asc )

android - Issue with popBackStack and orientation change -

i have problem fragments , stack after orientation change. in app add new fragment stack after button click this: getfragmentmanager().begintransaction().add(r.id.fl_root_calendar_container, dayfragment.newinstance(monthdayview.getdatetime(), mcalendarlistener), dayfragment.tag). addtobackstack(null).settransition(fragmenttransaction.transit_fragment_open).commit(); if click on button revert transaction after orientation change following code: fragmentmanager fm = getfragmentmanager(); if (fm.getbackstackentrycount() > 0) { fm.popbackstack(); } i see previous fragment again. everything's fine. views stretched or compressed after changing landscape/portrait view. i'm not using setretaininstance(...) the lifecycle callback oncreateview(...) is called in previous fragment after orientation change, views inside restored fragment haven't changed sizes due current orientation. ther...

javascript - cant get any input data from hid device with chrome api -

i making small app take input data usb device chrome packaged app. idea when press button on usb device take incoming traffic, analyze , react depending on input. tried several devices , techniques online tutorials/codes , met many problems, after solving them started use sony playstation 3 pads. device connected via hid that's can accomplish. pressing buttons doesnt make input incoming , far have no idea reason of that. stackoverflow, google manuals , internet doesnt seem have answers on that. here code: manifest.json: { "manifest_version": 2, "name": "hid input analyzer", "version": "1.0", "app": { "background": { "scripts": [ "background.js" ], "persistent": true } }, "permissions": ["hid", { "usbdevices": [ { "vendorid": 1356 , "productid": 616 } ] } ] } backgr...