Posts

Showing posts from July, 2010

c++ - No MYSQL Connect with QT CREATOR libmysqlclient_16 -

i've started programming in c++ qt 5.4 i'm having problems when making connection mysql. iseem have problems driver. os: ubuntu 14.04 qt version > 5.1 this error: "can not load library /home/diana/qt5.1.1/5.1.1/gcc_64/plugins/sqldrivers/libqsqlmysql.so : ( /usr/lib/libmysqlclient_r.so.16 : version ` libmysqlclient_16 'not found (required /home/diana/qt5.1.1/5.1.1/gcc_64/plugins/sqldrivers/libqsqlmysql.so ) ) " ( " qsqlite " " qpsql " " qpsql7 " ) driver not found .pro file: qt + = core gui qt + = sql qtplugin + = qsqlmysql main.cpp #include "mainwindow.h" #include <qapplication> #include <qtwidgets> #include <qtsql> #include <qsqldatabase> #include <qsqldriver> #include <qsqlerror> #include <qsqlquery> #include <qsqldrivercreator> #include <qsqldriverplugin> #include <qtplugininstancefunction> #include <qpluginloader> #include &l

Exceed evaluation depth when forward function in Emacs Lisp -

here simplified code snipped have not managed work. not understand wrong. (defun enumerate-indicies (func) (let ((index 0)) (while (< index 5) (funcall func index) (setq index (1+ index))))) (defun enumerate-multiplied-indicies (func) (enumerate-indicies #'(lambda (index) (funcall func (* 10 index))))) the following testing code returns 10 expected: (defun test/enumerate-indicies () (let ((sum 0)) (enumerate-indicies #'(lambda (index) (setq sum (+ sum index)))) sum)) (test/enumerate-indicies) but below causes error lisp nesting exceeds max-lisp-eval-depth in emacs: (defun test/enumerate-multiplied-indicies () (let ((sum 0)) (enumerate-multiplied-indicies #'(lambda (index) (setq sum (+ sum index)))) sum)) (test/enumerate-multiplied-indicies) could please give clue? not s

html - Grunt w3c validation plugin usage -

i trying validate simple html file using w3c validator plugin in grunt. giving me unexpected identifier error on line 33 . not understand wrong. figured out how use grunt-html-validation plugin, can not grunt-w3c-validation plugin work. html trying validate: <!doctype html> <html> <head> <title> see </title> </head> <body> <p>ok</p> <div>whatever</div> <span>why</span> <p>why </p> </body> </html> gruntfile.js module.exports = function (grunt) { grunt.initconfig({ jade: { compile: { files: { "html/calculator.html" : "jade/calculator.jade" } } }, sass: { compile: { files: { "css/calculator.css": "sass/calculator.sass" } }

angularjs - Problems with making a grid behave similar to itunes/google drive -

this first post - thank in advance advice. please refer mockup picture: http://i.imgur.com/9wumgdd.jpg this page similar itunes behavior-wise. have left hand side bar library, playlists organized in folders, , grid. i have having trouble actual grid. using angular grid , running many obstacles standard behaviors , limitations. there better grid (plug-in?) start if need itunes/google drive features - drag+drop, infinite scrolling itunes/google drive, , click controls similar itunes (single click select, double click activate)? or have go custom? thank much. daniel kurganov daniel.kurganov@gmail.com you can check out treegrid directive . native angularjs directive many features including drag-drop. as drag-drop between treeview , treegrid, there sample available here: drag drop between treegrid , treeview

Send files with Connect:Direct from HP NonStop (OSS) to UNIX -

have have worked connect:direct hp nonstop? wish make transmission of file located in 'oss' hp nonstop unix. connect:direct run through ndmcom in guardian90 can not interpret route home oss, have idea of missing script reconnoitre route of oss? below add script , messages received execution of process. my process: send process snode=test.hptest snodeid=(user,passwd) step01 copy (file=/home/sat/origen.txt - sysopts=":datatype=binary:" – pnode) - (file='/home/user/destino.txt' - sysopts=":datatype=binary:" - disp = rpl snode) messages: **xsmg622i: (rc=8, fdbk="0") exception response received during process exec. exception response received remote node during process execution. system action: copy step aborted. response: check condition of copy step , resubmit copy step. **sflh055i: (rc=8, fdbk=&

How to downgrade Bootstrap 3 to 2 -

i using bootstrap 3.3.2 can not run on ie7,8 need downgrade version 2. how can that? thanks ton. well, go download necessary files version 2 (using http://getbootstrap.com/2.3.2/ going quite helpful) , set site use in place of 3.x assets. major-version change, there's going breaking functionality on place. things changed lot 2.x 3.x, you're going have make lot of syntactic changes in code match 2.x docs. there isn't "downgrading" guide published, log @ https://github.com/twbs/bootstrap/releases may you.

How to parse through JSON object in Python -

i know there tons of exact question on here can't find answer. i'm trying use google maps api geocoding go through list of sloppy addresses, , formatted addresses. i have exact code google documentation: import urllib2 address="1600+amphitheatre+parkway,+mountain+view,+ca" url="https://maps.googleapis.com/maps/api/geocode/json?address=%s" % address response = urllib2.urlopen(url) jsongeocode = response.read() it says jsongeocode json object. however, i've gathered looking online not json object yet. if i'm wrong here , json object, how parse it? if call print(jsongeocode) prints appears json object proper attributes in terminal. so try convert jsongeocode object json object: jdata = json.load(jsongeocode) this gives me error: attributeerror: 'bytes' object has no attribute 'read' edit i've switched json function call jdata = json.loads(jsongeocode) , error this: typeerror: json object must str, no

HTML & CSS: Centering the Navbar -

i've looked other people have had similar problems can't seem find answer works me. i'm trying center nav bar keeps getting pushed off left. appreciated! thanks. body { background-color: rgb(222, 243, 246); /* background-image: url("capitola.jpg"); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: contain; margin: 0; padding: 0; border: 0; */ } div.image { background-image: url("capitola.jpg"); background-repeat: no-repeat; background-attachment: fixed; background-position: center; background-size: 100% 100%; margin: 0; padding: 0; border: 10 solid #021a40; position: absolute; height: 100%; width: 100%; } div#wrapper { position: fixed; text-align: center; z-index: 1000; margin: 0 a

java - Punycode for Unicode query parameter -

i trying encode unicode urls punycode. these urls have query parameter contains non-ascii characters, example: https://en.wiktionary.org/w/index.php?title=clœlia&printable=yes the problem is, when try in java, resulting url wrong: string link = "https://en.wiktionary.org/w/index.php?title=clœlia&printable=yes"; link = idn.toascii(link); // -> link = http://en.wiktionary.org/w/index.xn--php?title=cllia&printable=yes-hgf if way, resulting string different (i don't know why), wrong: string link = "http://en.wiktionary.org/w/index.php?title=" + idn.toascii("clœlia") + "&printable=yes"; // -> link = http://en.wiktionary.org/w/index.php?title=xn--cllia-ibb&printable=yes if copy address chrome , paste here, url, want: https://en.wiktionary.org/w/index.php?title=cl%c5%93lia&printable=yes what did wrong here? what did wrong use punycode. punycode used domain names, including domain-name part

html - Reorder column stack in different screen size -

Image
say in bootstrap or foundation, possible achieve layout? you see problem here? top column should @ bottom when in tablet size. push/pull trick isn't applicable here because different type of column reordering. you have ideas? you can use order property in css flex-boxes. https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties#order check browser compatibility here http://caniuse.com/#search=order

php - how mySql Data store in unique excel file that should be created dynamically -

i have web page in user given input methods fetch data database. data displayed on web page. i want store data user fetched data s-q-l database excel file. command i'm using given below $excelquery1="select * excel12 outfile 'd:/downloads/xyz.csv'"; $excelresult1=mysql_query($excelquery1); it running ok , data being fetched stored in new file created in downloads folder name xyz.csv but user have go manually location check file. how possible user must shown downloaded file in download bar. + want ask if xyz.csv present in location when query execute in scenario query won't execute saying file present . how tackle problem ? how give unique file name file created.. this main idea. need adequate code need $file="/path/to/file".date("ymdhis").".csv"; //file location header('content-type: application/octet-stream'); header('content-disposition: attachment; filename="'.basename($file).&#

csv - How to .write() two items, a zero and an iterator in Python? -

i may have simple formatting question here - hrout.write('0',i) in order add/preface 0 'i' timestamp, don't know correct syntax. code below. thank all. hrin = open('hrsinput.csv') hrout = open('hrsoutput.csv', 'wt') in hrin: if len(i) < 5: hrout.write('0', i) else: hrout.write(i) hrin.close() hrout.close() ** found padding technique works. may have been tricked excel because in notepad padding shows up. hrin = open('hrsinput.csv') hrout = open('hrsoutput.csv', 'wt') in hrin: hrout.write("{}\n".format(i.rstrip().zfill(5))) hrin.close() hrout.close() use str.format: hrout.write('0{}'.format(i)) or remove if/else , pad: for in hrin: hrout.write("{}\n".format(i.rstrip().zfill(5))) zfill add 0 times 4 characters: in [21]: "12:33".zfill(5) out[21]: '12:33' in [22]: "2:33".zfill(5) out

c# - How do I display the first item in my ComboBox based on my dataBinding? -

xaml: <combobox grid.row="1" name="cmbclasse" grid.column="3" margin="5,5,5,5" itemssource="{binding datacontext.classeses}" selectedvaluepath="classeid" displaymemberpath="classename" selectedvalue="{binding datacontext.currentselectedpersonagem.idclasse, mode=twoway}"/> when open application, combobox not have display default item. item list working, have items on it. please help, if image needed ask. thanks. here method use time. firstly, view model should have 2 properties, 1 represent collection, , other represent selected item. public ienumerable<yourobject> myobjects { get; private set; } public yourobject selectedobject { get; private set; } note: idea use observablecollection myobjects , , implement inotifypropertychanged . use only if ne

Writing to an External File on Android --- File Doesn't Register, But Java Can Read -

i'm trying write external txt (or csv) file android. can run app, close it, , run again, , readdata() read log i've stored. however, dirfile (file directory) appears within android files (even if connect computer , search). something interesting, though: if clear log (similar list of print statements shown within eclipse) , disconnect phone computer, reconnect it, log reappears i've ever written file (even if later overwrote it)...yet app isn't running! here code. please me understand why cannot find file! (note: i've tried appending "myfile.txt" extension directory, causes eisdir exception.) public void writedata(string dirname){ try { file root = new file(getexternalfilesdir(null), dirname); // writes file // // "true" argument allows file appended. without argument (just root), // file overwritten (even though later call append) rather appended to. filewriter writer = new f

php - How to remove all simple product in the cart Woocommerce -

how remove simple product in cart when click on button: // add item cart on visit depending on cart total value add_action( 'init', 'add_product_to_cart' ); function add_product_to_cart() { if ( isset($_post['mix']) && !empty($_post['mix']) && isset($_post['mix_name']) && !empty($_post['mix_name']) ) { global $woocommerce; $addcart = $woocommerce->cart->add_to_cart( $product_id = 700, $quantity=1, $variation_id= '', array('attribute_strain' => 'sativa', 'attribute_level' => 'cbd', 'attribute_flavor' => 'flower shop') ); foreach ($woocommerce->cart->cart_contents $cart_item_key => $values) { $_product = $values['data']; //find simple product type remove if($_product->product_type == 'simple') { unset($woocommerce->cart->cart_contents[

r - Generate a pandoc table without repeated values -

i use pander generate pandoc style tables, need suppress repeated values of variables example: ta <- data.frame(class=c(rep("c1" ,3), rep("c2", 6)), name=rep(c("l", "v", "c"), each=3), num=rpois(9, 10)) pandoc.table(ta) the output is -------------------- class name num ------- ------ ----- c1 l 15 c1 l 11 c1 l 8 c2 v 7 c2 v 7 c2 v 5 c2 c 12 c2 c 9 c2 c 12 -------------------- and like -------------------- class name num ------- ------ ----- c1 l 15 11 8 c2 v 7 7 5 c 12 9 12 -------------------- the problem similar removing locally repeated

R how to find maximum value by a primary key and removing duplicates -

this question has answer here: how select row maximum value in each group 7 answers i have dataset below , want reduce removing rows. in situation have more 1 attach value same exact combination of first 3 columns, want keep rows have maximum attach value bom = c(rep("bom1", 1), rep("bom2", 2), rep("bom3", 3)) part = c(rep("a", 3), rep("d", 3)) ww = c(rep("ww01",3),rep("ww05",1),rep("ww06",2)) attach = c(1,4,8,2,2,4) df1 = data.frame(bom,part,ww,attach ) the final output have row numbers 1,3,4,6 , remaining rows deleted you can dplyr: library(dplyr) df1 %>% group_by(bom, part, ww) %>% summarise(attach = max(attach)) source: local data frame [4 x 4] groups: bom, part bom part ww attach 1 bom1 ww01 1 2 bom2 ww01 8 3 bom3 d ww05 2 4 bom3

gcc - Ambiguous reference to variable -

so doing 2 modules linking main program. first 1 has variables defined in , second 1 functions. module1: module zmienne implicit none integer, parameter :: ngauss = 8 integer, parameter :: out_unit=1000 integer, parameter :: out_unit1=1001 integer, parameter :: out_unit2=1002, out_unit3=1003 real(10), parameter :: error=0.000001 real(10):: total_calka, division,tot_old,blad real(10),parameter:: intrange=7.0 real(10),dimension(ngauss),parameter::xx=(/-0.9602898565d0,& -0.7966664774d0,-0.5255324099d0,-0.1834346425d0,& 0.1834346425d0,0.5255324099d0,0.7966664774d0,0.9602898565d0/) real(10),dimension(ngauss),parameter::ww=(/0.1012285363d0,& 0.2223810345d0,0.3137066459d0,0.3626837834d0,& 0.3626837834d0,0.3137066459d0,0.2223810345d0,0.1012285363d0/) real(10) :: r, u, r6, tempred, f, r2, r1, calka,beta real(10) :: inte real :: start, finish integer:: i,j,irange real(10),dimension(ngauss)::x,w,integrand end module zmienne module2 mo

Calculating taxable income and tax rate using asp.net, html and c# -

my goal here compute federal income tax based on taxable income using asp.net, c# , html. below i've coded far. summary: user inputs annual income , number of dependents via text boxes. there $1000 deduction every dependent. taxable income = annual income – (number of dependents * 1000). need multiply taxable income tax rate. i having difficulties calculating value of taxable income, , still need code calculate button it's job. taxable income range , tax rate: >450000 -- 39.6%. >378000 , <=450000 -- 33%. >192000 , <=378000 -- 28%. >71000 , <=192000 -- 25%. >15000 , <=71000 -- 15%. <=15000 -- 10%. <%@ page language="c#" autoeventwireup="true" codebehind="form1.aspx.cs" inherits="webapplication1.form1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> </head> <body> <form id="form1" runat="s

ruby on rails - Why do I keep getting 'undefined method' when it's worked fine before? -

my orderscontroller follows below, keep getting message: undefined method `listing_id=' # extracted source (around line #31): 29 30 31 @order.listing_id = @listing.id is there doing incorrectly? following tutorial followed instructions, when wasn't working decided copy , paste, , it's still not working. please, appreciated. full code follows class orderscontroller < applicationcontroller before_action :set_order, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! def sales @orders = order.all.where(seller: current_user).order("created_at desc") end def purchases @orders = order.all.where(buyer: current_user).order("created_at desc") end # /orders/new def new @order = order.new @listing = listing.find(params[:listing_id]) end # post /orders # post /orders.json def create @order = order.new(order_params) @listing = listing.find(para

ios - Keeping a view controller in it's state after you leave and come back to it- Swift -

right have 2 view controllers, , when gather data second view controller display in label in first view controller (a random integer): var firstinteger = //random integer override func viewdidload() { super.viewdidload() totalamount.text = string(firstinteger) this works fine, when user goes second view controller , gets new random integer, want add integer first 1 gathered, many times user goes second view controller , "gets" new integer- decided this: var firstinteger = //random integer var newinteger = 0 override func viewdidload() { super.viewdidload() totalamount.text = string(firstinteger + newinteger) newinteger = firstinteger + newinteger but know doesn't work, since everytime user go first view controller, reset newinteger's value 0- know how fix this? you need declare newinteger static class myclass { static var newinteger = 0 } this create 1 variable newinteger @ class level (or type level swift calls

mysql - Join Only Rows that Match A Certain Condition SQLAlchemy -

i have 2 tables: a , b b has foreign key a , b has timestamp field. a has timestamp field. interested in difference between timestamp fields rows in a , corresponding row in b earliest time stamp. how compute value every row in a? for example: a row in a might have 5 rows in b (5/1/2015, 2/3/2014, 2/3/2013). interested in time difference row timestamp of 2/3/2013. we can join each entry , build table not seem correct approach. edit: sorry, should have been more specific. using sqlalchemy orm. add where b.timestamp = (select min(timestamp) b. x x.id = b.id) this give min timestamp record.

java - Regarding Final Rethrow -

i read in documentation of precise rethrow that, http://www.theserverside.com/tutorial/ocpjp-use-more-precise-rethrow-in-exceptions-objective-java-7 basically, can list specific exceptions in throws clause of method, if not explicitly handled catch block if: the try block throws specific exception @ point in time. the specific exception isn't handled @ point preceding catch block the exception named in throws clause of method signature must on class hierarchy of @ least 1 exception being handled , rethrown catch block (subtype or supertype) have @ code (attention on throws clause of main ) class openexception extends exception {} class closeexception extends exception {} public class prethrow { public static void main(string args[]) throws openexception, closeexception, java.io.ioexception { boolean flag = true; try { if (flag) { throw new openexception(); }

Excel: Can you open a single workbook in two windows? -

working in multi-monitor environments many worksheets in single book, default, opening workbook direct existing instance of workbook. since tabs orient when monitors of same size, there way open multiple instances each monitor can have own arrangement of tabs , worksheets? you have open 2 instances of microsoft excel, when open microsoft excel have book1 open in first windown , open instance of microsoft excel double clicking on microsoft excel icon open book2. can move windows in split screen, mean have book1 open in first monitor , book2 open in second monitor. drag , drop excel files in whichever monitor want. hope helps.

gdb - How to pass SIGINT to child process with Python subprocess.Popen() using shell = true -

i trying write (python 2.7.3) kind of wrapper gdb, allow me dynamically switch scripted input interactive communication gdb. so far use self.process = subprocess.popen(["gdb vuln"], stdin = subprocess.pipe, shell = true) to start gdb within script. ( vuln binary want examine) since key feature of gdb pause execution of attached process , allow user inspect registers , memory on receiving sigint (strg+c) need way pass sigint signal it. neither self.process.send_signal(signal.sigint) nor os.kill(self.process.pid, signal.sigint) or os.killpg(self.process.pid, signal.sigint) work me. when use 1 of these functions there no response. suppose problem arises use of shell=true . however, @ point out of ideas. old friend google couldn't me out time, maybe can me. thank's in advance. cheers, mike i looked deeper problem , found interesting things. maybe these findings in future. when calling gdb vuln using suprocess.popen() in fact cre

How to dynamically inject modules and services into app and controllers in AngularJS? -

i have app decides if needs specific set of modules inside of application run block. (removed unnecessary logic) angular.module('myapp', []).run(function () { if (true) { //needs have modules injected myapp } }); how can add modules myapp, after angular app has initiated? once module injected dynamically, how can use injected module's services in other places of app, controllers , directives? angular.module('myapp').controller(function ($scope, myservice) { //where myservice belongs dynamically added module myservice.dostuff(); //this give me error if module wasn't injected }); i know it's possible add modules inline array annotation, checking if myservice exists, inside of controllers. i'm trying correct way, instead of having check myservice, thought-out whole code base. i appreciate help! you can explicitly bootstrap application module after determining need. var modulestoinject = ["mydep1"];

Make JSON payload fields case insensitive when mapping to Java Object in REST API developed using SpringBoot -

i working on rest api developed using springboot application. here want make fields in payload(json) case insensitive when mapping java object. below code. payload {"limit":1,"name":"matthew phillips"} request object private string limit; private string name; public string getlimit() { return limit; } public void setlimit(string limit) { this.limit = limit; } public string getname() { return name; } public void setname(string name) { this.name = name; } i map json payload java object directly using @requestbody spring annotation. question here how make java object map fields ignoring case. regards, rakesh maybe need write custom deserializer ignore case sensitivity. does this answer question?

javascript - How to prepend a specific string to a select option in a HTML form -

i have simple html form dropdown list name of images saving selecting database: <form name="htmlform" method="post" action="html_form_send.php"> <table width="450px"> <select name="rating"> <option value="image1">image1</option> <option value="image2">image2</option> <option value="image3">image3</option> <option value="image4">image4</option> </select> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="submit"> </td> </tr> </table> </form> what want save whole path of image without showing path user, append static path of selections of user when press submit e.g. prepend: “path/to/my/fil

javascript - What's the difference between a regular js int and one from jquery.val()? -

i'm using script called countup.js increments integer in animated way until reaches it's desired amount. here code: html: <h2 id="countup-1">2500</h2> js var theval = 5000; var demo = new countup("countup-1", 0, theval, 0, 2.5); demo.start(); this animates counter 0 5000. perfect. but want animate value in h2 tag (2500). tried this. var theval = parseint($('#countup-1').val()); var demo = new countup("countup-1", 0, theval, 0, 2.5); demo.start(); but error: "uncaught typeerror: c.match not function" how be? i'm sending int countup function in both cases? set fiddle here: https://jsfiddle.net/0yawm9jr/ $('countup-1').val() doesn't exist (there no value attribute on specific element). try (see working jsfiddle ): var theval = 5000; var demo = new countup("countup-1", 0, theval, 0, 2.5); demo.start(); var theval2 = parseint($('#countup-2').html()

Rails 4: (acts as taggable) creating a tag cloud based only on a specific users posts -

i attempting create tag cloud based on users microposts (obvious counts on each tag user) using in controller @tags = @user.microposts.tag_counts_on(:tags) and in view <% tag_cloud @tags, %w[xxs xs s m l xl xxl] |tag, css_class| %> <%= link_to tag, questions_by_tag_user_path(@user, tag: tag.name), class: css_class %> <% end %> the problem is, having checked on , over, returning tag cloud sizes based on tag counts based on microposts , not ones @user. i can't see why , documentation deprecated: user.find(:first).posts.tag_counts_on(:tags) any thoughts? this work, if call tag_counts_on on posts scope: post.where(user_id: 1).tag_counts_on(:tag)

vbscript to run command -

i'm trying create script runs command: rundll32.exe inetcpl.cpl,clearmytracksbyprocess 255 right errors out dim objshell set objshell = wscript.createobject("wscript.shell") sexe = """c:\windows\system32\rundll32.exe inetcpl.cpl,clearmytracksbyprocess 255 """ createobject("wscript.shell") .run sexe & " " , 1, true end wscript.quit any suggestions? make script run bunch of commands , wait until each process executed has finished before executing other command? the command line should appear if typed @ command prompt (verify wscript.echo sexe ): sexe = """c:\windows\system32\rundll32.exe"" inetcpl.cpl,clearmytracksbyprocess 255"

jquery - image with webKit transform appeat under the next div -

Image
i trying resolve issue shown in image clarification. have small thumbnail webkit transform. when hover, size bigger. wehn use accordion, part of enlarged image appears under accordion div. tried z-index, did not work. appreciate idea on tag attribute or jquery function may resolve. thank mike the z-index property affects elements have position value other static (the default). try adding position: relative thumbnail element. .smallimages { position: relative; z-index: 1; }

Contanate two strings in velocity -

i try contanate 2 strings in velocity build html table. want e.g. in java +=. possibility that? can't find something. sourcecode looks this, know operation += doens't work: #foreach ($event in $allevents) #set ($longstring = $longstring += "<th>$event</th>") #end somebody idea how solve without array? that be: #foreach ($event in $allevents) #set ($longstring = "$!longstring<th>$event</th>") #end or (maybe faster): #set($longstring = '') #foreach ($event in $allevents) #set ($longstring = $longstring.concat("<th>$event</th>")) #end

angularjs - return an error from $http.success -

i working in angular , need signify error promise further down chain when result being resolved in .success(). i call function in service controller myservice.myfunction().then( function(results){ // success stuff }, function(err){ // failure stuff }); myfunction like myfunction(){ return $http.get('url') .success(function(results){}) .error(function(err){}) } based on conditions, need have .then() execute errorcallback though $http.get().success() triggered. how can make $http received error? some fixes need achieve use then instead of success function on $http . and in then success callback can return $q.reject(errordata) reject promise down chain. return $http.get('url').then(function(results){ if(condition) { return $q.reject(errordata); } return result.data; //then callback object properties },function(error) { return $q.reject(error); }) success returns original

java - PropertyPlaceholderConfigurers loading after parameterized DataSource bean -

at top of application context declare propertyplaceholderconfigurer ... <context:annotation-config/> <context:property-placeholder location="classpath:foo.properties"/> ... later on declare datasource bean parameterized properties properties file <bean id="somedatasource" class="oracle.jdbc.pool.oracledatasource" destroy-method="close"> <property name="connectioncachingenabled" value="true"/> <property name="url" value="${database.url}"/> <property name="user" value="${database.user}"/> <property name="password" value="${database.password}"/> </bean> during deployment notice datasource bean created , connection attempted established before propertyplaceholderconfigurer initialized. that's causing datasource parameterizations not populated. any idea why might happening? is there speci

matlab - How to convert a matrix containing a non-demosaiced image to a RAW image file, openable by Lightroom? -

i have camera module, reading out "raw", non-demosaiced image data (this camera module uses bayer bggr filter). storing in matlab matrix. aware matlab can demosaic image me, use adobe lightroom's demosaicing algorithm , processing tools. do tools exist convert matrix (using matlab or otherwise) standard raw file, such adobe's dng format? understand dng similar tiff, can leveraged? as know, can use adobe dng sdk. download adobe dng sdk here . adboe dng sdk can read dng format , save dng tif format. if want read bayer format( non-demosaiced image data ), can try hack adobe dng sdk. replace of bayer data before demosaic. something need notice. you must use correct "bayer type"( bggr , rggb.. etc ). you must use correct "bits per sample". you must use correct "width" , "height".

c# - Frame doesn't work anymore after adding template -

i'm trying learn wpf , created resource dictionary template frame after adding template frame doesn't display pages anymore. when remove template, works again (the pages displayed). doing wrong? resourcedictionary.xaml (just basic) <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <controltemplate x:key="frametemplate" targettype="{x:type frame}"> <grid> <border borderbrush="tomato" borderthickness="3" background="bisque"/> </grid> </controltemplate> </resourcedictionary> mainwindow.xaml <window.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="/resources/icons.xaml" /> <resourcedictionary source="reso

swift - Parsing JSON into a usable format -

i'm downloading data server , i'm not sure how response i'm getting format that's expected method i'm working with. guide me on need of items in json response added [[string : anyobject]] format? thank in advance!! json i'm getting back { "green shirt": [ { "id": "740", "name": “nice green shirt", "quantity": "0", "make": "", "model": "", "price": “15.00", "size": "xxs", "sku": null, "image": "https:\/\/google.com\/green_shirt.jpg", "new_record": false, "category_name": "", "bar_code": "", }, { "id": "743", "name":

Attribute value expected (Android Studio) -

what wanna when click rate button brings 5 stars them rate getting attribute value expected error. need 10 rep post images imma give link image. error : http://prntscr.com/7iiy1k ...what want personal helper. teamviewer or share screen on skype , me out this... need boost. experienced visual studio need android studio. thank you. it seems messed layout , visibility atrtibute wrongly formatted. change to android:visibility="visible, invisible, or gone." not sure if need add onclick since it's part of mess android:onclick="yourfunction"

validation - django validationerror not being raised -

so have created a dynamic formset allows user add or remove many forms want. now, trying custom validation in field(block_name) in forms. it seems working because if user input doesn't match regex, data not saved. problem there no message showing input wrong. also, if user inputs incorrect data , tries submit page redirect , erase input data. how can make page stay in same view if input wrong , show error messages? forms.py: import re django import forms django.forms.models import modelformset_factory inventory.models import block django.core.exceptions import validationerror django.core.validators import regexvalidator # form block requests class blockform(forms.modelform): block_name = forms.charfield(required=true, validators= [regexvalidator('^s\d{3}rf\d*b\d*e\d+r\d+w\d*[cgls][abcdex][ed][hv][sbaec][a-d] [a-d][0-7][apfg]a', message="please enter valid block name", code="invalid_name")]) def __init__(self, *args, **kwargs): super(b

c# - Uploading an IMG file through RestSharp -

i have code: request.addfile ("image_request[image]", ("picture.jpg"); the "image_request[image]" required specific api. "picture.jpg" in /resources/ folder , correctly works. however, application, not have file stored locally. take picture camera app , have stored photo called img , can convert .jpg my question is: how can upload file when not have path? have .jpg image stored in variable. restsharp asks string path second parameter in method addfile, however, stated before, not have path. i want able request.addfile ("image_request[image]", (img); path.gettempfilename path.gettemppath it sounds may want write file temporary file, allow in compliance .addfile's method signature edit // image instance image image; using (filestream fs = new filestream(filename, filemode.open, fileaccess.read)) { image = image.fromstream(fs); // save temp file - code throws exception image.save(

Is it possible to escape regex metacharacters reliably with sed -

i'm wondering whether possible write 100% reliable sed command escape regex metacharacters in input string can used in subsequent sed command. this: #!/bin/bash # trying replace 1 regex in input file sed search="/abc\n\t[a-z]\+\([^ ]\)\{2,3\}\3" replace="/xyz\n\t[0-9]\+\([^ ]\)\{2,3\}\3" # sanitize input search=$(sed 'script escape' <<< "$search") replace=$(sed 'script escape' <<< "$replace") # use in sed command sed "s/$search/$replace/" input i know there better tools work fixed strings instead of patterns, example awk , perl or python . prove whether possible or not sed . let's concentrate on basic posix regexes have more fun! :) i have tried lot of things anytime find input broke attempt. thought keeping abstract script escape not lead wrong direction. btw, discussion came here . thought place collect solutions , break and/or elaborate them. note: if you're