Posts

Showing posts from May, 2010

objective c - Presenting UIViewController in IOS using cocos2d-JS -

i want present view controller on top of current view controller , using cocos2d-js. after reading while came know there 1 view controller inside cocos-2d , happens through 1 controller only. i trying present view controller using command [[ccdirector shareddirector] presentviewcontroller:mailcont animated:yes completion:nil]; but apparently xcode not able locate ccdirector class. when try incude ccdirector.h header file start getting error "stack file not found" . i think not able include ccdirector properly.. right way ? use [[rootviewcontroller sharedrootviewcontroller] presentviewcontroller:] or window class appcontroller, add [window addsubview] just @ appcontroller.cpp, cocos2d viewcontroller constructed , added there

windows - Batch copying to all folders -

i need batch copy 2 folders, let's call them , b, f:\sourcefolder\ f:\destinationfolder subfolders (not destination folder itself). now know when batch copying file ( file.exe example) supposed for /r "f:\destinationfolder" %%i in (.) @copy "f:\sourcefolder\file.exe" "%i" in each of subfolders there lot of files. after copying , b folders subfolders, move files within subfolders folder within folder. possible do? the xcopy command designed folder copy, for /d list level1 folders: for /d %%a in ("f:\destinationfolder\*") ( xcopy "f:\sourcefolder\a\*" "%%~fa" /s /i xcopy "f:\sourcefolder\b\*" "%%~fa" /s /i ) for recursive copy (all subfolders): for /r /d "f:\destinationfolder\" %%a in (*) ( xcopy "f:\sourcefolder\a\*" "%%~fa" /s /i xcopy "f:\sourcefolder\b\*" "%%~fa" /s /i ) for /r not work if there's no

asp.net - In a multi web server farm, how does session state work? -

case 1: stateserver <system.web> <sessionstate mode="stateserver" stateconnectionstring="tcpip=127.0.0.1:42626" sqlconnectionstring="data source=127.0.0.1;trusted_connection=yes" cookieless="false" timeout="20" /> ... </system.web> case 2: sql server <sessionstate mode="sqlserver" stateconnectionstring="tcpip=127.0.0.1:42626" sqlconnectionstring="data source=127.0.0.1;trusted_connection=yes" cookieless="false" timeout="20" /> question: 1. in case 1 , 2 appropriate location of sql or state server have configured in web.config each of web server in farm. can have servers configured state , sql? can have cookieless , withcookie suppose if use <sessionstate cookieless="true" /> , default of modes used? can done in multiserver farm, or necessary specify ip? 1.) can have servers configured

android - Cannot add Google Play split libraries -

i followed tutorial @ http://developer.android.com/google/play-services/setup.html#split got error error:execution failed task ':app:processdebugresources'. error: more 1 library package name 'com.google.android.gms' can temporarily disable error android.enforceuniquepackagename=false however, temporary , enforced in 1.0 i tried looking around here of them because have library has google-play-services believe not case. gradle: android { compilesdkversion 22 buildtoolsversion '22.0.1' defaultconfig { applicationid "com.android.test" minsdkversion 14 targetsdkversion 22 versioncode 21 versionname "1.1" multidexenabled true } dexoptions { javamaxheapsize "4g" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pr

jquery - Resizing image after insertimage on summernote -

i using summernote , have php fileuploader works great. however, images inserted can large, 1920x1080 , larger. summernote comes great "scale" function images, , love programmatically trigger it. when upload , insert image automatically scaled down given percentage. i know can resize image serverside, im gonna lightbox on images want them in full size, scaled down. has done similar? i faced same problem , solved creating plugin that. it automatically resizes, flips , rotates images before putting them summernote editor. download resized data image plugin summernote here . in addition need exif.js read exif data of images. also add css code page make input[type=file] button icon button: button[data-name=resizeddataimage] { position: relative; overflow: hidden; } button[data-name=resizeddataimage] input { position: absolute; top: 0; right: 0; margin: 0; opacity: 0; font-size: 200px; max-width: 100%; -ms-fil

matlab - Error in using detectMSERFeatures -

i trying morphological operation , tried detectmserfeatures. i'm getting error.can suggest alternative/correction in code.the error had in matlab quoted img= imread('sub.png'); figure,imshow(img);title('original image') img=double(img); m1=img>40; sd = stdfilt(img, ones(3,3)); img = img.*m1; figure,imshow(img); img = bwareaopen(img,50); figure,imshow(img); % detect , extract regions mserregions = detectmserfeatures(img); mserregionspixels = vertcat(cell2mat(mserregions.pixellist)); % extract regions % visualize mser regions overlaid on original image figure; imshow(img); hold on; plot(mserregions, 'showpixellist', true,'showellipses',false); title('mser regions'); % convert mser pixel lists binary mask msermask = false(size(img)); ind = sub2ind(size(msermask), mserregionspixels(:,2),mserregionspixels(:,1)); msermask(ind) = true; hy = fspecial('sobel'); hx = hy'; iy = imfilter(double(img), hy, 'replicate'); ix =

sql - mysql count zeros in sequence -

i got mysql database , need number of zeros in sequence , print them date first zero, example got table this id, date, impuls_count 1, '12-05-15 12:00:00', 60 2, '12-05-15 12:01:00', 0 3, '12-05-15 12:02:00', 0 4, '12-05-15 12:03:00', 49 5, '12-05-15 12:04:00', 0 6, '12-05-15 12:05:00', 0 7, '12-05-15 12:06:00', 0 8, '12-05-15 12:07:00', 0 9, '12-05-15 12:08:00', 30 10, '12-05-15 12:09:00', 0 this should give result this: '12-05-15 12:01:00', 2 '12-05-15 12:04:00', 4 '12-05-15 12:09:00', 1 i tried solve on own query works slow(i got 5000 rows in table) , prints same row twice select qwe.date, ile (select p.date, (select count(*) performance_v2 date > p.date , date < (select min(date) performance_v2 date > p.date , impuls_count > 0)) ile

Using "learning python the hard way." string formatting issue -

is code wants me enter fails from sys import argv script, user_name = argv prompt = '> ' print "hi %s, i'm %s script." % (user_name, script) print "i'd ask few questions." print "do me %s?" % user_name likes = raw_input(prompt) is code modified after seeing errors , knowing uses python 2, i've been making corrections code find them online. from sys import argv script, user_name = argv prompt = '> ' print ("hi" user_name: %s, "i/'m the", %s: script.) print ("i;d tok ask few questions") print ("do me %s") % (user_name) likes = input(prompt) all %s , %d %r have failed me. python 2 convention? should using else? for example foo = bar print ("the variable foo %s fundamental programming issue.) i have tried using tuples? in: print ("the variable foo", %s: foo, "is fundamental programming issue.") with no success you

google chrome arc - ARC: Version & updates -

how can version of running app runtime chrome on chromebook , programmatically? does arc updates , how often? build.id version number. major release bound chrome's release cycle, every 6 weeks.

chef - Get list of installed cookbooks along with their version -

i have server has been provisioned via chef. know cookbook versions have been installed on server. being chef-newbee, worked around using grep following, know whether or not there official way of getting information. sudo grep -e '^version|"version":' /var/chef/cache/cookbooks/*/metadata* is there chef command lists installed cookbooks along versions? try following: knife cookbook list | awk '{printf "knife cookbook show %s\n",$1}'| bash will print out versions associated each cookbook. example: java 1.31.0 1.29.0 mysql 6.0.22 6.0.21 rbac 1.0.3 smf 2.2.6 yum 3.6.0 yum-mysql-community 0.1.17

java - HttpURLConnection header max length in Android -

i have following code update:there problem exists in android apps,it works fine in java application java (not working large header value) url url = new url("myurl"); //<===this http://www.google.com httpurlconnection request = (httpurlconnection) url.openconnection(); string usercredentials = "username:aaaaabbbbbbbbccccsssssssssddddddddddbe4b97cc9e81db"; string basicauth = "basic " + android.util.base64.encodetostring( usercredentials.getbytes(), android.util.base64.default); request.setrequestproperty ("authorization", basicauth); request.connect(); inputstream stream = (inputstream) request.getcontent(); i classnotfoundexception when call getcontent() java.lang.classnotfoundexception: didn't find class "org.apache.harmony.awt.www.content.text.html__charset_us_ascii" on path: dexpathlist[[directory "."],nativelibrarydirectories=[/vendor/lib, /system/lib]] in classloader.class line 514

typescript - Using a Decorator to get list of implemented interfaces -

do know if possible array of interfaces implemented class using decorator: interface iwarrior { // ... } interface ininja { // ... } so if like: @somedecorator class ninja implements ininja, iwarrior { // ... } at run-time ninja have annotation contains ["ininja", "iwarrior"] ? thanks update my understanding may possible achieve without having manually pass interfaces strings decorator (like in @max-brodin's answer ) @interfaces(["ininja", "iwarrior"]) class ninja implements ininja, iwarrior { } some of early decorator proposals allowed following decorators: list of supported decorators @type – serialized form of type of decorator target @returntype – serialized form of return type of decorator target if function type, undefined otherwise @parametertypes – list of serialized types of decorator target’s arguments if function type, undefined otherwise @name – name of decorator target

neo4j - Convert id to Node in Gremlin Pipline -

i have node has attribute contains value of node b value of attribute (functionid). there no direct edge between , b. want select , move on b depending on value of a.functionid currently node , value of functionidd this g.v[123].functionid but how go on? there pipeline-step truns integer value of functionid node? g.v[123].functionid.the_magic.code i guess do: g.v(123).functionid.transform{g.v(it)} which use transform step convert value of functionid vertex in pipeline.

oracle - SQL Join only the last historical row -

i'm sitting @ following problem: i'm writing view join several tables person table. , trying join partners table need historical last valid partner row: partners table: id, name, married_at, divorced_at, died_at, someone_id as can see it's partners are/were married with. can have 1 partner @ time, several partners in history. last partner of (someone_id) may be: alive , still married alive divorced dead "but still married" (so widower) i need find last partner row someone. what got far: select * someone_table s left join partners p on (p.someone_id = s.id , (p.divorced_at null , p.died_at null) ) but - obvious - gives me partners still alive , still married. sure these partners last partners of other "someones" whos last partner divorced or dead won't in result of statement. how other ones , 1 row each someone? i tried select-statement table , using of rownum select * s, (select * partners p p.someone_id = s.id , rownum =

JJOE64 Android graphview reset function -

i've been trying make "realtime" graph using reset function reset data, trying prepare myself using external dataset. here's code; class mytimertask extends timertask { int y = 0; public void run() { random rn = new random(); int loopy = 0; int testvoor2 = rn.nextint(5)+1; testarraylist.add(testvoor2); tempservo2.resetdata(new datapoint[] { (integer object: testarraylist){ new datapoint(object,loopy); loopy = loopy + 1; }; }); string testvoor = integer.tostring(rn.nextint(100)+1); log.d("temperatuur", testvoor); } } as can see using loop in function doesnt work, , alternative can think of using case call different versions of reset functions on basis of length of array list. seems incredibly work intensive (not mention incredible spaghetti code) i'm skeptical there isnt easier way. thanks in advance f

loops - python:compare values with other values in dictionary -

as per this link now have randomly choose state question , compare answer capital, if user provides right answer loop must exit. i have dictionary with {'state': ['alabama', 'alaska', 'arizona', 'arkansas', 'california'], 'capital': ['montgomery', 'juneau', 'phoenix', 'little rock']} something might work (not tested), assumes states , capitals 1 1 , in right order import random random_state = random.choice(your_dict.get('state') index = your_dict.get('state').index(random_state) answer = your_get_answer_method() #returns answer, process if needed (lower ... etc) if your_dict.get('capital')[index] == answer: #do stuff here

multithreading - Ets read concurrency tweak -

i'm playing ets tweaks , read_concurrency . i've written simple test measure how tweak impacts on read performance. test implementations here , there . briefly, test sequentially creates 3 [public, set] ets tables different read_concurrency options (without tweaks, {read_concurrency, true} , {read_concurrency, false} ). after 1 table created, test runs n readers ( n power of 2 4 1024). readers performs random reads 10 seconds , reports how many read operation have performed. result quite surprising me. there absolutely no difference between 3 these tests. here test result. non-tweaked table 4 workers: 26610428 read operations 8 workers: 26349134 read operations 16 workers: 26682405 read operations 32 workers: 26574700 read operations 64 workers: 26722352 read operations 128 workers: 26636100 read operations 256 workers: 26714087 read operations 512 workers: 27110860 read operations 1024 workers: 27545576 read operations r

ubuntu - android device not getting detected by adb in virtual machine -

Image
i created guest vm on ubuntu desktop using kvm.i have installed android sdk in guest vm.i have forwarded usb host guest machine using script: now when try android devices attached guest machine using "adb devices" don't list of devices.output shown follows: but when check usb details using "lsusb" devices attached guest machine ensures usb port has been forwarded host guest machine.you can see output of "lsusb" here: as can see output motorola device being detected here in guest machine not getting detected adb.i have made changes in 51-android.rules (/etc/udev/rules.d/51-android.rules) file automatically allow debugging on android device.those changes follows: can please me figure out why adb not detecting android device? as in script: <address bus='3' ...> in lsusb output: bus 001 fix , retry ;)

Does Python maintain function environment after a function is called to implement closure? -

i'm studying materials in cs61a ,but 'withdraw' example in "2.4.4 local state" gives me illusion python maintains function environment after it's call finished in order implement closure.but it's seems costly. mechanism python takes implement closure. when define outer functions returns inner function: def outer(): x = 40 def inner(): return x + 2 return inner you have access scope of outer function: >>> func = outer() >>> func() 42 the value x stored in tuple __closure__ : >>> func.__closure__[0].cell_contents 40

parsing - Manually parse json data according to kendo model -

any built-in ready-to-use solution in kendo ui parse json data according schema.model ? maybe kendo.parsedata(json, model) , return array of objects? i searching , couldn't find built-in. however, using model.set apparently uses each field's parse logic, ended writing function works pretty good: function parse(model, json) { // initialize model json data quick fix since // setting id field doesn't seem work. var parsed = new model(json); var fields = object.keys(model.fields); (var i=0; i<fields.length; i++) { parsed.set(fields[i], json[fields[i]]); } return parsed; } where model kendo.data.model definition (or datasource.schema.model ), , json raw object. using or modifying accept , return arrays shouldn't hard, use case needed single object parsed @ time.

math - Generate all possible combinations of a set of numbers in excel -

Image
how can generate possible combinations, in excel, using 3, 6 , 9 in 5 digit number? naturally digits can repeat. i trying learn more excel , cannot figure out - how generate possible combinations , see them instead of having number of possibilities. i've looked through many forums, there's nothing can use... http://planetcalc.com/3756/?license=1 - link online generator, there must mistake in code since doesn't show 5 digit numbers. just loop on selections: sub maja() dim k long k = 1 vals = array("3", "6", "9") each in vals each b in vals each c in vals each d in vals each e in vals cells(k, 1) = & b & c & d & e k = k + 1 next e next d next c next b next msgbox k end sub a snap of top of list: note: technically, call these permutations rather combinations because values 33363 , 33336 both appear in list r

osx - QML Mac fullscreen mode lose mouse focus -

i'm using qml build osx application fullscreen mode support. intention toggle fullscreen/normal mode double-clicking main area of window, here minimal code: import qtquick 2.4 import qtquick.window 2.2 window { id: main visible: true width: 800; height: 480 flags: qt.window | qt.windowfullscreenbuttonhint // osx native behavior support mousearea { anchors.fill: parent ondoubleclicked: { if (main.visibility === window.fullscreen) { main.visibility = window.automaticvisibility; } else { main.visibility = window.fullscreen; } } } } it's simple, behavior weird: whenever visibility state of application changes(enter or leave), user must click in window 1 more time before window mode can change again, the application loses mouse focus . to validate i'm thinking, test more, add 1 more mousearea (let's mouseareatest ) in window, split window side s

Overloading inside interface in Java -

i need implements various update methods observers in project, overload object argument specific type. instead of using public void update (observable o, object arg0){ if(arg0 instanceof class1) .... else if (arg0 instanceof class2) .... or switch (which 'c' way of working), thought of using interface extends observer , overloads update method, this public interface extendedobserver extends observer{ public void update (observable obj, class1 cls); public void update (observable obj, class2 cls); } and implement observers. every different observer use specific update method. i wanted know if it's correct way of working, because i don't think overloading method inside interface correct i still have add unused update methods inside every class implements interface. there no problem in overloading method inside interface an interface contract mandatory implementing classes implement. if not want classes implement method. the

excel - Hide rows based on Date input -

i have sheet, data24h , filled data sorted date. i want create function user show data specific date. so created userform user inputs date in textbox1 , want program hide every row not included in date interval. the hide-function seems work condition not work. if have today's date yymmdd input still show dates. i new programing in general , vba in particular , understand if question bit vague , code looks #!!#@. private sub commandbutton1_click() datum = textbox1.value sheets("data24h").select beginrow = "" endrow = 100 chkcol = 3 rowcnt = beginrow endrow if cells(rowcnt, chkcol).value >= datum cells(rowcnt, chkcol).entirerow.hidden = true else cells(rowcnt, chkcol).entirerow.hidden = false end if next rowcnt columns("a").select unload me Återställ1.show end sub so tried using autofilter still can't manage. error 1004 in "last&

jquery - JSON filter using javascript -

i have json object contains duplicated data. these data can change given structure of need organize json based on country please find original json { "datalist": [ { "country": "aus", "cart": 1610950, "orders": 35670, "viewed": 966570, "visits": 32190 }, { "country": "aus", "cart": 1610950, "orders": 35670, "viewed": 966570, "visits ": 32190 }, { "country": "aus", "cart": 1610950, "orders": 35670, "viewed": 966570, "visits": 32190 }, { "country": "aus", "cart": 1610950, "orders":

ios - Can I forbid my cocoapods update a specific library? because I want to change it's source code -

is there commands in podfile :forbid or :no-update ? don't want update specific libraries. , don't want add library myself. no, should fork library or use local downloaded copy :path attribute in podfile.

ios - filtering two arrays one is NSArray(Core Data) and the other is NSMutableArray(simple) -

i getting core data in array consists of records , getting locations distance (2.5 km)example have filter 2 arrays distance this code doing now locations ... locafilterarray = [[nsmutablearray alloc]init]; (int l = 0 ; l < dealarray.count; l++) { deal * deal = (deal *)dealarray[l]; nsarray * locarray = [[deal locationrelation]allobjects]; double minvalue = 10000; if (locarray.count > 0) { (int l = 0; l < locarray.count ; l++) { deallocation * location = (deallocation *)locarray[l]; double latitude = [[location latitude]doublevalue]; double longitude = [[location longitude]doublevalue]; cllocation * cdlocation = [[cllocation alloc]initwithlatitude:latitude longitude:longitude]; cllocation * currlocation = [[cllocation alloc]initwithlatitude:appdelegate.currentlatitude longitude:appdelegate.currentlongitude]; cllocationdistance distance = [currlocation distancefromlocation:

sql - Python always crashes using pydobc connection -

i having hard time pyodbc module ( python3 ). following code crashes python (i run dos terminal). crash happens when main() function returns. data source 4d v13 database remote server. using 4d-odbc driver seems installed not efficient driver. have disabled ssl connection , firewall. class odbcsource: def __init__(self, dsn): self.dsn = str(dsn) try: self.con = pyodbc.connect("dsn={}".format(self.dsn)) self.cur = self.con.cursor() logger.info("odbc source dsn='{}' connected.".format(self.dsn)) except exception err: self.con = none self.cur = none logger.error("cannot connect odbc source dsn='{}': {}.".format(self.dsn, err)) def __bool__(self): return not(self.con none) or not(self.cur none) def __str__(self): return "<cripython.dal.odbcsource id={:#x} dsn='{}'>".format(id(self), self.

AngularJS - ngRepeat - override html rendering -

i have following ng-repeat code: <div ng-repeat="item in items">{{item}}</div> is there way programatically javascript variable 'final' html output of each of repeated items instead of rendering on page? hope that's clear enough.

jquery - not able to redirect using javascript -

i want redirect using javascript , able redirect using document.write() otherwise not. document.write("you redirected main page in 5 sec."); settimeout(redirect_admin(), 5 * 1000); i want redirect page without using document .write() entire code: $(document).ready(function () { btnsubmit = $("#btnlogin"); btnsubmit.click(function () { //$("#preloader").show(); //$("#status").show(); var uname = $("#username").val(); var upass = $("#pasword").val(); var str = -1; $.ajax({ type: "post", async: false, url: "default.aspx/userlogin", data: '{"username":"' + uname + '","userpassword":"' + upass + '"}', contenttype: "application/json; charset=utf-8", datatype: "json", success: functi

c# - What is best practice to load text in an MVC website? -

can suggest best practice load text(which has 2-5 paragraphs) in razor page, either getting text load word document(write c# class parse word document , through controller pass data view) or directly embedding text in razor page ? thanks if don't expect text change write in razor view. if text might change, , don't want re-publish every time, can have controller read file or database , pass razor view.

java - ElasticSearch:Current context not an ARRAY but OBJECT when trying to index an array -

i have scala mutable set want index in elasticsearch array way in doing throwing me error here code var genreidset = scala.collection.mutable.set[int]() genreidset+=1 genreidset+=2 genreidset+=3 val bulkrequest=client.preparebulk() bulkrequest.add(client.prepareindex("testdb","test","123") .setsource(mymethod) ) val bulkresponse =bulkrequest.execute().actionget() def mymethod: xcontentbuilder={ def json={jsonbuilder().startobject()} json.field("uuid","123") json.startarray("genreidset") for(n<-genreidset) { json.value(n) } json.endarray() json.endobject() } but gives me error -current context not array object org.elasticsearch.common.jackson.core.jsongenerationexception: current context not array object @ org.elasticsearch.common.jackson.core.jsongenerator._reporterror(jsongenerator.java:1487) ~[elasticsearch-1.5.0.jar:na] @ org.elasticsearch.common.jackson.core.json.utf8jsongenerator.wr

java - Action errors are not shown on the JSP -

i have tried adding action errors in action class , printing them on jsp page. when exception occurred, going catch block , printing "error in inserting exception, contact admin", in console. in catch block, i've added addactionerror() , , i've tried printing in jsp page... but message not shown in jsp page . what may missing or doing wrong ? struts mapping: <action name="dataupdate" class="foo.bar.myaction" method="updation"> <result name="success" type="redirectaction"> ../aggregator/redirecttodataupdate </result> </action> action class: public string updation() throws jiffietransactionexception{ try { // stuff... } catch (numberformatexception e) { addactionerror("error in inserting exception, contact admin"); system.out.println("error in inserting exception, contact admin"); e.printstacktrace();

asp.net mvc - Am I able to retrieve a JIRA HTTP URL using a GET Request when I use CORS? -

i trying retrieve information url of jira issue using mvc application coded in visual basic. calling url using request in ajax. the url returning correct information in postman. when try use cors allow local host using following headers in web.config: <add name="access-control-allow-headers" value="origin, x-requested-with, content-tpye, accept"/> <add name="access-control-allow-origin" value="http://localhost:xxxxx"/> <add name="access-control-allow-credentials" value="true"/> <add name="access-control-allow-methods" value="get, post, put" /> i still getting following error: no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:xxxxx ' therefore not allowed access. response had http status code 400. even though have added "access-control-allow-origin" web.config. i wondering possible retu

osx - Mac OS X Terminal - Display list of File Types from Subfolders -

i have external hard drive has content of recovered drive. folders have 'recup_dir.xx' names , there on thousand. i have copied on content can think of, of specific file types using: find . -type f -name \*.jpg -exec cp \{\} /volumes/somedrive/somefolder/ \; i went through file types can think of - want see file types on drive , in sub folders. what command can use go through folders , sub folders , display 'total's each file type? du -hcs gives total of drive- after total per file type. can point me in right direction. have thousands of folders , want make sure haven't forgotten file types - want list of them. thanks in advance. you can awk (as other scripting languages). here script in awk : #!/bin/sh find . -type f -ls | awk ' { type = $11; if ( type ~ /\./ ) { sub(/^.*\./, "", type); } else { type = "."; } sizes[type] += $7; } end { ( type in sizes ) { print

symfony - Export .csv from database with symfony2 -

i didn't method work, maybe has idea. /** * @route("/export", name="export") * @template("appbundle:expenses:export.html.twig") */ public function exportaction() { $repository = $this->getdoctrine()->getrepository('appbundle:expenses'); $query = $repository->createquerybuilder('s'); $query->orderby('s.id', 'desc'); $data = $query->getquery()->getresult(); $filename = "export_".date("y_m_d_his").".csv"; $response = $this->render('appbundle:expenses:export.html.twig', array('data' => $data)); $response->setstatuscode(200); $response->headers->set('content-type', 'text/csv'); $response->headers->set('content-description', 'submissions export'); $response->headers->set('content-disposition', 'attachment; filename='.$filename); $respons

ios - How to call protocol from another viewcontroller? -

i want call protocol viewcontroller viewcontroller . got error below: type 'hello' not conform protocol 'loginpagevcdelegate' here protocol in loginpagevc protocol loginpagevcdelegate { func onloginfacebook(loginviewcontroller : loginpagevc!) } and here how call class hello : uiviewcontroller, loginpagevcdelegate { .... } what did wrong? how can fix it? you should not call here instead implement it: class hello : uiviewcontroller, loginpagevcdelegate { func onloginfacebook(loginviewcontroller: loginpagevc!) { } }

return - Newbie Java Programmer needs help involving for loops -

i trying create example program me remember how operate loops, when ran through compiler . compiler said missing return statement . add it? here code: public class loopexample { public string bam() { (int = 0; < 8; i++) { system.out.println(i); } } } edit received answer, main says 'cannot find symbol'... here code main: public class loopexampletestdrive { public static void main(string[] args) { bam looper = new bam(); system.out.println(looper); } } i advise try understand how object oriented languages work first. that being said, main reason why code doesn't work, because try make object of class bam new bam() . class unfortunately doesn't exist method in class. solution like: public class loopexample { public void bam() { (int = 0; < 8; i++) { system.out.println(i); } } public static void main(string[] args) {

performance - Efficient SVG rendering for PDFs (Java, Batik, Flying Saucer) -

i'm rendering pdfs xhtml , flying saucer. i've added svg images (icons etc) well. however, when try draw lot of images (like 5000+) rendering takes long (obviously). there 10 or different images draw, repeating them lot of times (same size). is there way/library efficiently? currently using batik, flying saucer combo draw images. following code used parse xhtml , find img tags place svg images: @override public replacedelement createreplacedelement(layoutcontext layoutcontext, blockbox blockbox, useragentcallback useragentcallback, int csswidth, int cssheight) { element element = blockbox.getelement(); if (element == null) { return null; } string nodename = element.getnodename(); if ("img".equals(nodename)) { saxsvgdocumentfactory factory = new saxsvgdocumentfactory(xmlresourcedescriptor.getxmlparserclassname()); svgdocument svgimage = null; try { svgimage = factory.createsvgdocument(new file(el

c# - Automapper ResolveUsing cause "Can't resolve this to Queryable Expression" -

i'm using autommaper map domain classes model classes , viceversa. need encrypt/decrypt 1 property. when map model domain there isn't problem, work perefectly: mapper.createmap<entitymodel, entity>().formember(dest => dest.password, opt => opt.resolveusing(src => this.encryptstring(src.password))) but when map entity model automapper crash , throws "can't resolve queryable expression": mapper.createmap<entity, entitymodel>().formember(dest => dest.password, opt => opt.resolveusing(src => this.decryptstring(src.password))) i've tried custom value resolver too, same result: mapper.createmap<entity, entitymodel>().formember(dest => dest.password, op => op.resolveusing<passwordresolver>().frommember(x => x.password)); public class passwordresolver : valueresolver<object, string> { protected override string resolvecore(object source) { return "test"; } }

java - MySQL query in spring-security.xml for authorization -

q1. > how check whether following 2 queries executed or not in spring-security.xml ? <jdbc-user-service data-source-ref="datasource" users-by-username-query= "select user_login_name username,user_password password,user_type_id,role_id sox_audit.sox_users user_login_name=? , user_password=?" authorities-by-username-query= "select user_login_name username,role_id authority sox_audit.sox_users user_login_name ='sriram@gmail.com' , user_password='12345' "/> i can able login hardcoded values , give authorities per user type. cannot selecting records db. can me out in this. enable logs jdbcdaoimpl implements userdetailsservice . like: log4j.logger.org.springframework.security.core.userdetails.jdbc.jdbcdaoimpl=debug if doesn't work, add breakpoints on class , debug on runtime.

asp.net - Publish to Azur fails with 500 internal Server Error -

i have cloud service on windows azure, created asp.net webapi project , published cloud service, working fine visual studio publish before updated visual studio update 4 , azure sdk 2.2 2.6. after updating when publish, got following error messages. tried several times, failed. can me? even not able publish new created project on new azure service ! 11:00:31 pm - warning: there package validation warnings. 11:00:31 pm - checking remote desktop certificate... 11:00:39 pm - preparing deployment tempazure - 2/12/2014 10:58:23 pm subscription id 'e94e9aeb-7003-4eae-be92-7b7ac0a1ba2c' using service management url ' https://management.core.windows.net/ '... 11:00:39 pm - connecting... 11:00:39 pm - verifying storage account 'jasontest'... 11:00:41 pm - uploading package... 11:06:48 pm - warning: remote server returned error: (500) internal server error. 11:11:50 pm - warning: remote server returned error: (50

java - NullPointerException when using EvoSuite -

i tried use new evosuite (0.1.1), however, has failed exception below. have tried several classes, result same. able finish without exception. using ubuntu 14.04 64-bit java 8. -projectcp parameter correct. have attached output of simpler generation , cut. command: java -jar ../../sette-tool/test-generator-tools/evosuite/evosuite.jar -projectcp build -generatetests -dsearch_budget=10 -class hu.bme.mit.sette.snippets._1_basic.b2_conditionals.b2a_ifelse output: * evosuite * going generate test cases class: hu.bme.mit.sette.snippets._1_basic.b2_conditionals.b2a_ifelse * starting client * connecting master process on port 12480 * analyzing classpath: - build * finished analyzing classpath * generating tests class hu.bme.mit.sette.snippets._1_basic.b2_conditionals.b2a_ifelse * test criteria: - line coverage - branch coverage - exception - mutation testing (weak) - method-output coverage - top-level method coverage * setting search algorithm individual test genera