Posts

Showing posts from August, 2010

java - Parse Integer error -

for reason cant string number value convert integer error run: exception in thread "main" java.lang.numberformatexception: input string: "6327818260" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.integer.parseint(integer.java:495) @ java.lang.integer.parseint(integer.java:527) @ mydirectory.getsize(mydirectory.java:18) @ a19010.main(a19010.java:79) java result: 1 if input string "6327818260" why can't become integer? code is public string getsize() { int intsize = integer.parseint(mysize); int count = 0; string datatype = ""; while (intsize > 1000) { intsize = intsize / 1000; count++; } switch (count) { case 0: datatype = "bytes"; break; case 1: datatype = "kb"; break; case 2: datatype = "mb"; break; case 3: datatype = "gb"; break; case 4: dat

optimization - MySQL: optimize query for scoring calculation -

i have data table use calculations. resulting data set after calculations looks like: +------------+-----------+------+----------+ | id_process | id_region | type | result | +------------+-----------+------+----------+ | 1 | 4 | 1 | 65.2174 | | 1 | 5 | 1 | 78.7419 | | 1 | 6 | 1 | 95.2308 | | 1 | 4 | 1 | 25.0000 | | 1 | 7 | 1 | 100.0000 | +------------+-----------+------+----------+ by other hand have other table contains set of ranges used classify calculations results. range tables looks like: +----------+--------------+---------+ | id_level | start | end | status | +----------+--------------+---------+ | 1 | 0 | 75 | danger | | 2 | 76 | 90 | alert | | 3 | 91 | 100 | | +----------+--------------+---------+ i need query add corresponding 'status' column each value when calculations. currently, can adding followi

linux - Siege startup error - unable to connect to socket -

i'm running 64x ubuntu 12.10 , trying use siege 2.70. problem when i'm trying test ip address of server or example google.com ip - 173.194.39.130 siege -g http://173.194.39.130 i following error: [error] socket: unable connect sock.c:222: connection refused and that's it. when siege -g http://www.google.com i same error , 200 valid response. what cause problem ? there bug in earlier versions of siege prevented use of ip addresses on systems. downloading , compiling latest version of siege (>3) issue should resolved.

Java web applet fails to start in Java 1.7.0_21 -

we have java applets deployed have worked fine until now. actually, continue run fine on 32 bit machines, on 64 bit machines stopped yesterday. the last line of error is... match: running jvm args mismatch: have:<-dsun.java2d.noddraw=true -dsun.java2d.noddraw=true> !satisfy want:<> here .jnlp file <?xml version="1.0" encoding="utf-8"?> <jnlp href="app.jnlp"> <!--<jnlp codebase="http://www.url.edu/directory" href="app.jnlp">--> <information> <title>app via web start</title> <vendor>school</vendor> <homepage href="http://www.url.edu"/> <description>application</description> <description kind="short">application</description> <offline-allowed/> </information> <security> <all-permissions/> </security> <resources> <j2se version="1.5+"/> <property name="

javascript - How to make the node version of lessc or recess compile with development output for FireLESS -

the following code can used browser/live version of less. how can command line version? <script type="text/javascript"> less.env = "development"; </script> that impossible. lessc compiler compiles less code static css code. when running less in browser explained http://lesscss.org/usage/#using-less-in-the-browser less code compiled less.js compiler. less.js runs client side in browser , can send message console (which can read fireless).

ios - Why is my image upside down after using CGContextSetFillColorWithColor -

i trying apply color fill mkannotation. found code pretty works reason filled image upside down after applying fill it. here current code running on map pin. cgrect rect = cgrectmake(0, 0, self.image.size.width, self.image.size.height); uigraphicsbeginimagecontext(self.image.size); cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextcliptomask(context, rect, self.image.cgimage); cgcontextsetfillcolorwithcolor(context, [[uicolor graycolor] cgcolor]); cgcontextfillrect(context, rect); cgcontextrotatectm(context, 90); uiimage *img = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); uiimage *flippedimage = [uiimage imagewithcgimage:img.cgimage scale:1.0 orientation:self.image.imageorientation]; self.image = flippedimage; here pins after code runs. http://d.pr/i/uapu i thinking if applied current image orientation flippedimage trick did not work. tried s

google glass - Sharing a photo with text -

the "add cat that" example explains how share photo service. but there way share photo text (using voice recorder) in single item ? yup! can using reply built-in menu item . however, flow bit different add cat that flow. works this: subscribe updates timeline collection. insert timeline item reply built in action specified shown here . optionally, can rename menu item , customize icon. { "text": "hello world", "menuitems": [ { "action": "reply" } ] } the timeline card have reply option in menu. when user selects it, prompted speak. a new timeline card created contains text transcription , has attached audio recording. glassware has access card. your glassware notified item insertion. notification looks this: { "collection": "timeline", "itemid": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg", "operation": "insert", &

iphone - UIPickerView selectRow:inComponent:animated not working in viewDidLoad but working in viewDidAppear -

this issue driving me crazy. have uipickerview loaded in viewdidload, , need initialize selected row appear on screen. code follows: self.pickerskins.delegate = self; [self.pickerskins reloadallcomponents]; nslog(@"%d", [self.pickerskins numberofrowsincomponent:0]); [self.pickerskins selectrow:1 incomponent:0 animated:no]; i have put in viewdidload. nslog logs value of 2. however, selected row pops first row , not second. if put selectrow in viewwillappear, doesn't work. if put selectrow in viewdidappear, pickerview appears , goes second row. update: if have more 2 rows, method works correctly viewdidload, unless scrolling last row. method never works in viewdidload or viewwillappear if scrolling last row. idea why is? thanks. how selected row second row before view appears? thanks.

jsf - Issues with javascript not functioning and validating -

i trying use javascript validate inputs, nothing major, thought nice finishing touch jsf project the backing bean has validation not accept inputs less 1, on 50, jsut wanted use js have use , nice give user information i have : <h:body> <h:form id="myform" onsubmit="return validateform()"> <p> number of copies (max of 50) : <p:spinner id ="copies" min="1" max="50" value="#{printersettings.p}" size ="1"> <!-- allows user choice of 50, more enough situation, if needed can removed or raised --> <p:ajax update="p"/> </p:spinner> <div class="whitespace"/> <h:outputtext value="copies printed: &nbsp; #{printersettings.p}" id="p"/> </p> ............. </div> <script type="text/javascript"> function validateform() { var x = document.forms["myform"

asp.net mvc - Silverlight rises an exception when hosted in MVC web page -

i have silverlight project works when run independently (i.e. run instance), when run mvc website rises exception says unhandled error in silverlight 2 application object reference not set instance of object. @ takingmypicture.mainpage..ctor() @ takingmypicture.app.application_startup(object sender, startupeventargs e) @ ms.internal.coreinvokehandler.invokeeventhandler(uint32 typeindex, delegate handlerdelegate, object sender, object args) @ ms.internal.jolthelper.fireevent(intptr unmanagedobj, intptr unmanagedobjargs, int32 argstypeindex, int32 actualargstypeindex, string eventname, uint32 flags)

java - Close server button problems -

i new java. start server button jbutton startserverbutton = new jbutton("start"); startserverbutton.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { if (e.getactioncommand().equals("start")) { runnable serverrunnable = new runnable() { public void run() { runserver(); } }; thread serverthread = new thread(serverrunnable); serverthread.start(); } } }); and want close button jbutton endserverbutton = new jbutton("end"); endserverbutton.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { if (e.getactioncommand().equals("end")) { closeconnection(); } } }); but close button doesnt work... please help! here's close function

Facebook Ads API: how does offline_access work? -

if have preferred developer app access ads api can ask offline_access permission, according docs how work? when obtain token, like: access_token=hehehehehe&expires=5183795 .. mean token expires in 2 months usually. extended automatically? or have additional action non-expiring token? after time, found answer. if have whitelisted app, you'll don't expired field in response: access_token=hehehehehe this works whitelisted apps whether ask offline_access or not.

plotting two functions on the same trendline in matlab -

this original code: function = graph_times() merge_times = []; = 100:100:1000 curr = sort_timer(i); merge_times = [merge_times, curr(1)]; end plot(100:100:1000, merge_times); = 1; end i want modify code plots trendlines both insertion_sort , merge_sort on same graph. below functions merge_sort , insertion_sort function c = insertion_sort(list1) inserted = []; = 1:size(list1,2) inserted = insert_in_order(inserted,list1(1,i)) c = inserted end steps2=0; function b = merge_sort(nums) if size(nums,2) == 1 b = nums; return; end you can give several sets of coordinates matlab's plot function. can plot times of 2 sorting algorithms so: plot(100:100:1000, merge_times, 100:100:1000, insertion_times);

In Vaadin 7.0, how to refresh JavaBean data backing a Table? Replace Container? Replace Beans? -

in vaadin 7.0, when displaying javabean data in table beancontainer , proper way refresh table new data? the table monitors the properties of items of table via listeners. if change property of item via item instance of table, table notified , updated : e.g. container.getitem(beaninstance).getitemproperty("propertyname").setvalue("newvalue"); if, however, bean changed outside of item instance, need tell table refresh. easiest way (using stock beancontainer) remove add items. alternatively - and, suggest, preferably - create extension of beanitemcontainer fires itemsetchange event, cause table refresh. public class refreshablebeanitemcontainer<beantype> extends beanitemcontainer<beantype> { public refreshablebeanitemcontainer(collection<? extends beantype> collection) throws illegalargumentexception { super(collection); } public refreshablebeanitemcontainer(class<? super beantype> type) throws illegalargumen

Xcode 4.5 File Templates - Insert E-mail Address/Website? -

i've been trying edit source code file templates in xcode 4.5 (inside app bundle), achieve more doxygen-friendly header comment format: /*! @file ___filename___ @package ___projectname___ @brief @details @author ___fullusername___ | ___email___ | ___website___ @date ___date___ @version @copyright ___year___ ___organizationname___. rights reserved. @section license */ at first, using old method of editing defaults (either command line or editing com.apple.xcode.plist file in xcode's built in plist editor), changes aren't applied - after restarting xcode. hoped edit organizationname , , add own email , website fields (see code above). i read somewhere oranizationname entered on xcode gui, on per-project basis, got 1 working. still wish expand ___email___ , ___website___ , either preset defaults or (better) address book. possible?

In LESS, is it possible to get image dimension from the bitmap files? -

i found myself hard-coding image width numbers in less stylesheet. it possible have less function automate this? e.g. @banner-width : image-width("image/banner.png"); if using javascript implementation of less (less.js), use javascript interpolation between back-ticks , use normal javascript functionality - this: @banner-width: ~`function(imguri){var img=new image(); img.src = imguri; return img.width }('image/banner.png')`; or go further , make reusable mixins. less: .width(@img) { @width: ~`function(imguri){var img=new image(); img.src = imguri; return img.width }(@{img})`; width: @width; } .height(@img) { @height: ~`function(imguri){var img=new image(); img.src = imguri; return img.height }(@{img})`; height: @height; } .test{ @src: 'http://www.google.com/intl/en_all/images/logo.gif'; .width(@src); .height(@src); } the output css: .test { width: 276; height: 110; } which should logo http://www.goog

java - User authorization on a rest service via an access token -

i have mobile application (html 5, javascript) , restful service (java, jersey) cater mobile application. mobile application sign in handled via facebook (sign in using facebook account). , there no security mechanism integrated restful service so question is, can authorize users on restful service via access token retrieved facebook, mobile application ? further clarify, if has logged mobile he/she should authorized make requests restful service. thanks in advance asanka if user has authenticated facebook , have access token you, can user's facebook profile's public information. you've got hit link - https://graph.facebook.com/me access token. go ahead, click on link , see happens. when pass valid access token, profile info returned json object. (if fb profile page = facebook.com/yourname, try https://graph.facebook.com/yourname -> you'll able see data returned looks like. now, user data returned can keep entry in db if user registered or n

node.js - Using d3.js, mongoose, mongoDB, express properly -

i'm new node.js , i've been reading lot of tutorials , documentation on node.js, mongoose, mongodb, express, etc , feel i'm still not getting something. i want make website data generated querying mongodb , results returned browser visualized in d3.js. i have graph in d3 separate js file (jdriver.js) called in head of jade file. jdriver.js file self-contained in generates buttons, filters, sliders, etc.). i'm not sure how go about, if want apply filter -> query mongodb -> have mongodb return json data file -> redraws new data. and how fit of within framework provided express? kind either point me sources or me out? thanks much.

java - How does one prevent a JList from selecting elements when dragging beyond the end of its list? -

a similar question has been asked here , , while acknowledge it, question's solution doesn't quite solve question. jlist , when clicked on, select index list item closest mouse click. jlist every click+drag event fire. i prevent jlist selecting items during click+drag events when click+drag location outside visible list. how go this? i had considered overriding different method, 1 involved in click+drag events of selecting list items. thought try setselectioninterval() method. jlist<string list = new jlist<string>(){ private static final long serialversionuid = 1l; @override public int locationtoindex(point location) { int index = super.locationtoindex(location); if (index != -1 && !getcellbounds(index, index).contains(location)) { clearselection(); return -1; //an excellent click-only solution prohibit selecting of //items beyond visibl

Google maps android API v2 crashes instantly when opened -

Image
i trying use google maps api v2 android , followed these instructions https://developers.google.com/maps/documentation/android/start and works fine until put code layout file <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.mapfragment" /> once code put in app crashes when opened, picture appears on graphical layout thanks in advance! use support mapfragment <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.supportmapfragment" /> googlemap gm; gm = ((supportmapfragment(getsupportfragmentmanager().findfragmentbyid(r.id.map))).getmap(); gm.setmaptype(googlemap.map_type_normal);

php - PostgreSQL permanent connection: usefull in my case? -

i have php application called get parameters running pg , nginx . page receives message , information. page b makes routing. page c calls external application curl. receive 1-2 millions requests per month when i'll go in production. my question concerns pg_pconnect function. is connection reused if there calls different location? mean, better make simple connection , close everytime page a? (servers different locations call app) page b , c, script call them in infinite loop (waiting 10s if there no message handle). since requests come same location, worthy use permanent connection page b & c? i hope explanation clear enough. thanks! in general, think in case, see benefits persistent connections. there drawbacks, these manageable long keep them in mind. may, however, want go further , consider actual connection pooler. the big issue typically postgresql best when concurrent connections under approx 2 per cpu core plus 1 per disk spindle (due i/o wait ti

c++ - Synchronize asynchronous calls from more than one object -

i have 10 objects. each object different class. requests sent objects (method calls returning values) comes different threads. i need synchronise method calls, 1 must executed @ time. requests have higher priority others. means if there more requests waiting executed , 1 sent - higher priority other waiting execution, shall executed next one. i don't know how solve problem in c++. thinking command pattern require lot of "manual" coding. have convert each method call command object. , problem return value. have idea, pattern can used here? for synchronization, may use form of mutual exclusion 1 thread @ time manipulating object. dealing priorities, want priority queue comparator determining criteria type of request has greater priority. each object accept request action , have priority associated it, , action (like suggested command pattern). using locking mechanism, update priority queue adding record, release it. must lock queue because accessed vi

javascript - Get Address when click on Marker - Google Maps -

i need help. loaded point database , displayed them on google maps markers. code: function displaytraficcir(points) { (i=0;i<points.length;i++){ var mylatlng = new google.maps.latlng(points[i].latitude,points[i].longitude) var marker = new google.maps.marker({ position: mylatlng, map: map }); } } and now, want point's information (latitude/longitude) when click on 1 of these markers in google maps stuff. help, please. thanks. use google.maps.event.addlistener method: function displaytraficcir(points) { (i=0;i<points.length;i++){ var mylatlng = new google.maps.latlng(points[i].latitude,points[i].longitude) var marker = new google.maps.marker({ position: mylatlng, map: map }); google.maps.event.addlistener(marker, 'click', function () { var lng = points[i].longitue, lat = points[i].latitude; alert( lat + "-" + lng ); }); } } demo

iOS store-and-forward framework for offline HTTP POST requests -

is there way (presumably library?) store http post requests when user offline, , transmit post requests when user online? (i don't need read server's response, except insofar i'll want re-queue requests if post request fails.) yes, there such library: http://blog.mugunthkumar.com/products/ios-framework-introducing-mknetworkkit/ it resilient against quits , relaunch of app, , keep trying send request until there persistent failure (such server down, not network down)

c# - Tweetsharp HTTP 403 -

i have problem logging on twitter using asp.net 4 c# , twitterizer. first create twitterservice object twitterservice service = new twitterservice(key , secret); then request token: oauthrequesttoken requesttoken = service.getrequesttoken( "http://127.0.0.1:16608/callbackhandlers/twittercallback.ashx"); then uri: uri uri = service.getauthorizationuri(requesttoken); and redirect: httpcontext.current.response.redirect(uri.tostring()); my app redirected twitter. when enter user id , password http 403 error. if press button on browser twitter no longer asking me enter userid , pwd instead there , authorize button. when press authorize button, twitter redirects site , proceeds expected. i cannot seem enter userid , pwd without getting 403 error. when error browser address showing:- https://api.twitter.com/oauth/authorize please note callback url twitter app setup same 1 in getrequesttoken call above. it appears if twitter not know g

Passing Javascript Variable to PHP using Ajax -

i wanna pass javascript variable in php using ajax... coz wanna pass onclick. i'm getting onclick value variable row. b gratefull :) thank you <script type="text/javascript"> function updatetable(row) { alert (row); var row = (row); } </script> did u try this? $.ajax({ url: 'do.php', type: 'post', data: "userid=" + onlyid, success: onmembersucces, error:onmembererror }); function onmembersucces(data) { alert(data); } function onmembererror() { alert("error!!"); } where do.php php file , onlyid javascript variable. is looking for?

javascript - How to load remaining more results with scoll down to the end of the div? -

i dealing scroll down event display more results when scroll bar goes down end of tag. have division(div) able append tags when scroll bar goes down end. have written following code. in script: <script> $(document).ready(function () { $(window).scroll(function () { if ($(window).scrolltop() + $(window).height() > $('#main').height() - 200 ) { fun(); } }); var fun= function(){ $('p').appendto("#main"); settimeout(fun2, 100); } var fun2=function(){ $("#main").append("<p>hello scroll me</p>"); } }); </script> in body: <div id="main"> <p style='height:100px;'>hello scroll me</p><p style='height:100px;'>hello scroll me</p><p style='height:100px;'>hello scroll me</p><p style='height:100px;'>hello scroll me</p><p style='height:100px;

asp.net mvc - How to query and extract specific markup from an html string using C# in server side? -

i have html string reside in files in server , each user request have select markup id mentioned files , send them client.i wonder, there library .net can sort of job me!?. want achieve thing (with jquery): var sometag = $("#id"); thanks in advance. you might want check out csquery . csquery jquery port .net 4. implements css2 & css3 selectors, dom manipulation methods of jquery, , of utility methods. majority of jquery test suite (as of 1.6.2) has been ported c#.

mysql - In SQL date function for before 2 months -

i mentioned database table structure below, name, expired_date, address, payment_date ---------------------- name1, 2013/06/02, address1,2013/07/23 name2, 2013/06/02, address2,2013/07/23 name3, 2013/04/02, address3,2013/07/23 name4, 2013/05/02, address4,2013/07/23 name5, 2013/06/02, address5,2013/07/24 ... name6, 2013/06/02, address6,..... in table update date in yyyy/mm/dd format . current month april need after 2 records only. example need 06 month records only. i need sql query this. assuming want query expired_date: following query gets records after 2 months current date: select * tablename expired_date>=date_add(curdate(), interval 1 month) if want records june: select * tablename expired_date>='2013-06-01' , expired_date<'2013-07-01'

asp.net mvc 4 - System.Web.Security.Roles.GetRolesForUser(currentUser.Identity.Name) just one time works true -

in internet mvc 4 project, when run project in debug mode,and login application,the role user wich assigned before recognized. function use getting user roles : system.web.security.roles.getrolesforuser(currentuser.identity.name) but when stop debugging, , again run application in debug mode, user authenticated getrolesforuser return string[0]. why occures , doesn't return role? i had same issue , fixed change way of finding roles: var manager = new usermanager<applicationuser>(new userstore<applicationuser>(new plutusdbcontext())); var user = manager.findbyname(currentuser.identity.name); var userroles = manager.getroles(user.id); ps: i'm using microsoft.aspnet.identity 2.0.1

When we use Yii RbAC? -

because actions done via controllers in yii, means of controller filters , checking in actions, security measure can achieved. sure kind of checking faster rbac (if statements wrong please let me know). so when find out it's better use yii rbac? its matter of personal preferences , tendency when authorization requirements more complex. imho, it's easier , more intuitive maintain complex permissions scheme using rbac , gui extension manage (for example, use rbam & srbac extensions).

how to upgrade the sqlite database without lost data? -

i have application in c# uses system.data.sqlite. in case use recent version of sql lite database, can see new versión has released, , int sqlite.org webpage says recommended upgrade database. my question how upgrade without lost information in actual database. how can chech version of data thanks. edit: mean when create new database sqlite3 library, guess database file, database.db has version. when update sqlite3 library, update sqlite3 command line, database file still has version had when created it. so if in new versions example add new features database, example triggers, foreign keys , on, if not wrong, features must in database file, not in sqlite3 library, because when access database example entity framework, don't use sqlite3 library, use system.sqlite.data library. am wrong? datafile never update , library can updated? thanks. upgrading sqlite library not have effect on database file. changes foreign keys not affect database file. last chang

PHP file_get_contents can't get html code -

i have been using following code html content of webpage $url = "http://mysmallwebpage.com/"; $html = file_get_contents($url); however, file_get_contents can't open urls in following form, if type them in address bar of web browser, these urls open fine. www.etsy.com/listing/118415624/not-my-small-diary-17-true-high-school blog.al.com/birmingham-news-commentary/2012/11/naked_art_gallery_gives_back_t.html mysmallwebpage.com/ can please tell me can used open above urls in php? following doesn't work $url = "www.etsy.com/listing/118415624/not-my-small-diary-17-true-high-school"; $html = file_get_contents($url); unless not prefix http:// php won't know want webpage , tries on file-system: $url = "http://www.etsy.com/listing/118415624/not-my-small-diary-17-true-high-school"; $html = file_get_contents($url); if (false === $html) { throw new exception(sprintf('failed open http url "%s".', $url)); }

Twitter Bootstrap's accordion and multiple children -

how expand/show multiple children? service2 not shown. <div class="accordion" id="accordion1"> <div class="accordion-group"> <div class="accordion-heading"> <div class="accordion-toggle group-accordion-toggle"> <a href="#collapseone" data-parent="#accordion1" data-toggle="collapse" class=""><i class="icon-plus"></i></a> <a href="http://www.example.com">operator</a> </div> </div> <div id="collapseone" class="accordion-body collapse"> <div class="accordion-inner"><a href="http://www.example.com/service1">service1</a></div> </div> <div id="collapseone" class="accordion-body collapse">

Implement a Java compiler in android app -

i have university: how implement java compiler , dex converter android app? my process is: i have created new project, main activity. in main activity in method oncreate, add piece of code (take url on top) file storage = getdir("all41", context.mode_private); system.err.println("copying android.jar asssets internal storage make available compiler"); bufferedinputstream bis = null; outputstream dexwriter = null; int buf_size = 8 * 1024; try { bis = new bufferedinputstream(getassets().open("android.jar")); dexwriter = new bufferedoutputstream( new fileoutputstream(storage.getabsolutepath() + "/android.jar")); byte[] buf = new byte[buf_size]; int len; while((len = bis.read(buf, 0, buf_size)) > 0) { dexwriter.write(buf, 0, len); } dexwriter.close(); bis.close(); } catch (exception e) { system.err.println("error while copying assets: " + e.getmessage()); e.printstacktrace(

intent.ACTION_VIEW together with intent.setComponent() -

android: there way send intent.action_view intent.setcomponent(), there in no choose of apps, launch special app (not own) on phone with action_view? (but not work): string url = "http://something"; intent in = new intent(intent.action_view); in.setdata(uri.parse(url)); in.setcomponent(new componentname(packagename, name)); startactivity(in); of cause works: string url = "http://something"; intent in = new intent(intent.action_view); in.setdata(uri.parse(url)); startactivity(in); and too: intent in = new intent("android.intent.action.main"); in.addcategory("android.intent.category.launcher"); in.setcomponent(new componentname(packagename, name)); startactivity(in);

sling - why do we have multiple jsp's for a single component in CQ5? -

i new cq5. while learning concepts came know cq5 uses sling framework request processing , resolves scripts based on best match. have seen few components( of them page or top level components) in cq5 having more 1 jsp under single component(e.g page component have page.jsp, body.jsp, header.jsp similary redirect component have redirect.jsp, body.jsp, content.jsp) . wanted ask in scenarios, having multiple jsp's , script resolved sling display content? the possibility have more 1 jsp under component has bit more sling cq (although cq provides extensions on framework). reason having more jsp's in top level component (like page component example) catch cases of include happening on lower level somewhere (so definition of included file there, actual file not present in component). in opinion there 3 main reasons having multiple jsp's under single component (no matter level) , of reasons can applied same component @ once breaking component in smaller (more main

users cant login without setting the remember me option in yii? -

This summary is not available. Please click here to view the post.

rest - Ember js RESTAdapter PUT request adds .json to the end -

Image
i've been trying learn ember , have question. in store i'am getting data .json below. have tried without buildurl function cant load json file, found solution on so. cocktailapp.store = ds.store.extend({ revision: 12, adapter: ds.restadapter.extend({ bulkcommit: false, url: "http://localhost:8888", buildurl: function(record, suffix) { var s = this._super(record, suffix); return s + ".json"; } }) }); now comes question: when commit chances (by pressing add favs or remove favs) restadapter adds ".json" @ end of put request. see below code , screenshot cocktailapp.cocktailcontroller = ember.objectcontroller.extend({ addtofav: function () { this.set('fav',true); this.get('store').commit(); }, removefromfav: function () { this.set('fav',false); this.get('store').commit(); } }); i think thats why put request can not handled. if remove builturl function no json loaded @

ruby - Rails 4- Associations -Tutorial Movielist -

hi trying use rails on rest 2 - movielist tutorial rails 4 , making adjustments go new rails. stuck on associations of movies roles. have added movie.rb class movie < activerecord::base has_many :roles, :dependent => :destroy has_many :people, :through => :roles validates_presence_of :title def new_role=(values) values.each |i, hash| unless hash[:name].blank? roles.create(:person_id => hash[:person_id], :name => hash[:name]) roles.save end end end def deleted_roles=(values) values.each |role_id| roles.find(role_id).destroy end end end and show _form.html.rb render (excert below) <b>add new people</b><br /> <% (1..3).each |i| %> <%= select_tag 'movie_new_role_person_id', options_for_select(@people), { :name => "movie[new_role][#{i}][person_id]" } %> <%= text_field_tag 'movie_new_role_name', '', {

c# - How to get all Products within a Category or sub-category -

i'm trying products within 1 category, want search categoryid. want list filled products categoryid example 3. how can this, i'm using nopcommerce 3.10. someone on nop forum achieved using following line: _productservice.searchproductvariants(categoryid, 0, string.empty, false, 0, int.maxvalue, false); but since use 3.10 , productvariants replaced products, can't use this. thanks in advance! i figured out myself: for products within 1 categoryid: nopengine _engine; /// <summary> /// returns ipagedlist(product) filled products selected categoryid /// </summary> /// <param name="categoryid"></param> /// <returns></returns> public ipagedlist<product> getallproductsfromcategory(int categoryid) { _engine = new nopengine(); var _productservice = _engine.resolve<iproductservice>(); list<int> c

javascript - How to populate ul from external html using append -

i'd populate existing list unordered list has 10+ li's. i'd populate js or jquery html file containing li's or i'd populate ul li's commented html. <div class="lcatnav categorynavigation"> function write_list_item(){ var items = document.getelemntbyid("lcatnav categorynavigation"); is possible? so far i'm trying append ul using function element id (the ul) append said ul bunch of variables. isn't working well! using html dom can list name using document.getelementbyid("mylist"); you can set variable equal element or work directly using appendchild() method. document.getelementbyid("mylist").appendchild(newlistitem); or var list = document.getelementbyid("mylist"); (var = 0; < elements.length; i++) list.appendchild(elements[i]);

c# - Iterating through alphabet and get newly created strings back to their original Button Form -

after long search found winning strategy clean code on hangman game, explanation needed understand. when game opens, wanted letter buttons disabled. created method that, private void disableletters(); { a.enabled = false; b.enabled = false; . . . z.enabled = false; } effective not elegant. iterating through alphabet try , condense code seemed logical. private void disableletters() { char alphebetstart = char.parse("a"); char alphabetend = char.parse("z"); (i = alphabetstart; <= alphabetend; i++); { string allletters = i.tostring(); } } but challenge appeared starting because couldn't use these newly created strings button forms this, i.tostring().enabled = false; for obvious reasons. strings needed understood original form. the long search revealed solution, don't understand quite it's doing. magic was, controls[allletters].enabled = false; the "controls" reveals cryptic

c# - Avoiding repetition in Interface contract classes -

we want use code contracts on our interfaces. have large interface hierarchy, leading awful lot of duplication in contract classes. we have interface ix (through inheriting other interfaces) has around 50 methods. there several interfaces derive ix . interface iy inherits ix , adding couple of methods. if want add contract class iy , need reference 50+ methods. worse, if later on decide modify ix , have change contract classes interfaces inheriting ix . discourages developers making changes. is there way of avoiding duplication? i don't believe possible, no. can't derive 1 interface contract class another, , interface contracts classes can't have base class other system.object. think you're stuck. best way forwards involve kind of code generation tool, or lots of copy-and-pasting.

ruby on rails 3 - MiniMagic resize -

im using minimagick resize images on server. having issues forcing dimensions on it. minimagick git documentation states uses mogrify commands. looking further, there sever commands can use in resize such as: -resize "230x200>" -resize "230x200<" -resize "230x200!" i looking use ! seems not working. img = sftp.download!("local_promos/#{@image_name}") ri = minimagick::image.read(img) ri.resize "230x200!" # ! ignored , not resize ri.write('#{img_dir}#{@image_name}') i ran mogrify command in command , worked fine. seems issue? the problem gem mini_magic. using -v 3.5.0. escaping string using shellwords.escape(value.to_s) newer version 3.6.0 fixed issue.

Openshift authenticity of host cant be established, when creating app -

i try create app in openshift alwas following error during process: **cloning 'firstapp'... the authenticity of host 'firstapp- * * .rhcloud.com ( * ** )' can't b e established. rsa key fingerprint * ** * ** * ** * ** * ** * ** * ** * .** i used rhc setup create ssh keys , succesfully transfered openshift account. did miss or did wrong? when create app, relevant snippet get: cloning 'tsunade23'... authenticity of host 'tsunade23-*.rhcloud.com (a.b.c.d)' can't established. rsa key fingerprint *:*:::::*:*. no matching host key fingerprint found in dns. sure want continue connecting (yes/no)? so, seeing last 2 lines snippet when create app? if yes, type 'yes' , should go. let me know if isn't case.

javascript - If mouse reaches far left of screen perform an action -

hi im looking way if mouse moves far left or right of screen action performed there way html css jquery etc? im trying navbar show when mouse reaches left end of screen. appreciated see here http://api.jquery.com/mousemove/ based on examples, can use pagex , pagey determine position of mouse. have this: $("body").on("mousemove",function(event) { if (event.pagex < 50) { // } });

javascript - JSON string parameter not working -

i'm having trobule json parameter. here's part of code: <script type="text/javascript"> $("#deco").click(function () { var cap = document.getelementbyid('canvasvideo').todataurl(); var canvas = document.getelementbyid('captimage'); var context = canvas.getcontext('2d'); var imageobj = new image(); imageobj.onload = function () { context.drawimage(imageobj, 0, 0); }; imageobj.src = cap; //var cap = 'hardcoding' ; if hardcode text, , pass parameter, works. $.getjson('/home/decodeqr', { img : cap }, function (iddonante) { document.getelementbyid("result").value = iddonante; }); }); </script> in server side, i've got following: [acceptverbs(httpverbs.get)] public jsonresult decodeqr(string img) { var iddonante = getidqr(conversi