Posts

Showing posts from April, 2014

ios - Image doesn't fit web view -

Image
am displaying image on web view , doesn't fit web view , shows blank white space around border.how can fit or scale image size of web view? nsurl *url = [nsurl fileurlwithpath:path]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:request]; self.webview.backgroundcolor=[uicolor blackcolor]; self.webview.delegate = self; [self.webview setscalespagetofit:yes]; try html code snippet <html><body><img src='%@' width='100%' height='100%'></body></html> it fill web view without white space.

ruby on rails - Correct number for each item in will_paginate list? -

i'm using will_paginate gem in rails app , loop through array of model instances rendered on page , limited 5 per page. before added will_paginate numbered each item simple <% += 1 %> of course went +1 each loop through array, , worked fine. but i'm using will_paginate count restarts on each page, page 1 items go 1, 2, 3, 4, 5, , on second page starts over... 1, 2, 3, 4, 5 obviously isn't ideal. how count continue go previous pages? i think following should work: <% @collection.each_with_index |item, index| %> <%= @collection.offset + index + 1 %> ... <% end %>

git - Automatically merge from trunk to branches -

if there multiple branches 1.1_dev , 1.2_dev , , trunk , let's dev guy checks in bug in trunk , should automatically change in other 2 dev branches also. is there version control tool can this?

mysql - deleting file with unlink function php -

this script working deleting mysql database, it's not unlinking local directory files. can fix script? here's script <?php include "../config/database.php"; if(isset($_get['kode'])){ $id = (int) $_get['kode']; $sql = "select * anidata id='$id'"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0 ){ $data = mysql_fetch_array($query); //delete file $path = 'upload/'.$data['image']; @unlink($path); //delete database mysql_query("delete anidata id='$id'"); } } header("location: view.php"); ?> and helping anyway! :) first try check if file deleted directory if( @unlink($path) ) { mysql_query("delete `anidata` id='$id'"); } if not deleted database, check assigned path in php code !!

javascript - Issue in opening two dropdown at same time -

here id dropdown fiddle http://jsfiddle.net/ym8t7lhj/ the issue facing having 2 dropdowns, if click on 1 dropdown dropdown opening. can 1 me out in this. script $(document).ready(function() { $(".dropdown dt a").click(function() { $(this).toggleclass("myclass"); $(".dropdown dd ul").toggle(); }); $(".dropdown dd ul li a").click(function() { var text = $(this).html(); $('.dropdown dt a').toggleclass('myclass'); $(".dropdown dt span").html(text); $(".dropdown dd ul").hide(); $("#result").html("selected value is: " + getselectedvalue("sample")); }); }); try this $(document).ready(function() { $(".dropdown dt a").click(function() { $(this).toggleclass("myclass"); $(this).closest('dl').find

html - putting a div below an absolute positioned element -

i've got problem putting div below absolute positioned element doesn't have fixed height. codes long paste here, i'm posting link html file instead; http://infomailer.kotra.or.kr/20141127/oisy.html i need move 'dd' bottom of document, not using margin or absolute-positioning because document read mobile devices well. should keep main structure of tab module , fix problem?

c# - not able to redirect users to another page with hyper link -

i have requirement users redirected youtube.com using hyperlink control using below i want change url dynamically based on drop down list selected item using below code. protected void ddlptype_selectedindexchanged(object sender, eventargs e) { int x = ddlptype.selectedindex; if (x == 0) { activatecerts.navigateurl = "http://www.youtube.com/watch?v=3ayoipyqokq"; activatecerts.text = "activatecerts"; activatecerts.target = "_blank"; //activatecerts.href = "http://www.youtube.com/watch?v=3ayoipyqokq"; } else if (x == 1) { //activatecerts.target = "_blank"; //activatecerts.href = "http://www.youtube.com/watch?v=hk3hxuuwg0w"; activatecerts.text = "activatecerts"; activatecerts.navigateurl = "http://www.youtube.com/watch?v=3ayoipyqokq"; } and 1 aspx code <asp:label runat="server" style="pa

php - Error: invalid_request Invalid parameter value for redirect_uri: Uri must consist of printable ASCII characters: -

i created client id , api key in google developer console , given same url in google console , in config file this url: https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3a%2f%2flocalhost%3a81%2fmoviemuseui%2fpublic%2flogin%2fchecklogin+&client_id=xxxxxxxx-xxxxxxxxxxxxxxxxx.apps.googleusercontent.com&scope=https%3a%2f%2fwww.googleapis.com%2fauth%2fuserinfo.profile+https%3a%2f%2fwww.googleapis.com%2fauth%2fuserinfo.email&access_type=offline&approval_prompt=force i getting error that’s error. error: invalid_request invalid parameter value redirect_uri: uri must consist of printable ascii characters: localhost:81/moviemuseui/public/login/checklogin how solve this, can't find problem. excluded us-ascii characters disallowed within uri syntax: control = <us-ascii coded characters 00-1f , 7f hexadecimal> space = <us-ascii coded character 20 hexadecimal> delim

jboss7.x - Mysql JPA throws javax.transaction.RollbackException: instead of ConstraintViolationException -

i using mysql & jpa on jobss7.1 astruts2 based application. use user transaction not cmt. catch constraintviolationexception when insert duplicate row table the below code catches javax.transaction.rollbackexception not constraintviolationexception try { userdao=new userdaoimpl(); initialcontext ic = new initialcontext(); usertransaction utx = (usertransaction) ic.lookup("java:comp/usertransaction"); utx.begin(); userdao.setem(em); userdao.saveconatact(contact); userdao.saveuser(user); utx.commit(); return success; }catch (exception e) { e.printstacktrace(); return error; } org.hibernate.exception.constraintviolationexception: duplicate entry 'john' key 'primary' @ org.hibernate.ejb.abstracten

design - VHDL Program counter using signals and previously made components? -

i in middle of project attempting design single cycle cpu. doing without pipe-lining, since add complexity of design. taking baby steps learn this. find myself stuck @ portion attempting code program counter(pc) using made components. the model of design looks picture here . sorry, no idea why came out dark, if click on it shows correctly. pc , themux both 32 bit components, assume adder well. here code have been given, implementation begins @ begin statement on line 41. pay no attention now, bunch of random gibberish attempting. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; --------------------------------------------------- entity pc_update port( clk: in std_logic; -- clock inch_ldl: in std_logic; -- increment pc = pc + 4 when high, -- load pcinput when low pcinput: in std_logic_vector(31 downto 0); -- external input pc instraddr: out std_logic_vector(31 downto 0)

angularjs - restangular nested resources, different url for single resource -

i have following end points: /quotes (get/post/patch/put) /quotes/{id}/purchase-orders (get/post) /purchase-orders (get) /purchase-orders/{id} (get/patch/put/delete) when create purchase order via: restangular.one('quote', {id}).all('purchase-orders').post({params}).then(function(purchaseorder){ console.log(purchaseorder); }; the url on purchaseorder object /quotes/{id}/purchase-orders/{id} want /purchase-orders/{id}. achieving using code below: restangular.extendmodel('purchase-orders', function(purchaseorder) { if (purchaseorder.parentresource) baserestangular.restangularizeelement(null, purchaseorder, 'purchase-orders'); return angular.extend(purchaseorder, purchaseorder); }); is best/only way? there configuration option setup parentless routes. restangular.setparentless(true)

python - Detecting & highlighting macroblocks in an image with compression artifacts -

Image
hello, have image portion of has macro-blocking effect. in attachment below, have taken region of macroblock using scikit & numpy arrays. curious know if there way identify such regions in image , highlight / quantify them i.e identify horizontal & veritical lines/blocks / bounday & highlight them , discard curvature (angular) edges may part of larger image. i have tried using hough line transform, , see colored lines in other angles along horizontal & veritical lines. want supress other angles not 0/90 deg. possible scikit-image apis? thanks in advance.

format - Formating parsed output perl -

so yeah have file - alli need last 5 lines file. know not supposed parse html without html module. not reallly program strict - mean need last 5 lines or so. besides cannot donwload modules. have access proxy server allows me curl files command line maybe there way use cpan fromteh or throught proxy - nother matter. matter @ hand when parse out thelast file lines or so, dont "names in my-dept restricted" , want it. gets skipped. new_guy@casper0170foo:~/hey/hit_bank_restricted.$ cat restricted.html.bak to:dl-bank@big_business.com from:dl-dept?g-gsd-stm@big_business.com subject: restricted list 25-nov-2014 content-type: text/html; content-transfer-encoding: quoted-print htmlfileable> <html> <head> <style type="text/css"> body { font-family: verdana; font-size: 10pt } td { font-size: 8pt; vertical-align: top } td.cat { color: 6699ff ; background: 666699; text-align: right; vertical-align: bottom; height: 30 }

Calling Win API in C# with P/Invoke when _Out_ parameters can be NULL or non-NULL -

i'm new c# , i'm learning c# write small tools. there many windows api pointer parameters null or non-null depends on different use case. question is, how declare such parameters in dllimport? for example: long querydisplayconfig( _in_ uint32 flags, _inout_ uint32 *pnumpatharrayelements, _out_ displayconfig_path_info *ppathinfoarray, _inout_ uint32 *pnummodeinfoarrayelements, _out_ displayconfig_mode_info *pmodeinfoarray, _out_opt_ displayconfig_topology_id *pcurrenttopologyid ); when flags qdc_database_current , last parameter pcurrenttopologyid must not null. when flags other value, pcurrenttopologyid must null. if parameter declared "out intptr" or "ref intptr", in order api can change referred memory. if passing intptr.zero required api, api call return error_noaccess. [dllimport(user32_filename, setlasterror=true)] internal static extern int querydisplayconfig( [in] qdc_flags flags, [in, ou

ios - 100 photos to like in Instagram -

using instagram api photos unfortunately allow 30photos have used signed api. have set header x-insta-forwarded-for still allow 30 photos "doc. 100 photos like" check url click here thanks in advance

sql - Best way to select record with out IN operator in MYSQL -

i have table called sub_router below sample data , 2 columns associated_router_l1,associated_router_l2 both composite primary key. i want select l2 ronter id given l1 routerid example if gave 2001 result 2005,2006,2002,2007,2003,2008 my select sql is query - 1(with 1 level) select s1.associated_router_l2 sub_router s1 s1.associated_router_l1 in (select s2.associated_router_l2 sub_router s2 s2.associated_router_l1 = 2001) query - 2(with 2 level) select s1.associated_router_l2 sub_router s1 s1.associated_router_l1 in (select s2.associated_router_l2 sub_router s2 s2.associated_router_l1 in (select s3.associated_router_l2 sub_router s3 s3.associated_router_l1 = 2001)) query-2 using inner join select s1.associated_router_l2 sub_router s1 inner join sub_route

c# - Plus sign in query string? -

Image
i have webapp created using c# , asp.net. placed parameter value in querystring plus(+) sign. plus sign disappear. how can include plus sign(+) in query string without disappearing? here found same question , according it, have used server.urlencode(myqerystring) , time of decoding server.urldecode(myqerystring) how resolves space here watch window 1) querystring after server.urlencode() 2) querystring after server.urldecode() notice space between s , r should + . new web development , read other answers says use urlencode , decode giving same issue before doing wrong , yes query string automatically generated. have no control on it. there other hack replace " " or "%2b" "+" go if dont find way. there way this. thanks. the answer link mentions using server.urlencode, not server.urldecode. when read request.querystring automatically decodes string you. doing manually second time corrupting , why you're getting space.

android - Gcm push notification not working after changing package name? -

my app push notification not recieves after change package name using android tools>rename application package go google developers console, apis & auth, credentials. have there oauth key old package name, create new or change old one

java - Creating a bar chart using JSP -

how create bar chart through data database using jsp.i created 2 tables in database (1)cust_entry,(2)cust_response.so plz give me correct code , place put code in coding. thanks in advance. thanks <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>customer response</title> </head> <body> <%@page import="java.sql.*" %> <%! string name,date,desg,org,add,q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13,q14,q15,q16; connection con=null; statement stmt=null; // statement stmt1=null; // resultset rs=null; string drivername="com.mysql.jdbc.driver"; string url="jdbc:mysql://106.197.161.194/wiprofeedback.jsp/wipro"; string user="root"; string password ="root"; %> <% name= request.getparameter("person"); date= request

android - Call Bitmap inside onPictureTaken -

how can call bitmap inside onpicturetaken method ?. image not storing in gallery until , unless restart phone please in re-arranging code. public static int getorientation(context context,uri photouri){ cursor cursor = context.getcontentresolver().query(photouri,new string[] {mediastore.images.imagecolumns.orientation},null,null,null); if(cursor.getcount()!=1){ return -1; } cursor.movetofirst(); return cursor.getint(0); } getcorrectlyorientatedimage() never used. please me in can call function. public static bitmap getcorrectlyorientatedimage(context context, uri photouri)throws ioexception{ inputstream is=context.getcontentresolver().openinputstream(photouri); bitmapfactory.options dbo = new bitmapfactory.options(); dbo.injustdecodebounds = true; bitmapfactory.decodestream(is,null,dbo); is.close(); int rotatedwidth,rotatedheight; int orientation = getorientation(context,photouri); if(orientation == 90 || orient

elasticsearch - Elastic search NumberFormatException aggregation terms query -

i don't know doing wrong. have term aggregation on integer field " status ", getting numberformatexception running query. have 2 status fields 1 in _source.status type integer , 1 _source.report.status type long error message { "error": "searchphaseexecutionexception[failed execute phase [query], shards failed; shardfailures {[qieoas8ss4ynp938pixzyg][outboxprov1][3]: elasticsearchexception[java.lang.numberformatexception: invalid shift value in prefixcoded bytes (is encoded value int?)]; nested: uncheckedexecutionexception[java.lang.numberformatexception: invalid shift value in prefixcoded bytes (is encoded value int?)]; nested: numberformatexception[invalid shift value in prefixcoded bytes (is encoded value int?)]; }{[qieoas8ss4ynp938pixzyg][outboxprov1][4]: elasticsearchexception[java.lang.numberformatexception: invalid shift value

sockets - C++ select function breaks prematurely -

this question has answer here: breaking out socket select 4 answers okay, first off: sorry if has been asked before, couldn't figure out correct keywords if had been. situation: have small network server, runs in it's own thread. 'run'-method iterates on collection of active sockets (both udp , tcp), checks activity , it's thing. of achieved via select . it possible, that, while 'stuck' in select new server added. purpose, have incorporated 'breaker socket', checked alongside others. gets closed when new socket added, new socket monitored traffic. (fd_set gets regenerated each time select got broken) code (abbreviated): fd_set fds; socket msock = breaker; fd_zero(&fds); //aquire mutex if(breaker == invalid_socket) msock = breaker = socket(af_inet, sock_stream, 0); fd_set(breaker, &fds); //iterate on active soc

javascript - Getting Error: Unkown provider: $urlMatcherFactory -

unkown provider: $urlmatcherfactory this error message angular throws when try inject $urlmatcherfactory in app config. i have included ui-router js file , have been using last few months. i need this: var datematcher = $urlmatcherfactory.compile("/day/{start:date}"); $stateprovider.state('calendar.day', { url: datematcher }); as this example shows. normally code won't identify $urlmatcherfactory . tried injecting dependency on config error. in q&a matching url array list of words in angularjs ui-router can see how use $urlmatcherfactory . link working plunker . in example, $urlmatcherfactory used in .run() : .run(['$urlmatcherfactory', function($urlmatcherfactory) { var sourcelist= ['john', 'paul', 'george', 'ringo'] var names = sourcelist.join('|'); var urlmatcher = $urlmatcherfactory.compile("/{source:(?:" + names + ")}/:id");

Wordpress Css Style does not load -

i using using wamp server , have put online. when access site desktop fine. when open site mobile phone stylesheet not load. it's default wordpress installation no question of stylesheet error. what can problem? ok problem solved have removed ip address have replaced url in wp_options table? because url css wrong. taking local below wrong http://127.0.0.1/design apply following query desired changes: update wp_options set option_value = replace (option_value , 'http://www.oldsite.com' , 'http://www.newsite.com') option_name = 'home' or option_name = 'siteurl'; update wp_posts set guid = replace (guid , 'http://www.oldsite.com' , 'http://www.newsite.com'); update wp_posts set post_content = replace (post_content , 'http://www.oldsite.com' , 'http://www.newsite.com'); update wp_postmeta set meta_value = replace (meta_value , 'http://www.oldsite.com' , 'http://www.newsite.com&

java - Comparing values using hashtable -

there table like: code(starts with) value 1 aaa 101d bbb 101dg ccc 2 ddd the above table has columns code , corresponding values. code column signifies string starts code given , on comparing input code of user, corresponding value assigned value column of table. for example: if user's code 100000, value should aaa...... for user's code 101d1111, value should bbb(not aaa if starts 1 consider more significant comparison 101d)...... for user's code 101dg222, value should ccc(not bbb if starts 101d notice significant comparison)..... for user cose 23333, value=ddd..... i have put following table in hashtable key code column , value value column. hashtable hash= new hashtable(); hash.put("1","aaa"); hash.put("101d","bbb"); hash.put("101dg","ccc"); hash.put("2","ddd"); string comp="101d11

c# - Textblocks overlapping each other in XAML -

this trying obtain: name date this xaml have. in result, both texts name & date overlapping each other. <datatemplate> <grid x:name="showgrid"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <stackpanel> <grid height="{binding widthma}" width="{binding widthma}"> <grid margin="3.5" background="white"> <grid verticalalignment="bottom" background="black" height="30"> <textblock text="{binding strname}" style="{staticresource albumtitletext}" grid.row="0" /> <textblock text="{binding datecreated}" style

How to create a clickable text at terminal or alternative solutions with python? -

i creating simple terminal rss reader python. the following how feeds displayed @ terminal. trying to looking solution trigger python function,which added url pocket account. for web dev,it can done anchor links or buttons. is there solutions interact terminal such keyboard input,mouse clicking? $ python feedparser.py -w ph title: product hunt — best new products, every day url: http://www.producthunt.com ------------------------------------- golden goose — scramble eggs in shell http://www.producthunt.com/l/68cf97c80c/339 [pocket] lava mae — mobile showers homeless http://www.producthunt.com/l/275ff76783/339 [pocket] androidify — create & share android characters http://www.producthunt.com/l/680168e4e2/339 [pocket] empty states — delight users designing empty states http://www.producthunt.com/l/b02fc043d7/339 [pocket] code: https://github.com/aungthurhahein/simple-terminal-rss-reader i depends lot on terminal , operating system using . for example in

node.js - NodeJS async module + redis -

im using async model in node along redis. my code: async.each(data, function(n, done) { redisclient.llen("user:" + n + ":active", function(err, numbactive) { if(!err) { console.log("[checking].... " + n + " numb::::: " + numbactive); globalnumbactive += numbactive; done(globalnumbactive); } else { done(err, 0); } }); }, function(err, globalnumbactive) { console.log("globals --> " + globalnumbactive); return callback(globalnumbactive); }); data above contains: ['231', '323', '323'] i want check each of userids in user:user_id:active list, sum them , return. right above grabs first , returns. any ideas i'm doing wrong? what if second argument of main callback removed? following snippet works me. // assume 2 lists have been created in way belo

java - Guice injection with Builder pattern for client lib -

i new google guice , trying wrap head around how use particular scenario. building service client pretty complex , (i believe) requires builder pattern instantiated correctly. because client packaged own jar lib, guice handle di under hood. below greatly simplified version of code: public interface myclient { public fizzresource getfizzresource(); public buzzresource getbuzzresource(); public fooresource getfooresource(); } public class myclientimpl implements myclient { // see below } public class getfizzcommand { // omitted brevity } public class getbuzzcommand { // omitted brevity } public class getfoocommand { // omitted brevity } public interface fizzresource { fizz getfizz(long fizzid); } public class fizzresourceimpl implements fizzresource { private getfizzcommand getfizzcommand; @override fizz getfizz(long fizzid) { return getfizzcommand.dogetfizz(fizzid); } } public interface buzzresource { buzz getbuz

Uploading an image file from Meteor method using Amazon S3 -

using aws-sdk package meteor, i've set , connected amazon s3 upon starting app. , able upload non-image file using putobject() method. $s3->putobject(...); however whenever i'm trying upload image , hit roadblock. how can use meteor method image , upload amazon s3?

asp.net mvc - Send large string from Android to MVC -

i'm trying send large string android mvc application , android. below codes mvc application. [httppost] public httpresponsemessage retrievestring(string longstring) { var resp = new httpresponsemessage() { content = new stringcontent("{\"resultstring\":\"" + longstring + "\"}") }; resp.content.headers.contenttype = new mediatypeheadervalue("application/json"); return resp; } here code android application protected string doinbackground(string... params) { httpurlconnection urlconnection = null; bufferedreader reader = null; string jsonstr = null; try { final string url = "http://172.27.179.197:7837/api/testcon/retrievestring?"; uri builturi = uri.parse(url).buildupon() .appendqueryparameter("longstring", params[0]).build(); url url = new url(built

java - What is the difference between wscompile and wsimport? -

what difference between wscompile , wsimport. can please let me know when wscompile. use wsimport ws artifacts wsdl. confused when use wscompile? as per information, jax-ws has simplified development of web service clients when compared jax-rpc. both technologies have tool importing wsdl generate client side artifacts. jax-rpc's tool wscompile, jax-ws' tool wsimport. the advantage of jax-ws clients on jax-rpc clients portability. jax-ws generates portable artifacts @ higher percentage, while jax-rpc generated artifacts not portable.

angularjs - ng-pattern directive mess up input's capability -

i need validate ng-pattern security code has 4 digits. after add ng-pattern="/^[0-9]{4}$/" input fails display model attribute (security code). if remove ng-pattern form , input works no validation. how fix it? http://jsbin.com/saroyo/1/ updated 1 error visible var app = angular.module('myapp',[]); app.controller('myctrl',function($scope){ }); </script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="myapp"> <div ng-controller="myctrl"> <form name="myform"> code: <input type="number " name="code" ng-model="user.code" ng-minlength="4" ng-maxlength="4"> <span class="error" ng-show="myform.code.$error.minlength"> should 4 charachters long</span> <span class="error" ng-sho

javascript - Access-Control-Allow-Origin:* not being recognized by Angular.js $http -

Image
i'm developing javascript app control smart tvs angular pre lights options requests before try post request (soap) i'm trying send. devices return response proper access-control-allow-origin: * angular refuses send post request. of course, can't change configurations of device's server send header angular "needs" , need send cookie , content-type . how can work around this? update screenshot of request (bottom) , response (top) headers. update related angular code: app configured with: app.config(['$httpprovider',function($httpprovider) { $httpprovider.defaults.withcredentials = true; }]) the request is: var body = '<?xml version="1.0"?><s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"><s:body><u:x_sendircc xmlns:u="urn:schemas-sony-com:service:ircc:1"><ircccode>{command}<