Posts

Showing posts from May, 2012

amazon sqs - Camel doesn't retrieve SQS messages attributes -

here route: from("aws-sqs://myqueue?accesskey=raw(xxx)&secretkey=raw(yyy)&deleteafterread=false") .log("attributes: ${header.camelawssqsattributes}") .process(new processor() { @override public void process(exchange exchange) throws exception { map<string, string> messageattributes = (map<string, string>) exchange.getin().getheader("camelawssqsattributes"); ... } }); the .log() shows empty map if print messageattributes processor. i tried header "camelawssqsmessageattributes" instead of "camelawssqsattributes" still nothing. i see attributes aws console though. way message body, , use camel 2.15 i figured out, here example queue attributes , message attributes: main.bind("sqsattributenames", collections.singletonlist("all")); main.bind("sqsmessageattributenames", collections.singletonlist("all")); or add objects regis...

c# - Cannot add 1 to LastIndexOf() method -

i have method gets substring based on last occurrence of forward slash character. path.substring(path.lastindexof('/'), path.length - path.lastindexof('/') ) given string the/quick/brown/fox , substring result of /fox . rid of forward slash character such fox result. i try add 1 lastindexof() method i'm getting argumentoutofrangeexception . path.substring(path.lastindexof('/') + 1, path.length - path.lastindexof('/')) the lastindexof() method returns int , why adding 1 cause error? have considered simpler string.split ? var str = "the/quick/brown/fox"; var result = str.split('/').last(); //result = "fox"

c# - HttpRuntime Cache stopped working -

i using httpruntime cache run piece of code every 30mins. site hosted in shared environment. working fine until last week. no code changed, stopped working. other "application started" email, haven't received other email. suggestion on how find issue? thanks. void application_start(object sender, eventargs e) { registercache(); sendemail("application started"); } private void registercache() { try { httpruntime.cache.add("dummy", "dummy", null, datetime.utcnow.addminutes(30), cache.noslidingexpiration, cacheitempriority.notremovable, new cacheitemremovedcallback(oncacheitemremoved)); } catch (exception ex) { sendemail(ex.message); } } public void oncacheitemremoved(string key, object value, cacheitemremovedreason reason) { try { ...

c++ - shared_ptr to std::vector of shared_ptr data destruction -

this question has answer here: how shared pointers work? 5 answers lets have function returns smart pointer vector of smart pointers data. shared_ptr<vector<shared_ptr<data>> getvectorptr(); auto vecptr = getvectorptr(); when vecptr goes out of scope , going destroyed shared_ptrs inside deleted? just knowledge: how smart pointer, internally, realizes went out of scope? when outer shared pointer goes out of scope (and reference count goes zero), destroys vector. vector in turns destroys elements (the inner shared pointers). when elements reference count goes 0 well, inner objects destroyed, too. so in case, destruction of inner elements depends on possible other references them.

java - apply escaping for regex matches -

i have such replacement statement output.replaceall(regex_brackets, "&lt;$2$3&gt;"); how apply escaping via ( stringescapeutils example) $2 , $3 ? here example of how can done inside matcher : string s = "word 123 text inside next 567"; stringbuffer result = new stringbuffer(); matcher m = pattern.compile("(\\w+)\\s+(\\d+)").matcher(s); while (m.find()) { string wrd = m.group(1); string num = m.group(2); string replacement = wrd.touppercase() + num; m.appendreplacement(result, replacement); } m.appendtail(result); system.out.println(result.tostring()); see ideone demo just use own functions, using touppercase() demo.

html - Bootstrap dropdown clipped by overflow:hidden container, how to change the container? -

using bootstrap, have dropdown menu( s ) inside div overflow:hidden , needed this. caused dropdowns clipped container. my question, how can solve clipping issue, e.g. change container of dropdowns inside project body , lowest cost possible? this example of code: http://jsfiddle.net/0y3rk8xz/ if interested in workaround this, bootstrap dropdown has show.bs.dropdown event may use move dropdown element outside overflow:hidden container. may capture position of dropdown container somehow , absolutely position based on them. $('.dropdown').on('show.bs.dropdown', function() { $('body').append($('.dropdown').css({ position: 'absolute', left: $('.dropdown').offset().left, top: $('.dropdown').offset().top }).detach()); }); there hidden.bs.dropdown event if prefer move element belongs once dropdown closed: $('.dropdown').on('hidden.bs.dropdown', function() { $('.bs-example...

laravel - How to paginate objects from a relationship -

Image
how can return same query pagination relacted produtos categoria? my model db : config model eloquent categoria : namespace app\models; class categoria extends modeldefault { protected $table = 'categoria'; public function produtos() { return $this->belongstomany('app\models\produto', 'categoria_produto', 'categoria_id')->withtimestamps(); } } config model eloquent produto : namespace app\models; class produto extends modeldefault { protected $table = 'produto'; public function categorias() { return $this->belongstomany('app\models\categoria', 'categoria_produto', 'produto_id')->withtimestamps(); } public function images() { return $this->hasmany('app\models\produtoimagem','produto_id', 'id'); } } my query produtos categoria : $produtosporcategoria = categoria::with(['produtos.images.im...

R - Reading vector or dataframe from string -

i read data frame string. bit difficult explain, and, far couldn't find answer anywhere. let's imagine have several data frames: "param1", "param2", ... "param100". able access them loop: for (i in c(1:100)){ <- paste0("param",i) b <- ??? (a) } where b become "param1", ... "param100" when i varies 1 100. use get . for (i in 1:100) { b <- get(paste0("param", i)) }

Query would run directly on MySQL but not through PHP -

i have simple mysql query select * tutor verified = 0 , alert_by < '2015-08-05' limit 0,1 now, running directly through phpmyadmin provides desired results, however, when query being executed through set of php statements, doesn't return anything. below code in php $this_date = date("y-m-d"); $query = "select * tutor verified = 0 , alert_by < '$this_date' limit 0,1"; $contact = mysqli_query($conn, $query); $row = $contact->fetch_array(mysqli_assoc); however, $row empty, can't seem figure out. know seems trivial, little annoying. note: removing "and alert_by < '$this_date'" query, works fine. check connection $con = mysqli_connect("localhost","my_user","my_password","my_db"); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } use mysqli_query $contact = mysqli_query($con,"select * t...

vb.net - visual studio 2010 installation and setting problems -

Image
i ve installed visual studio 2010. installed successfully, on main screen under file tag options are, team project , new file etc. when click on new file new screen appears in templates given. want vb.net there no vb.net template. whats wrong or how add vb.met template? shoud do? search under visual basics or in other templates below : and click on forms or type want

osx - a and not(b or c) with Apple Spotlight query -

https://developer.apple.com/library/mac/documentation/carbon/conceptual/spotlightquery/concepts/queryformat.html apple's dev dox provide info file metadata query expression syntax. the problem i'm having want 'a , not(b or c)' don't see how it. seems can 'a , ((not b) or (not c))' , that's not want. there's nice truth table generator here demonstrates problem: http://turner.faculty.swau.edu/mathematics/materialslibrary/truth/ i'm thinking it's not possible given spotlight supports, per dox. solved some details on problem i'm trying solve: want see email me outside company domain , not webex generated (it used meeting updates, etc.) ms outlook 2011 (mac) uses os x spotlight search engine filter email 'raw query'. the working query (thanks, renzo) is: com_microsoft_outlook_recpient_email_addresses == "jsmith@example.com" && com_microsoft_outlook_author_email_addresses != "*@example.com" ...

c# - Run stored procedure in a background Web Api -

in web api application need in topic: best way run background task in asp.net web app , feedback? in application user upload excel file , import data tables in database. works fine, import process can take long time (about 20 minutes, if excel have lot of rows) , when process started page blocked , users have wait time. need import process run in background. i have controller post method: [httppost] public async task<ihttpactionresult> importfile(int procid, int fileid) { string importerrormessage = string.empty; // excel file , read string path = filepath(fileid); datatable table = gettable(path); // add record start process in table logs using (var transaction = db.database.begintransaction())) { try { db.uspaddlog(fileid, "process started", "the process started"); transaction.commit(); } catch (exception e) { transaction.rollback(); ...

ruby on rails - displaying Active Directory high-res user photo -

i want display user's high-res photo uploaded in active directory. you can access photo after authentication visiting direct url (changed privacy): https://exchange.mycompany.org/ews/exchange.asmx/s/getuserphoto?email=name@mycompany.org&size=hr648x648 so, works after authentication: <img alt="userphoto" src='https://exchange.mycompany.org/ews/exchange.asmx/s/getuserphoto?email=name@mycompany.org&size=hr648x648'/> i totally understand why you'd want behind authentication there way access without authenticating? i tried download photos through curl, potentially upload them database: (no luck) curl -u domain\\username:password -o https://exchange.mycompany.org/ews/exchange.asmx/s/getuserphoto?email=name@mycompany.org&size=hr648x648 anyone have creative solution? i able run ruby script authenticate on backend using: system('curl -u username:password -o filename.jpeg url_of_photo') this downloaded photos l...

PyDev, Python: Error importing OpenCV when debugging -

i having problens debugging code. when use opencv importing cv2 following output: pydev debugger: process 8272 connecting connected pydev debugger (build 141.1899) traceback (most recent call last): file "c:\program files (x86)\jetbrains\pycharm community edition 4.5.3\helpers\pydev\pydevd.py", line 2358, in <module> globals = debugger.run(setup['file'], none, none, is_module) file "c:\program files (x86)\jetbrains\pycharm community edition 4.5.3\helpers\pydev\pydevd.py", line 1778, in run pydev_imports.execfile(file, globals, locals) # execute script file "c:/work/210 python/6 imagingsource/test.py", line 3, in <module> import cv2 file "c:\program files (x86)\jetbrains\pycharm community edition 4.5.3\helpers\pydev\pydev_monkey_qt.py", line 71, in patched_import return original_import(name, *args, **kwargs) importerror: dll load failed: die angegebene prozedur wurde nicht gefunden. so dll can not loaded. not...

twitter bootstrap - Change element text but leave inner span (or add span back) in jQuery -

i have bootstrap dropdown user selects "past", "this", or "next". <div class="btn-group dropup three" role="group"> <button type="button" class="btn btn-default dropdown-toggle" id="tpn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span> </button> <ul class="dropdown-menu fullwidth"> <li><a onclick="setpast()">past</a></li> <li><a onclick="setthis()">this</a></li> <li><a onclick="setnext()">next</a></li> </ul> </div> when option clicked calls appropriate function change text open button. example: function setpast(){ $('#tpn').text("past"); } however, function strips away span tag <span class="caret...

javascript - Twitter Image sharing for web applications (API?) -

hello making web application in users have upload images take twitter using integrated twitter image sharing button or function. have looked @ twitpic api, namely that, according website ( https://blog.twitpic.com/2014/10/twitpics-future/ ) discontinuing it. my question if there api or way in can have users share image twitter within browser window (so can done via mobile devices well)? so far have used twitter button creator , created normal tweet share, not support image sharing or cannot seem figure out how make support image sharing. yes, take @ twitter documentation uploading images . every modern twitter library able you.

HTTParty gives me 'Connection refused - connect(2) for "127.0.0.1" port 8881' in >= Ruby 2.0.0 -

this weird error. i'm in process of upgrading rails 3.2.21 app ruby 2. works fine, when want make http requests using httparty within rails, following error: errno::econnrefused: connection refused - connect(2) "127.0.0.1" port 8881 /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:879:in `initialize' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:879:in `open' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:879:in `block in connect' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/timeout.rb:67:in `timeout' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:878:in `connect' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:863:in `do_start' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:852:in `start' /users/stuart/.rbenv/versions/2.1.0/lib/ruby/2.1.0/net/http.rb:1369:in `request' /users/stuart/.rbenv/versions/2...

python - Multiplication between 2 lists -

i have 2 lists a=[[2,3,5],[3,6,2],[1,3,2]] b=[4,2,1] i want output be: c=[[8,12,20],[6,12,4],[1,3,2]] at present using following code problem computation time high number of values in list large.the first list of list has 1000 list in each list has 10000 values , second list has 1000 values.therefore computation time problem.i want new idea in computation time less.the present code is: a=[[2,3,5],[3,6,2],[1,3,2]] b=[4,2,1] c=[] s=0 in b: c1=[] t=0 s=s+1 j in a: t=t+1 k in j: if t==s: m=i*k c1.append(m) c.append(c1) print(c) use zip() combine each list : a=[[2,3,5],[3,6,2],[1,3,2]] b=[4,2,1] [[m*n n in second] m, second in zip(b,a)]

c# - How to bind text to my custom XAML control? -

i want bind dependencyproperty textbox, need create control allows me write text in property "letter" , sets text of textblock defined in template. i've never done before i'm not sure of how it. here's .xaml: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:my_app"> <style targettype="local:gameletter" > <setter property="template"> <setter.value> <controltemplate targettype="local:gameletter"> <grid> <image source="assets/imgs/letter_key.png"/> <viewbox margin="10,0"> <textblock x:name="textblock" fontfamily="assets/fonts/avenirnext.ttf#avenir next" text="{binding letter}" foreground=...

javascript - Function parameter used in jQuery selector -

i have event handler appends new row table. $("#pre_script_12").change(function() { $("#selected_pre_scripts") .append("<tr><td><a href='javascript:movescriptup(" + this.id + ")'>move</a></td></tr>"); movescriptup() looks this: function movescriptdown(id) { current = $("tr." + id).eq(1); $(current).prev().before($(current).next()); $(current).prev().before($(current).next()); } however, getting error when when appending id tr. . error: syntax error, unrecognized expression: tr.[object htmlinputelement] how can supply id parameter above javascript function without getting error when attempting use in jquery selector? you need quote strings in function call. right now, <a> tag looks this: <a href='javascript:movescriptup(pre_script_12)'>move</a> in (most) browsers, elements ids become gl...

angularjs - How to configure Eclipselink so that it returns no cache in response? -

i have problem angularjs + eclipselink app in ie. in every other browser working. when delete object list, ie edge shows still old list deleted object. have tried kill cache in angularjs side, no result ( $scope.rmas = rmaservice.query({cachekill : new date().gettime()}, function (data) )... i have tried disable cache whole eclipselink persistence unit, no luck or works partly. when delete object, disappears list, when come list page, still there again , deleted db. console.logs affect that, cause have heard ie doesn't console.logs :) @get @override @produces({"application/xml", "application/json"}) public list<rma> findall() { return super.findall(); }

Cost of implicit conversion from java to scala collections -

i'd know cost of implicit conversion java collection scala ones. in this doc there several implicit two-way conversions said "converting source type target type , again return original source object" . i conclude cost should minor (wrapping), still how it? i ask question because use java sets in scala code, implicitly converted scala set import asscalaset (i need in places). however, might consequent overhead little accessors such size() does know? i decided answer question practical point of view. used following simple jmh benchmarks test operations per second original scala collection , converted 1 (using implicit conversion). please find below code of benchmark: import org.openjdk.jmh.annotations._ import scala.collection.javaconversions._ @state(scope.thread) class wrapperbenchmark { val unwrappedcollection = (1 100).toset val wrappedcollection: java.util.set[int] = (1 100).toset[int] @benchmark def measureunwrapped: int = unwrappe...

image processing - Changing exposure of jpeg -

Image
given jpeg, formula change exposure of jpeg +/-1 stop or known 1 ev? want simulate exposure change. there formula/ method so? i can demonstrate using imagemagick, included in linux distros , available osx , windows here . first, @ terminal command line create image: convert -size 512x512 gradient:black-yellow gradient.png now, way effect +1 stop exposure increase composite image using screen blending mode - available in photoshop , imagemagick , described here . so, formula composite image a image b is: 1-stop brighter image = 1-(1-a)(1-b) but compositing image itself, a , b same, have 1-(1-a)(1-a) imagemagick refers pixels of image using p rather a , can 1-stop increase this: convert gradient.png -colorspace rgb -fx "(1-(1-p)(1-p))" result.png note wikipedia article, , imagemagick's -fx both assume pixel intensities vary between 0 , 1.0 . if using 8-bit images, should calculate 255 in place of 1 , namely +1 stop brighter ima...

textview - How to reduce the space around rating bar in android -

i have included rating bar in android, , need place text view immediate right if rating bar.but failed same since, there lot of unwanted space (rectangular blue box) around rating bar, prevents me placing textview immediate right side. there way reduce space around rating bar , both textview , rating bar comes in same line , textview placed next rating bar without gap.please me support! in advance! here xml code it. <ratingbar android:id="@+id/overall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="70dp" android:numstars="5" android:rating="0.0" android:scalex="0.4" android:scaley="0.4" android:stepsize="0.01" /> you can use android default styles, like: style="@android:style/widget.holo.light.ratingbar.small" in xml layout. using above , have no space around it. c...

javascript - EXT Multiple Paging Toolbars Only 1 Works -

my basic problem this, have page 3 grids, of have paging toolbars. grid render on page load. when page loads, 1 of 3 toolbars works. other 2 don't show page numbers, , buttons greyed out. i've tried can think of, if populate on page load, 1 works. if render separately, button click on page, toolbars work perfectly. has else had issue , solved it? multiple grid , multiple paging toolbar in single window on page load in extjs ext.onready(function () { var userstore = ext.create('ext.data.store', { autoload: 'false', fields: [ { name: 'name' }, { name: 'email' }, { name: 'phone' } ], data: [ { name: 'lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' }, { name: 'bart', email: 'bart@simpsons.com', phone: ...

ruby - Select a value from an array of hashes -

from array of hashes: response = [ {"label"=>"cat", "name"=>"kitty", "id"=>189955}, {"label" => "dog", "name"=>"rex", "id" => 550081} ] is there way write like: response.name.kitty to retrieve hash contains value: {"label"=>"cat", "name"=>"kitty", "id"=>189955} you can - response.select{|x| x["name"] == "kitty"}.first

mysql - Magento SQLSTATE[42S01] error -

i've been having problems magento site. crashed, , locked me out entering admin. contacted our host roll our db , nothing has changed. deleted tables errors suggested , cleared local cache , /var/cache/ , still nothing. have hundreds of products in db , don't want flush them out, how can fix this? error in file: "/home/sppower6/public_html/app/code/core/mage/admin/sql/admin_setup/install-1.6.0.0.php" - sqlstate[42s01]: base table or view exists: 1050 table 'admin_assert' exists, query was: create table admin_assert ( assert_id int unsigned not null auto_increment comment 'assert id' , assert_type varchar(20) null default null comment 'assert type' , assert_data text null comment 'assert data' , primary key (assert_id) ) comment='admin assert table' engine=innodb charset=utf8 collate=utf8_general_ci trace: 0 /home/sppower6/public_html/app/code/core/mage/core/model/resource/setup.php(645): mage...

Control running Python Process (multiprocessing) -

i have yet question python multiprocessing. have module creates process , runs in while true loop. module meant enabled/disabled python module. other module import first 1 once , run process. how better implement this? so reference: #foo.py def foo(): while true: if enabled: #do p = process(target=foo) p.start() and imagine second module that: #bar.py import foo, time def bar(): while true: foo.enable() time.sleep(10) foo.disable() process(target=bar).start() constantly running process checking condition inside loop seems waste, gladly accept solution lets me set enabled value outside . ideally prefer able terminate , restart process, again outside of module. understanding, use queue pass commands process. if indeed that, can show me how set in way can add queue different module. can done python or time abandon hope , switch c or java i purposed in comment 2 different approches : using shared variable multiprocessing.value ...

node.js - Hapi good logging depends on the enviroment -

is there way enable / disable depends on enviroment in ? for instance i'd run when node_env equal develepement var goodoptions = { opsinterval: 1000, reporters: [{ reporter: require('good-console'), events: {log: '*', response: '*' , error: '*' , request: '*'} }] }; server.register({ register: require('good'), options: goodoptions }, function(err) { if (err) { throw err; } } ); no ternary operator :) you add: if (process.env.node_env !== 'development') { goodoptions.reporters = []; } if start getting complex configuration should take @ hapijs/confidence powerful configuration tool. overkill though.

ios - Detection of sharpness of a photo -

i'm looking framework helps detecting sharpness of photo. have read this post points methodology of doing so. i'd rather work library getting hands dirty. in documentation of core image apple says: core image can analyze quality of image , provide set of filters optimal settings adjusting such things hue, contrast, , tone color, , correcting flash artifacts such red eye. 1 method call on part. how can 'analyze image quality' part? i'd love see example code. we did gpuimage framework (calculate brightness , sharpness): (here snippets might you) -(bool) calculatebrightness:(uiimage *) image { float result = 0; int = 0; (int y = 0; y < image.size.height; y++) { (int x = 0; x < image.size.width; x++) { uicolor *color = [self colorat:image atx:x andy:y]; const cgfloat * colors = cgcolorgetcomponents(color.cgcolor); float r = colors[0]; ...

ruby - In Rails model, can we not save an item if the table doesn't exist? -

i have several databases use records model. in model's after_save callback, creating new row in logtable . have like: class records < activerecord::base after_save :record_to_log def record_to_log new_log = logtable.new new_log.keyword = "keyword" new_log.save end end but not databases have logtable table. getting error says logtable doesn't exist. how prevent error, , there way abort save if table doesn't exist in particular database? you can check if table exists by activerecord::base.connection.table_exists? 'log_table' the callback can modified like after_save :record_to_log, :if => activerecord::base.connection.table_exists?('log_table')

excel - In VBA, I want to make an If statement for when more than one cell in a range contains a value -

so have following vba loop set up, want add line says "if there 2 cells within range have value, this. if there 3 cells within range have value, that." have far is: sub test1() dim rng range dim long = 3 application.screenupdating = true while <= 133 set rng = range("c" & i) if rng.offset(, 2).resize(, 7) <> "" rng.offset(, 1).formular1c1 = "blank" = + 1 else: stop end if wend end sub so have vba script print word "blank" appropriate cell if range empty. how can add more lines "if 1 cell in range contains value," or "if 2 cells in range contain value" here how can check if there more 1 non-empty cell in given range: if application.worksheetfunction.counta(rng.offset(, 2).resize(, 7)) > 1 few additional tips code: if know initial , final value of i should use for ... next loop instead of whi...

parse.com - React native image from Parse -

i trying add image parse react native project. ok adding text: <text style={{flex: 1, fontsize: 14, textalign: 'justify', color: 'black', }}> {this.props.tweet.get('username')} </text> but can not add image: <image source={this.props.tweet.get('photo')} style={{width: 50, height: 50}}/> i trying var photo = this.props.tweet.get('photoprofile'); ....code <image source={{uri: {photo}}} style={{width: 50, height: 50}}/> and var photo = this.props.tweet.get('photoprofile'); ....code <image source={photo} style={{width: 50, height: 50}}/> it not work. everything work!!! var imagefile = this.props.tweet.get('photoprofile'); var imageurl = imagefile.url(); ...code <image source= {{uri: imageurl}} style={{width: 50, height: 50}} />

c# - EF, Automapper exception, "Attaching an entity of type ... failed because another entity of the same type already has the same primary key value" -

i refactoring code using automapper, see below old code commented out. var propertyinuse = context.properties.firstordefault(j => j.id != src.propertyid && j.uprn.tolower() == src.uprn.tolower() && j.contractid == src.contractid); if (propertyinuse == null) { var property = context.properties.firstordefault(j => j.id == src.propertyid); if (property != null) { if (src.propertytypeid == 0) { src.propertytypeid = null; } src.created = property.created; src.createdby = property.createdby; src.contractid = property.contractid; mapper.createmap<job, property>(); property = mapper.map<property>(src); //property.propertyno = src.propertyno; //property.blockname = src.blockname; //property.streetname = src.streetname; //property.addressline2 = src.addressline2; //property.addressline3 = src.addressline3; //property.a...

php - can't print response data after sending guzzle `get` request -

i able to data wanted using postman after submitting url params: http://10.0.0.0/adserver/src/public?url=http://dummy.com but when tried sending same request guzzle: public function testgetads_test() { $client = new client(['base_uri' => $this->config['base_url']]); $response = $client->get('getads', ['query' => ['url' => 'http://dummy.com']]); $data = json_decode($response->getbody()); var_dump($response->getbody()); } i 200 dump prints insead of data got using postman : .object(guzzlehttp\psr7\stream)#41 (7) { ["stream":"guzzlehttp\psr7\stream":private]=> resource(226) of type (stream) ["size":"guzzlehttp\psr7\stream":private]=> null ["seekable":"guzzlehttp\psr7\stream":private]=> bool(true) ["readable":"guzzlehttp\psr7\stream":private]=> bool(true) ["writable":"...

Error in Autodesk API call through PHP with CURL -

i trying make call autodesk authentication api through php of curl continously getting false response. not sure wrong, can please suggest how call rest services of curl in php? my code - $url = 'https://developer.api.autodesk.com/authentication/v1/authenticate'; $data = array("client_id" => $consumer_key,"client_secret" => $secret_key,"grant_type"=>$grant_type); $ch=curl_init($url); echo $ch; $data_string = json_encode($data); echo $data_string; curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch,curlopt_httpheader,array('content-type'=>'application/x-www- form-urlencoded')); curl_setopt($ch, curlopt_postfields, array("customer"=>$data_string)); $result = curl_exec($ch); curl_close($ch); $data_return=array("result"=> $result); echo json_encode($data_return); output - {"result":false} i checked infor...

Can Visual Studio 2015 Community Edition perform SQL debugging from unit tests? -

environment: visual studio 2015 community edition (final release version) under windows 8.1 64-bit. i'm using sql server data tools develop t-sql stored procedures , deploy them sql server 2014 localdb. i have project c# unit tests, calling these stored procedures through ado.net. "enable sql server debugging" turned-on under project's properties / debug. in earlier versions of vs, put breakpoint in t-sql code, start debugging c# unit test , hit t-sql breakpoint when gets called via ado.net. vs2015 community doesn't - no error, silently ignores t-sql breakpoint , continues stepping through c# code. does know: specific limitation of community edition, available in "higher" editions? or oversight may fixed in future? references documentation or developer blogs (or similar) appreciated - seem unable find any... yes, have working in visual studio 2015 community (though i'm calling sql via web project, not unit test project). th...

function - Unzip with powershell does not work -

here code : $e = "d:\users\myname\desktop\folder\ghjkl.zip" $f = "d:\users\myname\desktop\folder\zipfiles" function expand-zipfile($file, $destination) { $files = (get-childitem $file).fullname $shell = new-object -com shell.application $files | %{ $zip = $shell.namespace($_) foreach ($item in $zip.items()) { $shell.namespace($destination).copyhere($item) } } } expand-zipfile $e $f it returns no error there nothing in "zipfiles" folder what wrong ? thanks finally, i've changed .rar .zip testing code. file corrupted, script stopped when unzip asked thanks answers

java - Check Style Indentation violation - 'public' have incorrect indentation level 4, expected level should be 8 -

i getting checkstyle sonar violation on indendation rule (com.puppycrawl.tools.checkstyle.checks.indentation) 'public' have incorrect indentation level 4, expected level should 8. at line public response getitem(@pathparam(code) final programcode programcode, in intelliji, kindly suggest on how change indentation level 8 open preferences (cmd + , on mac, ctrl + alt + s on windows), , go editor -> code style -> java. on tabs , indents spaces can set indents 8.

ios - Status bar hiding when landscape-only view controller is presented over portrait-only view controller -

Image
i have navigation controller holding view controller supports portrait orientation: this presents full-screen view controller supports landscape: unfortunately during transition, status bar on presenting view controller removed, makes content jerk before transition begins. i've implemented custom fade transition make effect obvious: note status bar not present. done before custom transition starts, no animation, if take snapshot before transition begins , add container view, still see reduced navigation bar momentarily. is there non-terrible way fix this? don't want have add snapshot outside of transition (like this answer ). i have tried making presentation style custom instead of full-screen, doesn't leave device in portrait orientation. solution using custom presentation style leaves device in landscape orientation acceptable. there sample project demonstrating problem here may horrible hack if view jerking bothers rather status bar disapp...

java - DELETE facebook post using FQL -

i using facebook4j api connecting facebook. aim fetch , delete posts posted on wall friends. searching fql (delete query) facebook post. question : delete facebook posts java using fql or other technique you can delete facebook wall post using graph api, here documentation available.

asp.net mvc - redirecting using roles not working -

[validateantiforgerytoken] [httppost] [allowanonymous] public async task<actionresult> index (loginmodel model, string returnurl) { if (modelstate.isvalid) { var loginbusiness = new loginbusiness(); var result = wait loginbusiness.loguserin(model, authenticationmanager); var rolemanager = new rolemanager<microsoft.aspnet.identity.entityframework.identityrole>(new rolestore<identityrole>(new datacontext())); var role = await rolemanager.roleexistsasync(model.username); if (returnurl == null && role) { if (user.identity.isauthenticated && roles.isuserinrole(model.username, "admin")) { return redirecttoaction("index", "admin"); } else if (user.identity.isauthenticated && roles.isuserinrole(...

jquery - Is it possible to edit the contents of a <script type="text/template"> with JavaScript? -

here's example of i'm trying edit: <script id="login-popup" type="text/template"> <h3 id="cover-msg" class="modal-title">you need login that.</h3>` </script> i add: class="title" h3 tag. being done via chrome extension, can't control html rendered. here's caveat: can't assume template same, can't replace or edit entire thing. need able select elements within text , add things needed. the problem i'm having template seems plain text. can't select #login-popup #cover-msg . please correct me if i'm wrong. is possible javascript/jquery? you can follow type of procedure gets text out of script tag, inserts dom element can use dom manipulation on it, gets resulting html out of dom element. allows avoid manual parsing of html text yourself: var t = document.getelementbyid("login-popup"); var div = document.createelement("div"); div.in...

Route web Node.js + Vagrant + Nginx -

i have 3 instances of coreos in vagrant. in 1 of them have docker container node.js , other mongodb. node.js container has nginx configured , working if wget in container , in instance of coreos. question if have configure more show website in navigator, because can´t. may have put router or else in vagrant? first of all, want point out should apply seperation of concern, , split out nginx , node in seperate containers each responsible own tasks. that leave nginx container, node container , mongodb container need link. can done in multiple ways. 1 of them bind port container exposing either hosts private or public ip address, , port on address. that, in normal coreos setup should enable view webserver through ip address of host , port bound container port on. however, since vagrant ports should mapped too, have map 'real' hosts port, port on host. steps achieve example: 1. map port 80 of localhost coreos vagrantboxes providing configuration in vagrantfile:...

android - Google App Engine Tutorial, 403 Forbidden: BadAuthentication on upload data -

i following guide at: https://cloud.google.com/solutions/mobile/how-to-build-mobile-app-with-app-engine-backend-tutorial/ using android studio. i have followed tutorial beginning 'populate datastore data'. i navigated correct directory, ran gcloud auth login terminal, , logged in via browser created. attempted run first command given: /home/xxxx/google_appengine/appcfg.py upload_data --config_file bulkloader.yaml --url=http://mobileassistant-1026/remote_api --filename places.csv --kind=place -e xxxxxxx@gmail.com where xxxxs username , email address respectively. the terminal returns (with me entering password half way): 12:25 pm uploading data records. [info ] logging bulkloader-log-20150805.122507 [info ] throttling transfers: [info ] bandwidth: 250000 bytes/second [info ] http connections: 8/second [info ] entities inserted/fetched/modified: 20/second [info ] batch size: 10 password xxxxxxx@gmail.com: error 403: --- begin server output ---...

javascript - Jasmine spy expects to be called with "Object(...)" -

i completing migration jasmine 1.3 2.0. far have refactored of code comply 2.0's newer syntax. however, kind of tests still failing. in short, test looks this: var obj = new customcriteria(); spyon(my, "function"); my.function(obj); expect(my.function).tohavebeencalledwith({ big: "fat object" }); my customcriteria class: var customcriteria = function() { this.big = "fat object"; }; the test fails following: expected spy function have been called [ object({ big: "fat object" }) ] actual calls [ ({ big: "fat object" }) ]. note how expectation has " object " wrapping around it, second not. test did not fail in < 2.0 of jasmine, failing after update jasmine. how can fix this? update: tinkered around creating new object via new ing function vs. object literal syntax, , appears __proto__ s different. perhaps affects jasmine's equality comparison? prior version 2, objects equal if have ...

java - ADF - Error using View Object -

i trying programmatically use view object select/update/insert rows. class being used not directly use data control, viewobjectimpl directly. so when following line: rowsetiterator rowset = vo.createrowsetiterator(null); the following exception thrown: javax.servlet.servletexception: jbo-25036: invalid object operation invoked on type view object name can view object impl class used without data control? this valid code should work vo: rowsetiterator rowset = vo.createrowsetiterator(null); the fact doesn't it points towards problem vo definition itself. try querying vo bc tester, see if works.

c# - Async threadsafe Get from MemoryCache -

i have created async cache uses .net memorycache underneath. code public async task<t> getasync(string key, func<task<t>> populator, timespan expire, object parameters) { if(parameters != null) key += jsonconvert.serializeobject(parameters); if(!_cache.contains(key)) { var data = await populator(); lock(_cache) { if(!_cache.contains(key)) //check again locked time _cache.add(key, data, datetimeoffset.now.add(expire)); } } return (t)_cache.get(key); } i think downside need todo await outside lock populator isnt thread safe, since await cant reside inside lock guess best way. there pitfalls have missed? update : version of esers answer threadsafe when antoher thread invalidates cache public async task<t> getasync(string key, func<task<t>> populator, timespan expire, object parameters) { if(parameters != null) key += jsonconvert.serializeob...