Posts

Showing posts from May, 2013

Google Cloud Storage Folder Structure -

does google cloud storage support functionality allow me nest referenced files contained in microsite described here rackspace cloud. http://docs.rackspace.com/files/api/v1/cf-devguide/content/pseudo-hierarchical_folders_directories-d1e1580.html as in, if upload html page references css , script files want store in google cloud storage...is there way accomplish sort of dynamic file nesting on google cloud storage? yes, certainly. google cloud storage not have true "folders", can use delimiter characters "/", behave appropriately if hosting static website. can list objects using prefixes , delimiters. "prefix" represent "current directory", , "delimiter" "/", representing subdirectory. see https://developers.google.com/storage/docs/json_api/v1/objects/list more precise descriptions on object listing parameters.

xaml - WPF one trigger for multiple values -

i'm trying create single trigger trigger on multiple possible options. want set background green when options either "reviewed" or "completed". want second trigger change background yellow when "pending" or "yellow". this answer pointed me towards it, incomplete , couldn't make sense of it: https://stackoverflow.com/a/4660030/526704 here's have now: <style x:key="statuscelltextblock" targettype="textblock"> <style.triggers> <trigger property="text" value="reviewed"> <setter property="background" value="green"/> </trigger> <trigger property="text" value="completed"> <setter property="background" value="green"/> </trigger> <trigger property="text" value="pending"> <setter pr

arrays - make a global object in java -

i want make array of objects , use in different functions. wrote pseudocode privat stock[] d; privat stock example; public void stockcheck(){ d =new stock[2]; d[0]= new stock("a","test1", 22); d[1]= new stock("b","test2", 34); } @override public stock getstock(string name) throws stockchecknotfoundexception{ int i; system.out.println("ok" + name + d.legth); // error example = new stock("example","example",2); return example; } in class test make instance of getstock , call function getstock stock.getstock(); i nullpointerexeption when d.length. d null don't understand why. perhaps example of code need, using 3 classes test - main test code stock - implied code stock question stockcheck - corrected code question. (note: may want use arraylist inside stockquote can add , delete stocks.) test class package stackjavaexample; public class

javascript - How to use Picturefill -

i'm trying use picturefill website neither version seems work. in head of page: <script src="js/picturefill.js"></script> i have 2 images, welcome.jpg larger image , welcome_sm.jpg smaller: <span data-picture data-alt="welcome novus landscapes"> <span data-src="images/welcome_sm.jpg"></span> <span data-src="images/welcome.jpg" data-media="(min-width: 58em)"></span> <noscript> <img src="images/welcome_sm.jpg" alt="welcome novus landscapes"> </noscript> </span> do need else work? don't see since javascript enabled on browsers of course eliminates fallback due noscript tag. what doing wrong? my website novuslandscapes dot com thanks, john there's few things need do. read or watch here place script @ bottom of html, before </body> try syntax, copied here <article> <img src="https

android - How to do FragmentStatePagerAdapter changes dynamically -

i implementing little image gallery viewpager , fragmentstatepageradapter (i'm using fragmentstatepageradapter cause supporting android 2.3, low memory devices have compatible too). since images webservice (in asynctask), place example image in fragments of gallery until images webservices downloaded. my question is, how change example image in visible fragment 1 of downloaded images? guess have in onpostexecute() inside asynctask, capturing visible fragment in moment , changing drawable in imageview, not sure how it. advices welcome. you can register fragment event bus otto , , pass file location picture stored subscribed fragment (i.e. onpostexecute() . can update fragment 's ui.

actionscript 3 - Why do extended classes have to re import in as3? -

let's have base class parentclass includes import statements. import flash.events.*; if have child childclass extends parentclass , want event public class childclass extends parentclass{ public childclass():void{ addeventlistener(event.added_to_stage, childfunction); } } it doesn't work unless add import statement in child class: import flash.events.*; public class childclass extends parentclass{ public childclass():void{ addeventlistener(event.added_to_stage, childfunction); } } why? if child class extending functionality of parent, why need re-import classes parent required? one reason import statements exist actionscript 3 classes can have same name other classes, provided exist in different packages. import statements tell compiler of these classes trying use. for example, if whatever reason, had made class called event in this/is/an/example package, compiler need see either import flash.events.event statement

SQL Server - How to prevent sql server from disconnect the idle connection after period of time? -

i using sql server 2012 desktop application client , application errors after period of time when no activity on , googled issue solutions points me auto_close option on database it's set false . i thing missing in connection string (ado extension) to honest, if have long running connections, can hit these errors regardless due firewalls / routers closing connections, etc. correct solution instantiate connection when need it, use connection , release it. connection pooling, not performance problem. if long-running application "bursty", convenient open connection, number of commands -- when go idle, release connection , wait next burst of activity.

android - Strange Behaviour of backgroundcolor in custom listview (nolarge dataset) -

code custom list adapter view (this list has 11 items) , viewholder not helping here. @override public view getview(int position, view convertview, viewgroup parent){ layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); if( convertview == null ){ // fast view google io http://www.youtube.com/watch?v=wdbm6wveo70 convertview = inflater.inflate(r.layout.single_transaction,parent,false); } textview phone_number = (textview) convertview.findviewbyid(r.id.phone_number_show); textview transaction_summary = (textview) convertview.findviewbyid(r.id.transaction_summary_show); textview transaction = (textview) convertview.findviewbyid(r.id.transaction_show); transactions single_transaction = (transactions) getitem(position); phone_number.settext(string.valueof(single_transaction.get_phone_number())); transaction_summary.settext(single_transaction.get_transaction_summary()); int single_transact

entity framework - EF 6.1 code first reverse engineering tool with mapping classes -

when try ef code first reverse engineering entity framework 6.1.0 tools visual studio dataannotation based configurations , other configurations generated @ onmodelcreating(dbmodelbuilder modelbuilder) overridden method. both messy , don't nice. want know has tool feature generate mapping related configurations @ separate classes inherit entitytypeconfiguration<modelname> ?

maven - sensitive information required for docker build -

for running docker build of java application need sensitive information (a password access nexus maven repository). what best way make available docker build process? i thought adding ~/.m2/settings.xml container lies outside of current directory/context , add not able access it. update: in current setup need credentials run build , create image, not when running container later based on created image you want mounting volume host container

openstreetmap - Edges are missed by osm2po when imported to postgresql -

i using osm2po importing pbf file postgresql when find route using built-in algorithms found of edges missing route not match road. did know why happening, in advance example shown in image

java - deployment not taking changes -

some minutos ago eclipse/wildfly deployment stopped work correctly, deployment not taking changes in java code, i using interceptor see method accessing in url public void intercept(interceptorstack stack, controllermethod method, object instance) throws interceptionexception { //pega uri acessada string uri = request.getrequesturi(); // system.out.println(method); // system.out.println(method.getmethod()); stack.next(method,instance); } } if see, has // must stop printing, after deploy, still show accessed method in console, why? if make changes in .jsp pages change normally, java not, 23:06:53,985 info [org.jboss.as.server] (deploymentscanner-threads - 2) jbas018565: replaced deployment "testproject.war" deployment "testproject.war" i guess class file not building in eclipse,so deploying old version.i guess mistakenly click 'build automatically' option in "project"

python - nagiosplugin: how to show different fmt_metric based on the value? -

i'm writing nagios plugin use xml output sslyze calculate ssl score based on qualys server rating guide . here're code: if certificatematchesserverhostname == 'true' , expire_in.days > 0 , validationresult == 'ok': ... final_score = protocol_score * 0.3 + key_score * 0.3 + cipher_score * 0.4 return [nap.metric('sslscore', final_score, min=0, max=100)] elif certificatematchesserverhostname != 'true': return [nap.metric('serverhostname', hostnamevalidation[0].attrib['serverhostname'])] elif expire_in.days <= 0: return [nap.metric('expireindays', expire_in.days)] elif validationresult != 'ok': return [nap.metric('validationresult', validationresult)] @nap.guarded def main(): check = nap.check( sslconfiguration(), nap.scalarcontext(&

javascript - How to drag one or more items to an element using both Draggable and Selectable JQuery -

i'd know how drag 1 or more items (individual person records in case, via avatar photo) target (in case list of cities) , update database dragged items details of item dragged to. i have working single items @ moment. i have sidebar list of locations retrieve database entityframework: <ul> <li class="droppable"> <span>sydney</span> </li> <li class="droppable"> <span>brisbane</span> </li> <li class="droppable"> <span>melbourne</span> </li> </ul> in main window have grid of people's images , i'm using jquery ui selectable enable these selected: <ul class="people-list" id="selectable"> @foreach (var item in model.people) { <li> <img src="@item.photo" style="width:100%" class="img-polaroid" /> </li> } </ul>

Checkboxes with php -

this question has answer here: php parse error: syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string 4 answers i trying make delete option in messages exchange application delete messages inbox or sent. doing wrong in echo " parse error: syntax error, unexpected '' (t_encapsed_and_whitespace), expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in c:\program files (x86)\easyphp-devserver-14.1vc9\data\localweb\test\msg\inbox.inc.php on line 45 while ($rows = mysql_fetch_assoc($view_msg)) { $id = $rows['id']; echo "<tr>"; echo "<td>"; echo "<input name='checkbox[]' type='checkbox' id='checkbox[]' value='<?php echo $rows['id']; ?>' >&quo

css - Move Content Down on Mobile Phones -

Image
i'm trying move column of content down on mobile phones (no tablets), can't figure out. end goal move custom field data below body text. via: http://beta.johnslanding.org/portland/canyon-hoops/ .one-fourth.last.right tried this: @media screen , (min-device-width : 400px) { -webkit-column-break-inside:avoid; -moz-column-break-inside:avoid; -o-column-break-inside:avoid; -ms-column-break-inside:avoid; column-break-inside:avoid; } you'll see on iphone theme keeps these 2 columns together: the easiest way of doing moving div.three-fourths (your body content) above div.one-fourth (the sidebar content) in html, this: <div class="three-fourths">...</div> <div class="one-fourth last right">...</div> because content area has float:left , sidebar has float:right exact width's set, rearranging html have no effect way looks, order of html. and, clear floats , set new widths fill viewport under desired

c# - Is the result of MethodBody.GetILAsByteArray Method being cached? If so, how to clear the cache? -

as android game developer, using methodbody.getilasbytearray method il codes detect if given method has been modified (injected) user using other app (e.g. cheat engine). example, class { public foo() { // here. } public static byte[] getilbytecode() { return typeof(a).getmethodinfo("foo").getmethodbody().getilasbytearray(); } } i can injected version of function "foo" if call function a.getilbytecode() after function "foo" being injected. if call a.getilbytecode() first, , inject code in "foo". when call a.getilbytecode() again, return origin version of function "foo" instead of injected version. it seems result of getilasbytearray() cached. so question is, can clear cache of getilasbytearray(), , updated il code of target method? since reflection expensive. .net runtime caches types pulled reflection, , in each 1 of these caches members called reflection. i believe can try

actionscript 3 - getting data from xml tags that have : (colon in them) -

i using air build application search , show thumbnails deviantart request url getting resuts in form of rss feed following simplicity showing code in have question we can use tag trace(myxml.channel.item[0].title); but tags media:content trace(myxml.channel.item[0].media:content); but not work colons confusing me first of if there colons in xml known namespace otherwise simple tag. pasre data namespace little different simple tags. can show example if share xml format can write appropreate code you. here sample code: xmldata.ignorewhitespace=true; var awsns:namespace = new namespace("http://www.aws.com/aws"); xmldatavo.state=xmldata..awsns::["city-state"]; xmldatavo.country=xmldata..awsns::["country"]; xmldatavo.sunrisehour=xmldata..awsns::sunrise..awsns::["hour"].@number; xmldatavo.sunriseminute=xmldata..awsns::sunrise..awsns::["minute"].@number; my xml format this <aws:weather xmlns:aws="htt

language agnostic - Is it possible to create an algorithm which generates an autogram? -

an autogram sentence describes characters contains, enumerating each letter of alphabet, possibly punctuation contains. here example given in wiki page. this sentence employs 2 a’s, 2 c’s, 2 d’s, twenty-eight e’s, 5 f’s, 3 g’s, 8 h’s, eleven i’s, 3 l’s, 2 m’s, thirteen n’s, 9 o’s, 2 p’s, 5 r’s, twenty-five s’s, twenty-three t’s, 6 v’s, ten w’s, 2 x’s, 5 y’s, , 1 z. coming 1 hard, because don't know how many letters contains until finish sentence. prompts me ask: possible write algorithm create autogram? example, given parameter start of sentence input e.g. "this sentence employs" , , assuming uses same format above "x a's, ... y z's" . i'm not asking write algorithm, although means i'd love see if know 1 exist or want try , write one; rather i'm curious whether problem computable in first place. you asking 2 different questions. "is possible write algorithm create autogram?" there algorithms find autogram

c# - How to download files from FTP Server -

i'm trying download file (all kinds of files, exe dll txt etc.). , when try run error comes on: using (filestream ws = new filestream(destination, filemode.create)) this error message: access path 'c:\riot games\league of legends\rads\solutions \lol_game_client_sln\releases\0.0.1.41\deploy'(which destination, want save it) denied. here code void download(string url, string destination) { ftpwebrequest request = (ftpwebrequest)webrequest.create(url); request.method = webrequestmethods.ftp.downloadfile; request.credentials = new networkcredential("user", "password"); request.usebinary = true; using (ftpwebresponse response = (ftpwebresponse)request.getresponse()) { using (stream rs = response.getresponsestream()) { using (filestream ws = new filestream(destination, filemode.create)) { byte[] buffer = new byte[204

algorithm - Check if x is bigger than k-th smallest number in a min-heap -

i know question asked before. read following question: how determine if kth largest element of heap greater x have further questions. did not want post in thread old. so: given number x , number k , check if x bigger k -th smallest element in o(k) . the previous question same thing, max-heaps , smaller than. not problem. consider binary min-heap: 1 2 3 12 17 50 90 23,18 80,88 51,52 91,92 let x 19 , k 6. the 6th smallest element 18. if algorithm in other thread, check follows: 1+,2+,12+,23,18+,17+,80,88,3+ the + signals when counter increased. how algorithm know 18 k -th smallest number, not 3? and why checking of 23, 80 , 88 not interfere o(k) ? how algorithm know 18 kth smallest number, not 3? it doesn't matter algorithm - counts smaller numbers - doesn't keep track of 1 k-th smallest number. if finds more k smaller numbers, knows k-th smallest number smaller x . if want

mysql - INSERT doesn't trigger right away -

what do: select database, if row not exist insert row repeat step 1, select row step 3 expected result: after 4 steps there result in case result: there no row in select, row exists (see through phpmyadmin) mysqlpool.getconnection(function(err, connection) { connection.query('select * x key = ? limit 1', [ data.key ], function(err, result) { if (result.length == 0) { // works, verified through phpmyadmin: connection.query('insert x set ?', { key: data.key }); } }); connection.query('select * x key = ? limit 1', [ data.key ], function(err, result) { if (result.length != 0) { // expecting here, result[0] undefined?! } else { // end here? wtf } }); connection.release(); }); does node-mysql need kind of commit; or something? what doing wrong? i believe due asynchronous

oop - Can abstract factory be used for something other than creation -

i have abstract factory class keeps map of types (application specific types integers) , pointers factory objects. map initialized in constructor of abstract factory has method called ifactory* get_factory_for_type(int) . ifactory interface factory classes must inherit from. i need string representing of objects each factory can produce , list of available object types. if add map in abstract factory (of type std::map<int, std::string> ) , 2 methods std::string get_name_for_type(int) , std::vector<std::string> get_type_names() , way it? i wary of doing though abstract factory should responsible creating object factories. there better way or okay in abstract factory? the purpose of abstract factory ability create specific set of objects, adapted environment. school book example windows/linux/mac etc, more relevant example different persistence options. as types factory creates should known, don't see reason have sort of enumeration of objects objec

java ee - How to Execute a Class when server is Starting -

this question has answer here: using special auto start servlet initialize on startup , share application data 1 answer i have dynamic webproject created in eclipse glassfish server, want execute specific class automatically when server started. class has listener listens jms queue, how can achieve this? have configure in web.xml? if how it? code example appreciated. there alot of ways achieve this. can make startup ejb singleton. this: @singleton @startup public class mystartupbean { @postconstruct private void init() { log.info("initializing startup bean"); // stuff } }

sql - How to select with grouping on a subset of columns -

select datepart(yy, date1) year, datepart(mm, date1) month, datepart(dd, date1) day, datepart(hh, date1) hour , min(datepart(mi, date1)) minute, datediff(mi, date1, date2) aaa mytb with(nolock) group datepart(yy, date1), datepart(mm, date1), datepart(dd, date1), datepart(hh, date1), datepart(mi, date1) order datepart(yy, date1) , datepart(mm, date1), datepart(dd, date1), datepart(hh, date1), datepart(mi, date1) this sql not working, don't want add datediff(mi, date1, date2) group by clause. solution? found answer: need use aggragate function min,sum etc. in code : select .... max(datediff(mi, date1, date2))

Android Async task in viewpager -

i using fragmentstatepageradapter set viewpager content. in getitem() method of adapter, invoke fragment. want display product images , names dynamically server on each view pager fragment. calling async task in oncreateview() of fragment. async task adjacent products invoked. want know best way ? should perform async task ahead , set adapter of view pager? if so, have 1000s of products, take huge time set adapter. or should perform async task after every page has loaded? here, every time come page, keeps loading data server. want data loaded first time visit page, on next swipe, should display instead of fetchng server again. i infinite view pager adapter, how possible ? many in advance :) ... want data loaded first time visit page, on next swipe, should display instead of fetchng server again. move asynctask call oncreateview setuservisiblehint : executed when fragment visible user: @override public void setuservisiblehint(boolean isvisibletouser) {

Doxygen: Exclude undocumented files -

i have framework extending. there source folders contain quite lot of files , want document work (especially files come me) using doxygen. any file documenting contians header: /** * @file my_file.c * @author stefan f. * @date 28.05.2014 * * @brief file awesome! */ can somehow tell doxygen not include files without such header? i have set extract_all = no files don't have doxygen header not generated still listed in file list. does know how configure doxygen behavior? i'm not aware of part of doxygen exactly looking for, however, simplest way achieve aim list files want doxygenning in doxyfile input line. input = my_file_1.cpp myfile2.cpp moreofmyfiles/etc.cpp (beware it's space separated list.) depending on folder structure may need set recursive = no if it's own personal project , can name file myname_file.cpp use file_patterns select files beginning "myname_* - i'm expecting that's not viable set o

c# - Add a Column to a Table via Linq or Triggers in SQL -

the issue , got 2 tables x & y. when records added table x , columns should added table y in parallel. http://prntscr.com/3owqfe <-- provides clear idea. i tried triggers , seems triggers doesnt allow create table or alter table. anyway i'm using linq , im trying achieve via linq. suggestions ? edited: record below trigger worked , exception. create trigger additemtocommon on [sep].[dbo].[itemmaster] insert begin declare @payid varchar(max) select @payid = paycode inserted alter table [sep].[dbo].[commonpayrollitems] add samplecol varchar(max) end anyway run once because , there cannot more 1 column of same name. if can retrieve row values grom itemmaster table , it's still possible triggers. tried replace samplecol @payid results in syntax error. linq not have functionality create or alter tables. use underlying connection of linq datacontext execute sql statement: datacontext.executecommand(...) and use run alter table statement

c++ - What should I use instead of cl::KernelFunctor? -

i'm following tutorials on opencl , mention type called cl::kernelfunctor . however, type isn't found , when looked @ headers of amd app sdk, saw declaration of cl::kernelfunctor class commented out. what supposed use in place of code run kernel? //run kernel cl::kernelfunctor simple_add(cl::kernel(program, "simple_add"), queue, cl::nullrange, cl::ndrange(10), cl::nullrange); simple_add(buffer_a, buffer_b, buffer_c); cl::kernel simple_add(program, "simple_add"); simple_add.setarg(0, buffer_a); simple_add.setarg(1, buffer_b); simple_add.setarg(2, buffer_c); commandqueue.enqueuendrangekernel(simple_add, ...);

html - how to display first page in localhost? -

i using xamp create website, having folder named html has page called cart.html , folder html found in htdocs , want cart.html appear localhost being input in browser. when input http:// localhost/ , cart.html page should appear. unable do, can u suggest me how it. simple htaccess rule: redirect 301 index.html cart.html assuming in same folder, otherwise replace whatever needed

sql - UPDATE statement: re-evaluate subquery after each SET -

create table test (id number(3)); insert test values (1); insert test values (2); insert test values (2); insert test values (3); insert test values (4); insert test values (4); insert test values (5); i want make numbers in test unique (like {1,2,3,4,5,6,7} - i.e. remove doubles) using query: update test u set u.id = (select max(nn.id) test nn) + 1 1 < ( select tt.rown (select rowid, row_number() on ( partition t.id order t.id) rown test t) tt tt.rowid = u.rowid ); the above query updates table {1,2,3,4,5,6,6} . replaces second 2 6 correctly, second 4 becomes 6 also, should 7 . existing non-duplicates should not replaced, second-onward duplicates. the problem above update statement (select max(nn.id) test nn) evaluated once , cached, depends on updated. possible force re-evaluation of (select max(nn.id) test nn) after each set? tried hints /*+nocache*/ without success. in other words, during update, need take account fields have been

asp.net - Invalid remote certificate while accessing PayPal Sandbox transaction service -

i testing application paypal sandbox. the uri use transaction https://sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick . in return page read data paypal form new string send cmd = _notify-validate . when make call https://sandbox.paypal.com/cgi-bin/webscr getting error saying "the remote certificate invalid according validation procedure." i tried making call https://www.paypal.com/cgi-bin/webscr instead , return t "invalid". this appears ssl issue: error message caused because process not being able validate server certificate supplied server during https (ssl) request. first troubleshooting step should see if server supplied certificate , every certificate in chain trouble free.

php - call rest api service from jquery -

i trying understand restful services.i can create class , define function when call through jquery return null , when call directly typing url in address bar return json response this code class api extends rest { public function processapi() { $func = strtolower(trim(str_replace("api/","",$_request['request']))); if((int)method_exists($this,$func) > 0) { $this->$func(); } else { $this->response('',404); // if method not exist in class, response "page not found". } } private function json($data) { if(is_array($data)) { return json_encode($data); } } public function demo() { $error = array('status' => '200', "msg" =>

javascript - google map - close infowindow when click on map -

i'm struggling close action infowindows in rails app. my js: <script type="text/javascript"> $(document).ready(function(){ var raw_markers = <%=raw @hash.to_json %>; function createsidebarli(json){ return json.sidebar; //return ("<li>" + json.titre + ' ' + json.address + "</li>"); }; function bindlitomarker($li, marker){ $li.on('click', function(){ handler.getmap().setzoom(14); marker.setmap(handler.getmap()); //because clusterer removes map property marker marker.panto(); google.maps.event.trigger(marker.getserviceobject(), 'click'); }); }; function bindlitomarkermouseover($li, marker){ $li.on('mouseover', function(){ handler.getmap().setzoom(14); marker.setmap(handler.getmap()); //because clusterer removes map property marker marker.panto(); google.maps.event.trigge

reporting services - SSRS Multi Level List -

Image
i trying set list multiple levels. having troubles setting data , wondering if provide suggestions. my list of data: | part # | previous part # | ---------------------------- part1 sub-part1 part1 sub-sub-part1 sub-part1 part2 sub-part2 part2 part3 part4 part5 sub-part5 part5 what looking list below: part1 sub-part1 sub-sub-part1 part2 sub-part2 part3 part4 part5 sub-part5 what getting in ssrs exact copy of list of data. part# shows multiple times each assembly. how set data in order achieve result described above? thanks! assuming ssrs 2008 or above, can use hierarchy groups achieve this. some sample data: as per msdn article, set group based on part , , set recursive parent parentpart : i have simple table based on this: to padding , set part textbox left padding value expression-based: =cstr(2 + (level()*10)) + "pt" looks requirement:

ruby on rails - Youtube gdata and search term having "&" -

i have following code let program search youtube gdata. class youtube def search_url(term) url = "https://gdata.youtube.com/feeds/api/videos" url += "?q=#{term}&alt=json&restriction=us&max-results=50&orderby=viewcount" url += "&fields=entry(id,title,yt:noembed,media:group(media:description),author(name),yt:statistics(@viewcount))" url += "&key=#{dev_key}" however, when tested program, seems fails search when search term contains "&", popular duo artist "macklemore & ryan lewis". "&" might not cause of failure. suspect it. if think "&" not cause, think cause of failure? if think "&" cause, how can fix it? you need escape term before sending url parameter: require 'cgi' def search_url(term) term = cgi.escape(term) url = "https://gdata.youtube.com/feeds/api/videos" url += "?q=#{term}&

sublimetext2 - Sublime Text selection using Lua/love2d -

say have line of code : object.property.field; object.property:functionname(); in sublime languages if double click "property" on either line, select word. reason lua/lua love2d syntax highlighting selects whole line ":" how can change behavior, select single word? the reason occurring because of strange addition lua love plugin, assume you're using. you're using sublime 2, select preferences -> browse packages... open packages folder, open lua love subfolder. there file called completions.py , has content: #completions.py import sublime import sublime_plugin import re class lovecompletions(sublime_plugin.eventlistener): st = 3000 if sublime.version() == '' else int(sublime.version()) def on_query_completions(self, view, prefix, locations): if self.st < 3000 , ("lua" in view.scope_name(locations[0])): seps = view.settings().get("word_separators") seps = sep

ajax - Javascript facebook comments too many refreshes -

i have page kind of infinite scrolling. means homepage loads n posts everytime user reach bottom of page. every post has facebook comments loaded xfmbl way: after ajax had loaded post, following script parse facebook plugin: $( document ).ready(function() { fb.xfbml.parse(document.getelementbyid("<?php echo $_id ?>"), function() {}); }); actually "infinite scrolling" not give me problems beginning. in fact when load whole page, supposing site firstly load 5 posts fill screen, every facebook comments refreshed 5 times. after have no other problems (every post loaded later doesn't give problems). can me? in advance based on answer: fb.xfbml.parse() on individual element nothing what can following: on success callback (when requesting new posts), first, create unique id posts. in above example, can use: newdivname = "d" + string(new date().valueof()); then cache newly requested post (a

python - Assign Raster band to variable name in Loop - "can't assign" error -

i want write 2 nested loops iterate on rgb bands of series of 8 jpg images. later on these images shall combined 1 array channel channel, each array of channels first has have proper name: for colorband in [1, 2, 3]: eighth in range(0,8): rastername="20140525-16-20-00_full_"+str(eighth)+"_0.jpg" raster =gdal.open(rastername) band = raster.getrasterband(colorband) "eighth_"+str(eighth)+"_"+colorband = band.readasarray() unfortunately, returns "can't assign function call" error. couldn't find proper answer how solve in other questions. can help? the error in line: "eighth_"+str(eighth)+"_"+colorband = band.readasarray() it appears trying create variable name , assign result of band.readasarray() . you create dictionary, color_dict , make "eighth_"+str(eighth)+"_"+colorband key , use assign value of band.readasar

.net - Replacing the appendLine in string builder in c# -

i have stringbuilder builds string. after processed, saves sql server table used csv. how replace part of string including newline? the code is: stringbuilder temp = new stringbuilder(); temp.appendline("\"text 1 \""); temp.appendline(""); temp.appendline("\"my text \""); temp.appendline(""); temp.appendline("\"text 2 \""); temp.appendline(""); i want replace middle part can't correct because of newlines/carriage returns. temp = temp.replace("\"my text \" "); how grab newlines? if want replace new line charcater, use '\n' (a special charcater) : temp = temp.replace("\n","your_replacing_string"); or use environment.newline : temp = temp.replace(environment.newline,"your_replacing_string"); if want not append new line character in string builder : instead of appendline() , use append() not inser

Can I pass different parameters to my php function depending on CSS3 media queries? -

i have php function 'limitwords' limit words of text coming database. when call function need pass number of characters want show: lmword($readdatabase['content'],300) it possible execute function in different way, depending on width of device? because, im using media queries in project, , want execute limitwords() function in different way differentes media queries. for example mobile, don't want 300 characters, want 150. possible this?

ios - Scale circle uivew just big enough to fill screen -

Image
i automate scale factor of many uiviews have cornerradius set circles. idea these 20 circle uiviews, of varying sizes , location, scale fill screen no matter size, location etc when tapped. my code has hard coded value make intelligent: [uiview animatewithduration:0.2 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ self.layer.affinetransform = cgaffinetransformmakescale(15.0f, 15.0f); } completion:^(bool finished) { }]; yes - type in 20 cgaffinetransformmakescale bigger circles scaling larger no reason - might need scale 11 instead. what way factor original size fixed, larger size? note: circle uiview, being rounded, should scale big enough rounded edges not visible - needs scale beyond screen fill in gaps @ corners. conceptually, want center circle in screen, scale screen rect inscribed in circle. here's handy diagram: from center of screen, can draw triangle corner. hypotenuse of triangle desired circle radius. here's code t

spring - java.lang.ClassNotFoundException even though I specify -cp argument to the class file -

this question has answer here: getting java.lang.classnotfoundexception though i've specified correct jar -cp 2 answers i'm not sure why having issue. here's i'm running on linux command line: sudo java -jar gs-rest-service-0.1.0.jar -cp ./hello java.lang.classnotfoundexception: hello.application sudo java -jar gs-rest-service-0.1.0.jar -cp hello java.lang.classnotfoundexception: hello.application tried both ways, ./ , without. tried this: sudo java -jar gs-rest-service-0.1.0.jar -cp ./main/java/hello java.lang.classnotfoundexception: hello.application again , without ./. when view jar file see application.class file in main/java/hello lower case. here's manifest.mf manifest-version: 1.0 class-path: ./hello update: got working. here had issue in pom.xml file had specified start-class hello.application package names kept messing around

javascript - How to array(per line) textarea -

good morning! please body or give sample code how read text value (per line) <body onload="displayresult()"> <table align="center"> <tr> <td> <?php $query2="select * upload1 name='xmlsample1.xml'"; $result1=mysql_query($query2); $row = mysql_fetch_array($result1); ?> <form action=""> <textarea id="validxml" rows="50" cols="100"> <?php echo $row['content']; ?> </textarea> <br><br> <input type="button" value="verify xml" onclick="validatexml()" /> </form> </td> </tr> </table> </body> access value of textarea and split newline console.log(document.getelementbyid('validxml').value.split("\n")); jsfiddle

java ee - Factory class with database connection in spring -

i need write factory class calls database , stores data static object. know how write normal java. not able in spring. able pattern, not getting database connection when "factory-method" called. below code public class applicationsettingsdao { private static applicationsettingsdao objsettings = null; // new applicationsettingsdao(); @autowired private datasource datasource; private applicationsettingsdao() { getdbconncection(); } public void setdatasource(datasource datasource) { this.datasource = datasource; } public datasource getdatasource() { return this.datasource; } public static applicationsettingsdao getinstance() { if (objsettings == null) { synchronized (applicationsettingsdao.class) { if (objsettings == null) { objsettings = new applicationsettingsdao(); } } } return objsettings; } public void getdbconncection() { system.out.println("datasource -> " + data

angularjs - categorised dropdown select2 -

i using select2 multi select dropdown, , works problem is, want categorise drop down list of same. here code <script src="/static/select2.js"></script> <input type="hidden" id="test" value=""/> and js $(test).select2({ data:data, multiple: true, width: "100%", placeholder:"none selected", closeonselect:false, }); this should work: $(test).select2({ data: [ { text: 'greetings', children: [ { 'id': 1, text: 'hai' }, { 'id': 2, text: 'hellow'}, ] }, { text: 'questions', children: [ { 'id': 3, 'text': 'yes' }, { 'id': 4, 'text': 'no' } ] } ], multiple: true, width: "100%", placeholder: "none selected", closeonselect: false, });

php - SQL statement to display in group of certain column -

i @ project of creating scheduling system based on web. want data database, , display in table (schedule format). in database, have 2 table schedule id date day 1 22/09/2014 monday 2 23/09/2014 tuesday block block_id schedule_id worker shift 1 1 ahmad 1 2 1 abdul 1 3 1 faris 2 4 2 iqbal 2 each day of schedule has several block , schedule_id (in block) refer day should be. coloumn shift (in block) defining block morning (shift=1) , evening (shift=2), i want display this date day morning evening 22/09/2014 monday ahmad faris abdul 23/09/2014 tuesday iqbal i have tried create sql statement like select schedule.date, schedule.day, block.worker schedule left join block on schedule.id = block.schedule_id but table isn't in appropiate format date day morning evening 22/09/2014 monday ahmad

php - autofill text box from database value based on 1st textbox value -

i trying autofill values textbox database based on value entered in text box. should dob enter name. i tried following example http://www.htmlblog.us/open-source/jqueryautocompleterelatedfields.html dont know why not working me. here code html <form name="appointment" method="post" action="apponiment_submit.php" enctype="multipart/form-data" onsubmit="return validate()"> <table class="selection"> <tr><td colspan="3"><center><font color="red"><strong>fields marked star compulsory</strong></font></center></td></tr> <tr><td>patient name :</td><td><input type="text" name="p_name" id="p_name" /><strong><font color="red">*</font></strong></td></tr> <tr><td>dob :</td><td><input type="text&qu

jquery - javascript function containing ajax do not work after submit but work with button click event -

it strange. have function ajax works great: function searchproduct(){ var barcode=$.trim($('#barcode1').val()); $.ajax({ type: 'get', url: 'http://.............', data:{ action: "search", var: barcode, }, cache: false, datatype: 'json', success: function(output){ when call function form submit event, way, error function of ajax. <form id="searchbox" name="searchbox" onsubmit="searchproduct()"> but if call function button click event works , success() <span class="tab-label" onclick="searchproduct()">scan</span> what think this? form submit send httprequest web server, wonder why want send ajax request along that. onclick simple event can use trigger ajax request, not send other httprequest server.

c# - Why I can't upload sqlite file to the OneDrive? -

i developing windows runtime universal application. i need upload database i'm using in application user's onedrive? but filenotfound exception occurs. know path correct. since refer sqlite file, shows exception. if refer txt file, uploading process goes smoothly. var authclient = new liveauthclient(); var authresult = await authclient.loginasync(new string[] { "wl.skydrive", "wl.skydrive_update" }); if (authresult.session != null) { var liveconnectclient = new liveconnectclient(authresult.session); var filetoupload = await applicationdata.current.localfolder.getfileasync("text.sqlite");//exception occurs here var filetoupload = await applicationdata.current.localfolder.getfileasync("text.txt");//no exception txt files var folderdata = new dictionary<string, object>(); folderdata.add("name", "folder") liveoperationresult operationresult = await liveconnectclient.post

locale - Required to get current nepal year only in php ?? Is there any solution? -

i current year i.e 2014 <?php echo date('y');?> . want nepal current date 2071.how nepal date u please me nepal current date.is there way current nepali year <?php echo date('y');?> . you use carbon this: https://github.com/briannesbitt/carbon the formula is: datetoday + 56 years + 8 months + 15 days to in carbon: <?php $todaysdateingregorian = carbon::now(); $currentdateinnepal = $todaysdateingregorian->addyears(56)->addmonths(8)->adddays(15); ?>

ios - UILabel is always nil -

i have following problem. this code: gtsearchviewcontroller* vc = [[gtsearchviewcontroller alloc] initwithnibname:@"gtsearchviewcontroller" bundle:nil]; vc.headlinelabel.text = [[self.categoriearray objectatindex:indexpath.row] valueforkey:@"categoryname"]; [appdelegate().centerviewcontroller pushviewcontroller:vc animated:yes]; as can see, try push new viewcontroller xib file , want set string in headlinelabel array self.categoriearray . when searchcontroller gets pushed, works perfect, headlinelabel nil . i don't understand why, thought don´t need call "alloc-init" in searchcontroller because build interface builder? your problem changing ui before loaded. you should set label's text in viewdidload of view controller (it called after view loaded). make nsstring property in searchviewcontroller cl

javascript - Twitter API user timeline extraction in Node.Js -

i use twit node.js module , while works i'm having 1 problem. i want able extract tweets made authorized user of app. when authorize in twitter using twit module send following data: var t = new twit({ consumer_key: 'xxxx' , consumer_secret: 'xxxx' , access_token: 'xxxx' , access_token_secret: 'xxxx' }); suppose authorize user through passport module or - data need replace above result want? thank you! login twitter, , go dev.twitter.com , find link "manage apps" redirect apps.twitter.com, there find "create new app" button, click on , fill form. after creating app go application created , go "keys , access tokens" tab , click on "generate consumer key , secret" copy "consumer key" "consumer secret" "access token" "access token secret" , put in code. if using passport authentication use following code logging