Posts

Showing posts from July, 2010

ios - NSString stringWithFormat added "ffffff" -

i'm trying bytes nsdata , put in nsstring. while doing "ffffff" added simultaneously : char *array = (char *)[deviceinfo bytes]; return [nsstring stringwithformat:@"%02x:%02x:%02x:%02x:%02x:%02x", array[5],array[4],array[3],array[2],array[1],array[0]]; returns "53:ffffffcb:ffffffb8:51:09:fffffff0" the issue relates sign extension compiler promotes signed char unsigned int . numbers fffff negative. %x format expects unsigned int argument. declaring array correctly fix issue: const uint8_t *array = [deviceinfo bytes];

ASP.NET: route parameter with backslash "\" in url -

similar question , have problems backslash in route parameter. parameter presents windows folder , subfolder structure, contains backslashes. however, every browser (chrome, firefox, ie) converts backslash automatically slash. controller/action/myfolder\mysubfolder\anothersubfolder always becomes: controller/action/myfolder/mysubfolder/anothersubfolder the parameter presents windows folder , subfolder structure, contains backslashes. encode parameter , add in url, in controller can decode original value. encode value using httputility.urlencode(value); decode httputility.urldecode(value);

ios6 - Want to redirect to setting page of Facebook if no account is configured in iPhone's Settings app -

i'm integrating facebook app uploading video fb. working fine. acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccounttype *accounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; __block acaccount *facebookaccount; nsdictionary *options = @{ acfacebookappidkey: @"457887770928321", acfacebookpermissionskey: @[@"publish_stream", @"publish_actions"], acfacebookaudiencekey: acfacebookaudiencefriends }; [accountstore requestaccesstoaccountswithtype:accounttype options:options completion:^(bool granted, nserror *error) { if(granted) { nsarray *accountsarray = [accountstore accountswithaccounttype:accounttype]; if ([accountsarray count] > 0) { facebookaccount = [a

jupyter notebook - API for inline graphics in ipython -

i made small library in python can generate graphics , i'd able display object in ipython %matplotlib inline . is there library use make work in simple way? bonus points if display can made interactive. from docs on how add rich display of objects: http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display so long control class definitions, can add _repr_*_ methods, e.g. _repr_png_ or _repr_html_ . note they're surrounded single underscores, unlike python's own magic __repr__ method. text data html should returned string, , binary data png bytes. if don't control class definition, can register formatters separately: get_ipython().display_formatter.formatters['image/png'].for_type(mytype, func) for_type() method docs

ruby - How to add addional 0 to select_month option in rails -

heres code <%= select_month nil, {use_two_digit_numbers: true}, {:name => 'expmonth', class: "form-control" } %> and results <select class="form-control" id="date_month" name="expmonth"> <option value="1">01</option> <option value="2">02</option> <option value="3">03</option> <option value="4">04</option> <option value="5">05</option> <option value="6">06</option> <option value="7">07</option> <option value="8">08</option> <option value="9">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> if can see value of options has no "0"

javascript - Selenium/WebdriverJs/Protractor promise chaining with page objects -

i implementing page object pattern in protractor/selenium. since every method in protractor returns promise, consitency methods in page object should return promises. further more page objects may have functions return page object or custom of page object (like leftnavigation, maincontent). instead of returning page object itself, page object should returned within promise. not undestand how that. additionally chain method calls without using .then(..) method. webelements possible call further functions without calling .then(..) method, e.g. browser.driver.findelement(by.css('#someid')).findelement(by.css('#somebutton')).click(); i achieve page object pattern: let pagepromise = adminbasebage.get(); // returns promise<adminbasepage> let mcontent = page.maincontent;// should return promise<maincontent> let titlepromise = mcontent.getmoduletitle(); // returns promise<string> or better adminbasebage.get().maincontent.getmoduletitle();

ios - Xcode 7.3.1 - SVN : Couldn't communicate with a helper application -

using xcode 7.3.1, following error when trying commit changes project under svn source control "the working copy "projectname" failed commit files. couldn't communicate helper application" my guess it's failing locate / execute "svn" binary under hood, seem strange other svn actions in xcode work fine (source control -> history... happily shows previous commits etc, suggest able communicate svn server fine) there other similar problems on site, either related git projects or unanswered we got problem when adding new localization. using xcode 8.2.1 we found graphics files @ character in them caused problem. svn doesn't @. when svn operation on file @ in name have add @ @ end of command. seemingly xcode not taking consideration when interacting svn. the workaround temporarily move .svn file project directory, work in xcode, move .svn file , manually update svn using non-xcode interface of choice.

c++ - Locality Sensitive Hash or pHash? -

i'm trying implement general fingerprint memoizator : have file can expressed through intelligent fingerprint (like phash images or chromaprint audio) , if our desidered (expensive) function has been computed on similar file, return same result (avoiding expensive computation). locality sensitive hash (lsh) popular , well-performant solution approximate nearest neighbor problem in expensive multi-dimensional space. phash library implements perceptual hashing images. so phash transform multi-dimensional input (an image) one-dimensional object (an hash code), different lsh (again, multi-dimensional objects in lsh). so i'm wondering how implement mono-dimensional lsh phash hash values? or in few words: how can group in bins similar phash values? alternative classic lsh approach (and if not why)? you use n random projections split phash space 2^n buckets, similar images found same bucket. xor hash 64 possible integers hamming weight 1 check neighboring

Xamarin Forms Listview in Scrollview doesn't scroll -

<?xml version="1.0" encoding="utf-8"?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:class="dh.listpage"> <contentpage.content> <scrollview> <stacklayout style="{staticresource mainstacklayoutwhenloggedinstyle}"> <frame style="{staticresource framestyle2}"> <stacklayout> <label text="vragenlijsten" style="{staticresource titellabelstyle}" /> </stacklayout> </frame> <frame style="{staticresource framestyle2}"> <stacklayout> <label text="dringende vragen: vul deze vragen meteen in!" style="{staticresource standardlabelstyle}"/> <frame style=&quo

jquery - Local web server not working properly -

i have odd issue local web server. i'm working on zend framework application, , changes make on app, not reflected when open website in browser. instance i've tried putting simple console.log on button click event in jquery: <script> $(document).ready(function() { $("#btnredeem").click(function() { console.log('it works'); }); }); </script> but whenever press button, or console.log anywhere, doesn't reflects changes.. i've tried using several browsers make sure nothing being cached or that. i'm using mamp tool run apache server , mysql db; does knows might ?

javascript - How to pass an array with multiple mesh objects -

i parse array created in web worker, main thread. array includes high number of three.mesh objects. when trying stringify array : self.postmessage(json.stringify(mesh)); an error occurs: three.min.js:182 uncaught typeerror: cannot read property '971e7aca-8223-4a5c-9f2f-e7966b58265f' of undefined. how can handle problem regarding mesh objects??? in modern browsers, can avoid stringifying array , rely on structured clone algorithm handle you: self.postmessage(mesh); see example on mdn

javascript - Download Table to excel With hidden rows with ng-repeat -

i have table created using ng-repeat. in table have used ng-repeat-start , ng-repeat-end in order hide row visible when user wants see it. problem when try export table excel rows visible appear in excel there rows linked each other appear different rows(as in table different rows). want rows whether visible or not should appear in excel. there way 2 rows linked each other(as contain data related 1 single instance) can appear single row in excel. here code function myctrl($scope) { $scope.exportdata = function () { var table = document.getelementbyid('exportable'); var html = table.outerhtml; window.open('data:application/vnd.ms-excel,' + encodeuricomponent(html)); }; $scope.items = [{ "name": "name1", "date": "10/02/2014", "terms": ["samsung", "nokia", "apple"] }, { "name": "

angular - Overriding CKEditor CSS in Angular2 -

i want override css style of ckeditor. if put css in own css file, custom css overridden default css style of ckeditor. load own css file after css file of ckeditor , ensure css selectors have higher selectivity.

python - Is there a way to make an invisible button in Tkinter? -

i found ways hide after pressing button, having invisible button can still pushed. secret button of sort, using tkinter. doesn't need yet you don't need invisible button register secret click bind <1> root window , register whenever click on (unless click on other widget listening event). can check coordinates of click see use clicked.

floating point - How do I round this binary number to the nearest even -

i have binary representation of 0.1 : 0.00011001100110011001100110011001100110011001100110011001100110 i need round nearest able store in double precision floating point. can't seem understand how that. tutorials talk guard, round , sticky bits - in representation? also i've found following explanation: let’s see 0.1 looks in double-precision. first, let’s write in binary, truncated 57 significant bits: 0.000110011001100110011001100110011001100110011001100110011001… bits 54 , beyond total greater half value of bit position 53, rounds to 0.0001100110011001100110011001100110011001100110011001101 this 1 doesn't talk grs bits, why? aren't required? the text quote article why 0.1 not exist in floating-point . in article showing how conversion hand, , "grs" bits ieee implementation detail. if using computer conversion, don't have use ieee arithmetic ( and shouldn't if want correctly ), grs bits won't come play t

Drawing a coloured border around an image in MATLAB? -

hey i'm trying put coloured border around image in matlab , can't life of me see why isn't working: clear, close all, clc = imread('syd.jpg') [m n o] = size(a) border_width = 25; border = zeros(m+(border_width*2),n+(border_width*2),3); c = [randi(255) randi(255) randi(255)]; border(:,:,1) = c(1); border(:,:,2) = c(2); border(:,:,3) = c(3); = 1 : m j = 1 : n border(m+border_width,n+border_width,:) = a(m,n,:); end end imshow(uint8(border)); all block coloured image, maybe i'm missing small, doing wrong? in for -loop, indexing m , n , instead of i , j . variables m , n constants, meaning setting value of 1 pixel in code. try this: for = 1 : m j = 1 : n border(i+border_width,j+border_width,:) = (a(i,j,:)); end end

ios - AES must have a fixed IV size of 16-bytes regardless key size -

hello using bbaes encrypt , decrypt code. getting error in line. encrypteddata=[bb encrypteddatafromdata:[bb datafromstring:_secret encoding:bbaesdataencodingbase64] iv:[bb datafromstring:iv encoding:bbaesdataencodingbase64] key:hashkeydata options:bbaesencryptionoptionsincludeiv]; and error is *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'aes must have fixed iv size of 16-bytes regardless key size.' this how create hashkeydata hashkeydata=[bb keybyhashingpassword:_key keysize:bbaessaltdefaultlength]; please me. thanks you converting iv string iv data calling [bb datafromstring:iv encoding:bbaesdataencodingbase64] this give more or less 16 bytes, depending on iv why getting exception. the function should use use ivfromstring: . uses md5 hash create nsdata instance 16 bytes. encrypteddata=[bb encrypteddatafromdata:[bb datafromstring:_secret encoding:bbaesdataencodingbase64] iv:[bb ivstring:iv

c++ - Which algorithm is used to train/predict Opencv LBPH face recognizer? -

i couldn't understand how training stage , predition stage working.Ä°s using algorithm svm or k-nearestneighbour after finding lbph features? if check: https://github.com/itseez/opencv_contrib/blob/master/modules/face/src/lbph_faces.cpp see use 1-nearest neighbour, excerpt detect function: // find 1-nearest neighbor collector->init((int)_histograms.size(), state); (size_t sampleidx = 0; sampleidx < _histograms.size(); sampleidx++) { double dist = comparehist(_histograms[sampleidx], query, histcmp_chisqr_alt); int label = _labels.at<int>((int)sampleidx); if (!collector->collect(label, dist, state))return; } a 1-nearest neighbour classifier used since local binary pattern descriptor simple enough. see more in depth explanation paper: " face recognition local binary patterns " on side note. not implementation/practical question , not belong on forum. suggest using opencv forum.

Why do i have multiple google-domains (.com, .de, ...) as sources of traffic -

Image
in google-analytics account on acquisition -> traffic -> source/medium - view see multiple google websites source. in screenshot below can see 3 times google/organic (3., 4. , 7.) , 2 times google/cpc (5. , 6.) do know why happening , (even more important) how can fix it? this custom trackingcode: (function(i, s, o, g, r, a, m) { i['googleanalyticsobject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new date(); = s.createelement(o), m = s.getelementsbytagname(o)[0]; a.async = 1; a.src = g; m.parentnode.insertbefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', 'ua-*', 'my-domain.com', { 'sitespeedsamplerate': 10, 'samplerate': 100 }); ga('set', 'anonymizeip', true); ga('require', 'displayfeatures'); settimeout('ga(\'

python 2.7 - how to delete duplicates record from a mongodb database -

i have mongodb collection more 5 millions records. need delete duplicate entries. here code tried, pymongo import mongoclient conn=mongoclient("mongodb://127.0.0.1:27017") db=conn.test cursor=db.coll.aggregate( [ {"$group": {"_id":{"instrument name":"$instrument name","high":"$high","low":"$low","v":"$v","date":"$date","close":"$close","open":"$open"}, "unique_ids": {"$addtoset": "$_id"}, "count": {"$sum": 1}}} ], { 'allowdiskuse': 'true' } ) response = [] doc in cursor: del doc["unique_ids"][0] id in doc["unique_ids"]: response.append(id) db

Titan Graph Database with Cassandra -

is possible install titan graph database uses cassandra backend in windows 7? tried installing titan-server-0.4.4 had cassandra in it. downloaded zip had titan.sh, i'm using windows require titan.bat file. command run "titan.sh -c cassandra-es start" if want run on windows, can try installing cassandra , elasticsearch separately because titan 1.0 distribution not include titan.bat . in addition, there fixes have been put titan post-1.0 release running on windows. first, can use datastax cassandra distribution windows planet cassandra . based on titan's version compatibility matrix , should go msi installer cassandra 2.1.x. elasticsearch, should go version 1.5.2 ( installation reference ). next, should unzip titan-1.0.0-hadoop1.zip . need copy gremlin.bat , gremlin-server.bat %titan_home%\bin directory. need copy gremlin-server.yaml , titan-cassandra-es-server.properties %titan_home%\conf\gremlin-server directory. now, should ready test out. s

lua - How to stop an object from moving past a point -

i wondering if there way stop object moving off screen. in code, have controllable character (player) , want prevent moving left when it's x coordinate < 1 i have tried in code below, however, player not stopped if hold down left arrow key. is there way fix this? if had guess, somehow need program continuously check case player.x < 1 motionx = 0; -- variable used move character along x axis speed = 10; -- set walking speed local function moveplayer (event) player.x = player.x + motionx; end runtime:addeventlistener("enterframe", moveplayer) local function onkeyevent( event ) if ( event.phase == "down" ) if ( event.keyname == "left" ) , player.x > 1 motionx = -speed return true elseif ( event.keyname == "right" ) motionx = speed return true end end end runtime:addeventlistener( "key", onkeyevent ) you need check bounda

ios - Why I cannot assign image to custom collect CollectionViewCell -

i designed custom uicollectionviewcell , added image view outlet. then, connected image view cell. somehow, cannot assign image (uiimage) image view. below code cellforitematindexpath . - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { // service gallary custom collection view cell. [self.collectionview registerclass:[servicegallarycell class] forcellwithreuseidentifier:collectioncellidentifier]; servicegallarycell *servicecollectioncell = (servicegallarycell*)[collectionview dequeuereusablecellwithreuseidentifier:collectioncellidentifier forindexpath:indexpath]; if (collectionview == self.collectionview) { servicecollectioncell.image.image = [uiimage imagenamed:_imagesarray[indexpath.row]]; } return servicecollectioncell; } you can try: -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)ind

haskell - Existentials and reusing witness -

let's imagine have existential type t t = ∃x { :: x, f :: x -> int} of produce value v :: t v = pack {int, { = 0, f x = 0 } } t so : users of value forbidden know type x used in implementation. in order consume value, code has polymorphic in x the implementor, on other hand, in full knowledge x int , can use capacities of underlying type wishes i know if there variant of mechanism not destroy evidence : w, v = pack {int, { = 0, f x = 0 } } t s = unpack w v -- recovers type information where w value level proof of type equation tying x int . idea selectively reuse implementation in part of code, , have non polymorphic code. have usual existential behaviour, can ignore w returned. i guess 1 cast x int , abandon type safety, that's story: if know secret v , wouldn't make sense me able tell secret else , have compiler verify secret used code has been given to. has been tried / what's wrong part of this? use singletons

fuzzy search - Use gems with c-extensions in JRuby, or port them to Java? -

i'm doing fuzzy match test between input string , entered strings. test performed live while typing. i have shockingly accurate algorithm in place called strikeamatch , has been translated many languages . fastest ruby implementation i've found amatch . however, incompatible jruby environment because crunches data in c extension requires c interpreter ruby (mri). it's pretty fast though: a = "lorem ipsum dolor" b = "lorem ipsum dolor sit amet, consectetuer adipiscing elit. nam cursus. morbi ut mi. nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. sed eleifend nonummy diam. praesent mauris ante," puts benchmark.measure { 10000.times { a.pair_distance_similar(b) } } # => 0.130000 0.000000 0.130000 ( 0.146347) i hope can avoid setting alternative environment. alternative approach try , port original java code as suggested in jruby wiki . not sure how though. any ideas how approach this? the algorithm easy im

excel - "apllication -defined or object oriented error" is throwing while compling vb code. working between multiple workbooks -

this part of code. at 1st if, error popop coming saying "application-defined or object oriented error". for row_num = 2 3 'column numbers col_num = 6 7 'check grey color if workbooks(book_name).worksheets("parameterlifecycles").range(cells(row_num, col_num), cells(row_num, col_num)).interior.color = rgb(217, 217, 217) 'check if software name empty if not isempty(workbooks(book_name).worksheets("parameterlifecycles").range("s" & row_num)) soft_rd = workbooks(book_name).worksheets("parameterlifecycles").range("s" & row_num) else soft_rd = workbooks(book_name).worksheets("parameterlifecycles").range("b" & row_num) end if 'exit row once software name obtained col_num = 16[enter image description here][1] in workbooks(book_name).worksh

php - MySQL Timestamp INSERT okay but sometimes fails -

so i've got bootstrap 3 form , there clockpicker , datepicker plugins in it. data through php , try insert mysql (currently in xampp). insert okay, 1 or both of timestamp fields in db left @ 0000.... since display date 17/09/2016 try save 2016-17-09 in mysql , have concatenate text clockpicker text date picker, that: $startdate = $_post['shiftstartdate'] . " " . $_post['shiftstarttime']; $startdateformat = str_replace('/', '-', $startdate); $date1 = date_create($startdateformat); $datetime1 = date_format($date1, 'y-d-m h:i:s'); $enddate = $_post['shiftenddate'] . " " . $_post['shiftendtime']; $enddateformat = str_replace('/', '-', $enddate); $date2 = date_create($enddateformat); $datetime2 = date_format($date2, 'y-d-m h:i:s'); any ideas? solution : when formatting, conform mysql's requirement of y-m-d, not y-d-m: $datetime2 = date_format($date2, 'y

Hadoop MapReduce: How to ensure multiple tasks are executed in parallel among all nodes -

i have task list file in hdfs , list of tasks cpu-bound , executed in small 5-node cluster hadoop mapreduce (map only). instance, task list file contains 10 lines, each of corresponds task command. execution of each task takes way long time, more efficient execute listed 10 tasks in parallel on 5 nodes. however, task list file pretty small, data block located on 1 node node execute these 10 tasks based on data locality principle. there solution ensure 10 tasks executed in parallel on 5 nodes? by default, map reduce run 1 mapper per split. split block, if have large file, 1 mapper per block size of file (default 128mb) process 128mb chunk in parallel other chunks. in case, have series of lines in small file - 1 split, , therefore processed single mapper. however, instead of having 1 file of 10 lines, can create 10 files of 1 line? have 10 splits, , map reduce run 10 mappers across cluster in parallel (depending on available resources) process tasks.

jquery - I want to add class in the container while dropping a div in the container -

i using "jquery.sortable.js" create drag , drop following code js <script> $(function() { $('.sortable').sortable(); $('.handles').sortable({ handle: 'span' }); $('.connected').sortable({ connectwith: '.connected' }); $('.exclude').sortable({ items: ':not(.disabled)' }); }); </script> html <ul class="connected list"> <li>customer</li> <li>orders</li> <li>inventory</li> <li>shipping</li> </ul> <ul class="connected list no2"></ul> while drag , drop working want class in second "connected" box while dragging item on it. looking solution on unable find it. check jquery ui documentation droppable method used sortable. you can see example here .

Highcharts stacked column stackLabels do not show when axis is reversed -

Image
i'm having issue stacklabels not show on yaxis when reversed enabled. see fiddle; https://jsfiddle.net/mattscotty/vhv8p77v/2/ $(function () { var chart = new highcharts.chart( { chart: { renderto :'container', type: 'column' }, title: { text: 'stacked bar chart' }, exporting:{enabled:false}, credits:{enabled:false}, xaxis: { type: 'datetime' }, yaxis: { min: 0, max:100, reversed:true, //removing reversed fixes stack labels issue title: { text: null }, stacklabels: { enabled: true, style: { fontweight: 'bold', color: (highcharts.theme && highcharts.theme.textcolor) || 'gray' } } }, plotoptions:{

wso2esb - Dynamic xpath for the property creation in wso2 esb -

my requirement have create property based on xpath based on chaining. flow : 1)i calling service1 , based on response creating property mediator (svc1_property). 2)the call made service2 , response fetched service2 has list of values . 3) need fetch node response of svc2 based on xpath using property : svc1_property. config : expression="fn:concat("//imagelist[level='employee'][imagecaption='",$ctx:empname,"']/img_large")" scope="default" type="string" empname property created on svc1 use evaluate example: <property name="xpathexpr" expression="fn:concat('//',get-property('xpathexpression'))" scope="default" type="string"/> <property name="xpatheval" expression="evaluate($ctx:xpathexpr)" scope="default" type="string"/> you can find more infomation in blog.

swift - Cannot assign to property: function call returns immutable value -

consider following example. struct astruct{ var = 0 } class aclass{ var = 0 var a: = a(i: 8) func astruct() -> astruct{ return } } if try mutate the variable of instance of class aclass compiles successfully. var ca = aclass() ca.a.i = 7 but if try mutate return value of astruct method, compile screams ca.astruct().i = 8 //compile error. cannot assign property: function call returns immutable value. can explain this. this compiler's way of telling modification of struct useless. here happens: when call astruct() , copy of a passed you. copy temporary . can examine fields, or assign variable (in case able access modifications back). if compiler let make modifications temporary structure, have no way of accessing them back. why compiler programming error.

sql - PostgreSQL query to group consecutive days of week -

i trying write complex query , beginner in postgresql. here schema sample data , progress done far : http://sqlfiddle.com/#!15/e8b13/35 in schema no column primary key. my function takes argument course_no , execute query , returns json. my query should following: timeslots grouped isodow, start time , end time. consecutive week days grouped showing first-last week day(like mon-tue or mon-fri) json ordered start_timestamp min(start_timestamp) in first group in json. example of course_no 47 timeslots on monday 11:00-11:45: "[{"schedule":"mon 11:00-11:45","count_timeslots":47}]" a course_no 15 timeslots on tuesday 09:00-09:30 , 20 timeslots on thursday 10:00-10:45: "[{"schedule":"tue 09:00-09:30","count_timeslots":15},{"schedule":"thu 10:00-10:45","count_timeslots":20}]" a course_no 46 timeslots on mon, tue, , wed 09:00-09:30 , 23 timeslots on wed 1

c# - Handling multiple Multi-File Inputs in MVC -

i new mvc, , have issue can't seem resolve. have seen several articles on similar issues, nothing can make fit bill need achieve. i have mvc4 project, , need have multiple multi-file inputs on page, , need able distinguish between files submitted via input. i have seen this article suggested having multiple post action args, code seems handle them single list. here controller code : public actionresult projectdocuments(c4tbl_uploadedfiles c4tbl_uploadedfiles, ienumerable<httppostedfilebase> file1, ienumerable<httppostedfilebase> file2) { try { foreach (var file in file1) { if (file.contentlength > 0) { //handle first file list } } foreach (var file in file2) { if (file.contentlength > 0) { //handle second file list } } here vi

angular - Error: XHR error (404 Not Found) loading angular2/http -

i using angular-cli angular2 application. whenever try load angular2/http in components/services no error shows in cli terminal in browser's console shows - get http://localhost:4200/angular2/http 404 (not found) unhandled promise rejection: error: xhr error (404 not found) loading http://localhost:4200/angular2/http @ xmlhttprequest.desc.set.wrapfn [as _onreadystatechange] ( http://localhost:4200/vendor/zone.js/dist/zone.js:769:30 ) @ zonedelegate.invoketask ( http://localhost:4200/vendor/zone.js/dist/zone.js:356:38 ) @ zone.runtask ( http://localhost:4200/vendor/zone.js/dist/zone.js:256:48 ) @ xmlhttprequest.zonetask.invoke ( http://localhost:4200/vendor/zone.js/dist/zone.js:423:34 ) error loading http://localhost:4200/angular2/http "angular2/http" http://localhost:4200/app/js-tree.component.js ; zone: ; task: promise.then ; value: error: error: xhr error (404 not found) loading http://localhost:4200/ang

linux - Server Authentication failed (SVN / Jenkins) Maven release -

i have issue when releasing builds newly configured jenkins. whenever svn commit issued, runs error "server verification failed: issuer not trusted" i have tried multiple methods of svn checkout, svn list, etc. , permanently accept certificate information (fingerprint), no avail.. is there else can or can allow, without compromising on security disabling ssl? any appreciated. thank you. this sounds self-signed ca certificate in use. add self-signed ca certificate jenkin's jdk , jdk used build. $java_home/jre/lib/security/cacerts add ca jdk cacerts file

wcf data services - String ID in OData -

is there way use string ids in odata? for example, if have user entity, have ids this: "users/1" "users/123" etc... am limited protocol or cannot make work wcf? for now, m facing problem entity id: /dataservice.svc/users('users/1') as raises error. this blog post discusses @ length - in general it's considered not idea there security implications. http://blogs.msdn.com/b/peter_qian/archive/2010/05/25/using-wcf-data-service-with-restricted-characrters-as-keys.aspx

android - How to get the current fragment in a Preference Activity? -

i've implemented nfc scanner , when tag scanned onnewintent method gets called successfully, so: @override protected void onnewintent(intent intent) { setintent(intent); resolveintent(intent); } in resolveintent want update ui based on scanned tag. problem can't figure out how reference fragment. i thought use isvalidfragment method hold of fragment, no luck far: protected boolean isvalidfragment(string fragmentname) { if (fragmentname != null && !fragmentname.equals("")) { fragment f = getfragmentmanager().findfragmentbyid(r.id.myfragment); // null if (f != null && f instanceof myfragment) myfragment = (myfragment) f; } return preferencefragment.class.getname().equals(fragmentname) || generalpreferencefragment.class.getname().equals(fragmentname) || myfragment.class.getname().equals(fragmentname); } so, thing need reference current fragment, need check if myfrag

Use igraph with bigmemory in R -

i not able read bigmemory object in igraph in r class(mcalls) [1] "big.matrix" attr(,"package") [1] "bigmemory" callgraph <- graph.data.frame(mcalls) error in graph.data.frame(mcalls) : data frame should contain @ least 2 columns is there anyway read big.matrix datatype in igraph?

Android Studio cannot resolve support library name space -

i installed android studio on existing sdk latest android support library blank project open cannot resolve this: import android.support.v7.app.appcompatactivity; should do? check gradle file. must include (version may way): compile 'com.android.support:appcompat-v7:23.3.0'

clojure - What's an efficient way to store a chessboard in LISP? -

what's efficient way store chessboard in lisp example solve 8-queens puzzle? for 8 queens problem, most efficient storage going array of 8 bytes. clojure provides byte-array method simplify process of creating such array. treat each byte array of 8 bits, , use 0 empty square , 1 queen. this not work if intend use more 1 type of chess piece; additionally, should consider different approach if want variable board sizes.

javascript - Iterating through JSON objects -

i have little problem iterating through json objects. have json file ajax, have there 15 objects. in html have div in 3 sections: header, body , date. every 15 sec should update sections data json file. html: <div class="blog"> <span id="header"> blog </span> <span id="body"> 20+ best examples of <br> coming page design </span> <span id="date"> may 28, 2013 </span> </div> javascript: $(function() { $.ajax({ url: "news.json", success: function(result) { var headcont = $('#header'); var bodycont = $('#body'); var datecont = $('#date'); var res = result.news; $.each(res, function(index, element) { (header in res) { setinterval(function() { headcont.html(ele

r - Reorganising a data frame -

i have data frame 1 column , 158112 different values. values not ordered randomly. every 24 values represent 1 day. every day listed in there 18 times , followed next day, eg. 18x24 01.01.2012, 18x24 02.01.2012 , on. df 1 593 2 939 3 734 4 791 5 184 6 495 ... 158112 683 i want organise them in new data frame in different structure. process kind of this: take first 24 values , put them new data frame "new_df" column no. 1, take next 24 values , put "new_df" column no. 2, take next 24 values put "new_df" column no. 3. until 18 columns filled each 24 values , start again column no.1 , add next 24 values , on... @ end have "new_df" 18 columns , 8784 rows each. any ideas? i think want following: # sample data mydf <- data.frame(df=rnorm(18*8784,0,1)) # split dataframe chunks (of 18*24) mylist <- split(mydf,rep(1:366,each=432)) # turn each chunk matrix of right shape , `rbind` th

How to make two different modules in Android Studio use different versions of the same library via Gradle -

i have 2 modules in android app: app , library . app depends on library in library want use androidannotations 4.0.0 in app want use androidannotations 3.2.2 because upgrading 4.0.0 require enormous amount of changes, they've changed quite lot, , don't have time right now. however, ever since upgraded library use androidannotations 4.0.0 , usage of androidannotations in app behaves version 4, not version 3, makes me think gradle smart , ignored version 3 app , using version 4 both modules. how can enforce usage of 2 different versions of dependency in gradle? enforce use of dependency version on using force command build.gradle (app): dependencies { compile ('com.squareup.okhttp:okhttp:2.4.0') { force = true } ... } build.gradle (library): dependencies { compile 'com.squareup.okhttp:okhttp:2.3.0' ... } here excerpt docs if link goes invalid: allows forcing versions of dependencies, inc

php - how to display blob images -

Image
i trying insert & display multiple blob images because of mistake not appearing page , multiple images not getting saved, code follows: test1.php[inserting blob images]: $conn = mysqli_connect("localhost", "root", "root", "test"); for($i=0; $i<count($_files["userfile"]["name"]); $i++){ $imagename = mysqli_real_escape_string($conn, $_files["userfile"]["name"]); $imagedata = mysqli_real_escape_string($conn, $_files["userfile"]["tmp_name"]); $imagetype = mysqli_real_escape_string($conn, $_files["userfile"]["type"]); $image = file_get_contents($imagedata); $image = base64_encode($image); if($imagename!=''){ mysqli_query($conn, "insert files set mime = '".$imagename."', data= '".$image."' "); $result = array("insert_res"=>"110");