Posts

Showing posts from July, 2012

java - Spring not giving current session without marking @Transactional -

java - Spring not giving current session without marking @Transactional - using spring sessionfactory injection. @suppresswarnings("unchecked") public void getdata() { system.out.println("%%%% hibernate fetching info %%%% "); session session = factory.getcurrentsession(); /* * seek { thread.sleep(10000); } grab (interruptedexception e) { // todo * auto-generated grab block e.printstacktrace(); } */ list<address> addresses = session.createquery("from address").list(); system.out.println("total connectins = " + factory.getstatistics().getconnectcount()); (address address : addresses) { system.out.println(address); } } above code giving exception org.hibernate.hibernateexception: no session found current thread but when method marked @transactional it's working fine. don't want transaction enabled...

ip - Why do we need IPSec VPN rather than SSL? -

ip - Why do we need IPSec VPN rather than SSL? - ipsec vpn security provided @ network layer next facilities: authentication info integrity confidentiality anti-replay but making set more costlier using ssl @ application layer . for example: http uses ssl talk web server so, why people utilize vpn? you pretty much gave reply yourself: encryption on network layer provides security all traffic goes through it, instead of each application having implement own security model. vpns used in different scenarios typical http request. typically utilize vpns bring together intranet outside , utilize network internal services. doing via vpn means need expose 1 network entry point outside world. otherwise you'd have expose every single service outside world, and implement individual security models each. ssl ip vpn

c - Strange CreateFile behaviour -

c - Strange CreateFile behaviour - strange createfile behaviour. tiring open file handle hfile = createfile(l"e:\\temp\\1.txt", generic_read, file_share_write, null, open_always, file_attribute_normal, null); if (hfile == invalid_handle_value) { printf("could not createfile\n"); return; } file opened no error (don't know target file).. reason in directory application running empty file "e"(wiout extention) created during createfile call. wrong here? get rid of l prefix of filename string. calling narrow version of createfile ( createfilea ) , passing in wide string. alternatively, can set vs build app using unicode. in either case, should utilize _t() macro set appropriate string type. i.e. handle hfile = createfile(_t("e:\\temp\\1.txt"), c winapi

Why do I see so much C code that omits a return type for main? Why does it work? -

Why do I see so much C code that omits a return type for main? Why does it work? - i went website compiles c online , saw main function declared without homecoming type. i'm aware of questions concerning topic here, didn't find omitting homecoming type. tried compile code using gcc , worked. does mean if don't set homecoming type on main , assume int (or other type)? the c89 standard, preserve compatibility original k&r version of c did not have function prototypes know them, allowed functions implicitly homecoming int . function declared without explicit homecoming type (i.e., void , float , etc.) assumed compiler homecoming int . thus, when main function declared without homecoming type, assumed homecoming type int . , good, since main supposed homecoming int , according standard. however, changed in c99. default/implicit int rule removed language specification. functions without explicit homecoming type no longer assumed homecoming...

java - Traverse JDateChooser with Enter Key -

java - Traverse JDateChooser with Enter Key - i input validation when come in key pressed in jdatechooser . know in jtextfield elements possible add together actionlistener whereby come in key fires action. however, when add together actionlistener , press come in in date chooser, action not received. in below example, pressing come in key when programme first starts fires action in jdatechooser , focus traverses next component expected. however, in subsequent traversals, have come in character before action fired. action fired in 2 jtextfield elements expected. can explain why come in key not behave same when adding actionlistener editor of jdatechooser ? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.emptyborder; import com.toedter.calendar.jdatechooser; public class dateexample extends jframe implements actionlistener { private static final long serialversionuid = 1l; private jpanel contentpane; p...

ios 8 Photos framework - replace photos not working -

ios 8 Photos framework - replace photos not working - i'm playing around new ios 8 photos framework, trying edit existing photo in library replacing it's not replaced, if can see success log messages i've set. here's code : uiimage *output = [self.imageview.image appenddatewithlabel:label]; self.imageview.image = output; // self.info retrieve uiimagepickercontroller delegate method nsurl *asseturl = self.info[uiimagepickercontrollerreferenceurl]; phfetchresult *result = [phasset fetchassetswithalasseturls:@[asseturl] options:nil]; phasset *asset = result.firstobject; if ([asset canperformeditoperation:phasseteditoperationcontent]) { [asset requestcontenteditinginputwithoptions:nil completionhandler:^(phcontenteditinginput *contenteditinginput, nsdictionary *info) { phcontenteditingoutput *contenteditingoutput = [[phcontenteditingoutput alloc] initwithcontenteditinginput:contenteditinginput]; nsdata *outputdata = uiimagepngrepresentation(o...

php - html form-- need help having new input area populate if radio button is clicked -

php - html form-- need help having new input area populate if radio button is clicked - i making basic new client database mysql , php. when people click on radio button"different mailing address" couple of input fields appear mailing address. im not quite sure how handle inputs , not variables. there way if statement here html form code below <form method="post" action="insert.php"> <fieldset> <legend>new client data</legend> <label>complete below</label> <div class="controls controls-row"> <input class="span4" name="firstname" type="text" placeholder="first name"> <input class="span3" name="lastname" type="text" placeholder="last name"> <input class="span3" name="phone" type="text" placeholder="phone"> </div> <div class=...

html - What's going on with my CSS print? -

html - What's going on with my CSS print? - here css code: @media print { body * { visibility:hidden; } #printable * { visibility:visible; } #printable { margin:0px; color : #000000; background : #ffffff; filter: gray(); filter: url('#grayscale'); -webkit-filter: grayscale(100%); filter: grayscale(100%); top:0px; left:0px; } @page { size:auto; margin:0mm; } } i have div this <div class="row" id="printable"> ... </div> when print in web upper part has much blank , main content start half in paper. there wrong css? sorry if cant show image.. error!...

mysql - mysqldump performance on machine with big amount of memory -

mysql - mysqldump performance on machine with big amount of memory - i'm doing backup of innodb database mysqldump. takes 2 min perform backup. there way how speed up? i have machine 120gb of ram , expect db should fit in memory. database size on hard drive around 8 gb: [user@host:e018 mysql]$ du -hs database 8.3g database biggest table has 12054861 records , info size 2991587328. i have tried play innodb_buffer_pool_size don't see big performance increase. if run mysqldump first time takes 2 min 7 sec. if seek sec time takes around 2 min slow. i have tried archive info avoid lot of disk writes: mysqldump database |pigz > database-dmp.sql.gz has no influence on performance. running mysqldump on different machine mysql engine not alter anything. mysql not cache info memory or sends info mysqldump slow. here configuration use: max_heap_table_size=10g; innodb_file_per_table=1 innodb_file_format=barracuda innodb_strict_mode=1 innodb_writ...

python - Fetching Image from URL using BeautifulSoup -

python - Fetching Image from URL using BeautifulSoup - i trying fetch of import images , not thumbnail or other gifs wikipedia page , using next code. "img" coming length of "0". suggestion on how rectify it. code : import urllib import urllib2 bs4 import beautifulsoup import os html = urllib2.urlopen("http://en.wikipedia.org/wiki/main_page") soup = beautifulsoup(html) imgs = soup.findall("div",{"class":"image"}) also if can explain in detail how utilize findall looking @ "source element" in webpage. awesome. the a tags on page have image class, not div : >>> img_links = soup.findall("a", {"class":"image"}) >>> img_link in img_links: ... print img_link.img['src'] ... //upload.wikimedia.org/wikipedia/commons/thumb/1/1f/stora_kronan.jpeg/100px-stora_kronan.jpeg //upload.wikimedia.org/wikipedia/commons/thumb/4/4b/christuss%c3%a4u...

ruby on rails 4 - How to install mpg123 on Heroku Server -

ruby on rails 4 - How to install mpg123 on Heroku Server - i'm using tts gemfor spoken sound onscreen, , works fine on local dev station, throws 500 on heroku's server. tts gem depends on mpg123. the heroku logs send next errors @ runtime: 2014-06-23t09:37:47.024478+00:00 app[web.1]: mpg123 executable not found. function work posix systems. 2014-06-23t09:37:47.024485+00:00 app[web.1]: install mpg123 `brew install mpg123` or `apt-get install mpg123` 2014-06-23t09:37:47.025829+00:00 app[web.1]: completed 500 internal server error in 196ms first attempt: heroku run brew install mpg123 running `brew install mpg123` attached terminal... up, run.1741 bash: brew: command not found second attempt: heroku run apt-get install mpg123 running `apt-get install mpg123` attached terminal... up, run.5879 w: not using locking read lock file /var/lib/dpkg/lock e: unable write /var/cache/apt/ e: bundle lists or status file not parsed or opened. upon farther resear...

php - Fetching data from MySql and showing events in calendar -

php - Fetching data from MySql and showing events in calendar - i using adam shaw's total calendar plugin in web-application. new json , usability. want fetch events database , display calendar not able it. please help me or if link suggestion. thank you. i suggest existing php applications using fullcalendar, keeping in mind new version v2 , applications implemented in v1. also, in download of fullcalendar, there demo folder illustration php script. in terms of json, think need php , json tutorial. working in ruby on rails cannot help much this, maybe these comments point in right direction. php jquery mysql fullcalendar

java - Parse.com Android Images not showing on actual device. Shows on emulator -

java - Parse.com Android Images not showing on actual device. Shows on emulator - i making app in android studio using parse sdk. when run device on emulator, works fine. on actual device, not show images. here's code: public class imageloader { memorycache memorycache = new memorycache(); filecache filecache; private map<imageview, string> imageviews = collections .synchronizedmap(new weakhashmap<imageview, string>()); executorservice executorservice; // handler display images in ui thread handler handler = new handler(); public imageloader(context context) { filecache = new filecache(context); executorservice = executors.newfixedthreadpool(5); } final int stub_id = r.drawable.ic_launcher; public void displayimage(string url, imageview imageview) { imageviews.put(imageview, url); bitmap bitmap = memorycache.get(url); if (bitmap != null) imageview.setimagebitmap(bitmap); else { queuephoto(url, imageview); ...

php - How i can upload my file to DB mysql with Jquery EasyUI? -

php - How i can upload my file to DB mysql with Jquery EasyUI? - i'm working jquery easyui , have problem code. have form input file db , form has input type = file want allow attachment. however, when form submitted, $_files object has nil in db , path declared. i hope can help me solve problem code. give thanks you here listening code: <form id="form" method="post" enctype="multipart/form-data"> <input type="file" name="file_att" id="file_att" size = "30px;" class="easyui-validatebox" required="true"/> </form> here code run form when form submitted: <?php include "../inc/inc.koneksi.php"; $file_att=$_files["file_att"]["name"]; $target="file_att/$file_att"; $temp=$_files["file_att"]["tmp_name"]; $query=mysql_query("insert t_director(id_direc,file_att) v...

pca - Principal component analysis with EQUAMAX rotation in R -

pca - Principal component analysis with EQUAMAX rotation in R - i need principal component analysis ( pca ) equamax-rotation in r . unfortunately function "principal()" utilize pca not offer kind of rotation. i find out may possible somehow bundle gparotation not yet figure out how utilize in pca . maybe can give illustration on how equamax-rotation pca ? or there function pca in bundle offers utilize of equamax-rotation directly? thank help! the bundle psych guess using principal() has rotations varimax , quatimax , promax , oblimin , simplimax , , cluster not equimax (psych p.232) compromise between varimax , quartimax excerpt stata manual: mvrotate p.3 rotation criteria in descriptions below, matrix rotated denoted a, p denotes number of rows of a, , f denotes number of columns of a (factors or components). if a loading matrix factor or pca, p number of variables, , f number of factors or components. criteria sui...

knockout.js - Knockout js computed observable executed every time it is referenced -

knockout.js - Knockout js computed observable executed every time it is referenced - i have view model in have observable array. have computed observable calculated 1 time observable array populated looping through items of array , computing computed observable. this computed observable referenced in other computed observables. each time computed observable referenced looping done 1 time again. can whatever 1 suggest how can avoid this. computed observable executes looping once. depending on how have declared computed observable (i'm assuming typical ko.computed(evaluator) , every time read computed evaluator execute evaluate it. considering have stated "this computed observable referenced in other computed observables", every 1 of references performing read . in general, need "cache" result of processing. the easiest way prevent duplicate processing not utilize computed straight in dependency chain. instead, within evaluator you'...

php - Server dropping local connections -

php - Server dropping local connections - i have in debian server 2 applications running under apache, 1 in php , other in ruby on rails. php page makes lot of calls running ruby on rails app, calls file_get_contents on url http://localhost/example.json . the problem is, after while (usually days) stops working, everytime seek local connection it's dropped. if seek connect localhost on service (like ssh), works normally, and, if seek connect rails app outside server, works too. to solve this, have reboot server (sometimes more once) work properly. seems me server blocking somehow, there nil odd on /var/log/messages (which iptables logs things, right?) thanks in advance! whenever file_get_contents run void $result = @file_get_contents if(! $result) { // error } this makes sure code doesn't hang on function if (for instance) file not reachable. that beingness said, never had lock server. makes sure rest of code runs should. server hangs because wan...

SQL, choosing max date and if two results have a max date, choose the one with the max weight -

SQL, choosing max date and if two results have a max date, choose the one with the max weight - id | date_i | weight 1 | 10/04/2014 08:13:05 | 10 2 | 02/04/2014 08:13:05 | 15 3 | 08/04/2014 08:13:05 | 10 4 | 13/04/2014 08:13:05 | 12 5 | 13/04/2014 08:13:05 | 10 my sql request request should give me row 4. select id, max(date_i) mytable m m.weight > (select m2.weight mytable m2 having max(date_i)); try this: select y.id, x.maxdate, x.maxweight ( select a.maxdate, max(b.weight) maxweight ( select max(date_i) maxdate mytable )a inner bring together mytable b on a.maxdate = b.date_i grouping a.maxdate ) x inner bring together mytable y on x.maxweight = y.weight demo here sql

javascript - jqxgrid grid filter dialog not showing in IE -

javascript - jqxgrid grid filter dialog not showing in IE - i have problem columns filter dialog not showing in ie it works fine in other browsers i have had great problem <!doctype html> in ie i suspect related order of these definitions <link rel="stylesheet" href="/jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="/scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="/jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="/jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="/jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="/jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="/jqwidgets/jqxscrollbar.js"></scr...

Sencha Touch ListPaging TotalCount not being set -

Sencha Touch ListPaging TotalCount not being set - using sencha touch 2.3.1a. have list uses listpaging: { xtype: 'list', itemid: 'passdownlist', store: 'passdownentrysstore', plugins: [ { xclass: 'ext.plugin.listpaging', autopaging: true } ], grouped : true, itemtpl: '<div class="list-item-title">{time}</div><div class="list-item-narrative">{firstname} {lastname}</div>', selectedcls: 'list-item-module', itemcls: 'list-item-custom', onitemdisclosure: true, } using next store proxy settings: proxy: { type: 'ajax', actionmethods: { read : 'post' }, extraparams : { }, url: app.config.config.baseurl() + 'subscriptions/', reader: { type: 'json', totalproperty: 'totalcount', /...

system.reactive - RX - Notifications at a specified rate -

system.reactive - RX - Notifications at a specified rate - i'm newbie rx , i'm facing problem "shaping notifications traffic". i wonder how can notify observers given throughput; is, "onnext" method called not before given amount of time elapsed since lastly "onnext" invocation. for sake of completeness: want every element in sequence notified. for example, 0.2 symbols/tick: tick: 0 10 20 30 |---------|---------|---------| producer: a---b------c--d-----e-------f result: b c d e f 0 5 11 16 21 28 is there way compose observable or have implement own subject? thanks lot yeah turn each value async process not finish until delay has elapsed , concatenate them. var delay = observable.empty<t>().delay(timespan.fromseconds(2)); var ratelimited = source .select(item => observable.return(item).concat(delay)) .concat...

ios - UIView transition animation -

ios - UIView transition animation - viewb , viewc subviews of viewa . viewb on top of viewc . bring viewc on top flipping animation shown in diagram. utilize uiview class method (void)transitionfromview:(uiview *)fromview toview:(uiview *)toview duration:(nstimeinterval)duration options:(uiviewanimationoptions)options completion:(void (^)(bool finished))completion . however, viewa gets flipped along viewb not desired behavior. desired behavior viewb flip on , viewc on top. thought how accomplish desired behavior? try : -(void)filpanimation { viewobjb.alpha=1.0; viewobjb.hidden=no; [uiview transitionwithview:viewobjb duration:1.5 options:uiviewanimationoptiontransitionflipfromright animations:^{ viewobjb.hidden=yes; viewobjb.alpha=0.0; } completion:nil]; viewobjc...

asp.net - jquery datepicker on postback -

asp.net - jquery datepicker on postback - i'm using jquery datepicker , i'm facing problem when postback made the datepicker disappears. i've tryed reinitialize datepicker on page load. please advice, in advance. tryed so: $(document).ready(function () { pageload(); setvalues(); }); function pageload() { $("#calendar").datepicker({ dateformat: 'mm/dd/yyyy' }); } <script type="text/javascript" language="javascript"> $(function() { $("#calendar").datepicker({ dateformat: 'mm/dd/yyyy' }); }); ; function pageload(sender, args) { if (args.get_ispartialload()) { $("#calendar").datepicker({ dateformat: 'mm/dd/yyyy' }); } }; </script> jquery asp.net datepicker

php - base64_decode() exception when changing URL of Laravel -

php - base64_decode() exception when changing URL of Laravel - i have laravel installation on server located /var/www/html/site/ , can access here dev.site.com . alter board url site.com changing document root virtual host. point site.com /var/www/html/site/public , laravel gives error: base64_decode() expects parameter 1 string, array given this happens when access website using url site.com , when alter dev.site.com , it's fine again. i've updated application url site.com . i'm running laravel 4.2 on centos 4.5 final. virtual hosts <virtualhost *:80> servername dev.site.com serveralias dev.site.com serveradmin tech@mydomain.com documentroot "/var/www/html/site/public" <directory /var/www/html/site/public> allowoverride allow </directory> </virtualhost> <virtualhost *:80> servername site.com serveralias site.com serveradmin tech@mydomain.com docu...

How to call other EFL app from your EFL app in Tizen -

How to call other EFL app from your EFL app in Tizen - i'm preparing app needs phone call dialer app. how go calling dialer app app. my app beingness written in efl. if working efl apps in tizen, utilize following: service_h service; service_create(&service); service_set_package(service, "com.service.call"); service_set_operation(service, "http://tizen.org/appcontrol/operation/main"); service_add_extra_data (service, "launch-type", "mo"); addtional info intents service_send_launch_request(service, null,null ); service_destroy(service); this , in application manifest, add <permit> <smack permit="com.samsung.w-launcher-app" type="rw"/> </permit> and in application xml, utilize this: <privileges> <privilege>http://tizen.org/privilege/application.launch</privilege> </privileges> tizen efl

c# - How to get CheckBox "Ticked" inside ListBox on run time -

c# - How to get CheckBox "Ticked" inside ListBox on run time - i creating windows phone 8 application, have checkbox within listbox, how checkbox "checked" when click on checkbox? i tried best not getting result? see code below: <listbox x:name="listbox1" width="429" height="621" horizontalalignment="left" margin="21,43,0,59" verticalalignment="top" itemssource="{binding}" selecteditem="{binding}" selectionchanged="listbox1_selectionchanged" selectionmode="extended"> <listbox.itemtemplate> <datatemplate> <grid> <stackpanel orientation="vertical" width="440"> <stackpanel orientation="horizontal"> <textblock text="{binding}" textwrapping="wrap" foreground="...

java - Android ImageView getting over linearlayout -

java - Android ImageView getting over linearlayout - i'm developing android application, layout shown in image below : the layout contains 2 main linearlayouts : horizontal layout takes 90% of height of device , vertical layout takes 10% of it. within horizontal linearlayout there 3 linearlayout ( 2 reddish , 1 containing imageview). each reddish layout 10% of width of screen , 1 containing imageview 80%. here xml code : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="1" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_weight="...

php - WooCommerce Changing Simple Product to Variable and Vice Versa, but how to get new variations to show on the frontend? -

php - WooCommerce Changing Simple Product to Variable and Vice Versa, but how to get new variations to show on the frontend? - i creating plugin ties runit scheme showing onhand products in woocommerce. requires changing products via cron job update them, simple products variable products , vice versa depending on quantity of stock , variations of these products, change. have working code, updates these products in backend, showing right variations, however, not update on front end end. new variations, when editing variable products, not show on front end end when viewing actual product itself. still see old variations in there. how update variations utilize new variations automatically, instead of having nail update button in backend administration when editing product? is there sort of function needs called updating variations in woocommerce i'm not aware of? using array , serializing before updating meta_value meta_key _product_attributes in wp_postmeta tab...

networking - Network Address Translation (NAT) when bidirectional socket is established? -

networking - Network Address Translation (NAT) when bidirectional socket is established? - when client sends request server, 1 entry inserted in nat table (in router). after client received response, entry deleted. server can't send message client if client doesn't issue request (client in private network) in case of bidirectional socket, how accomplish issue: 1. how server actively sends message client ? [updated comments] i want implement server-push architechture, need know more nat. sockets networking

git - What are Jenkins best practices with building with Grunt and deploying with Capistrano? -

git - What are Jenkins best practices with building with Grunt and deploying with Capistrano? - i'm setting build server @ our office , wondering what's best practice this. know each situation asks different approach , there 1000000 ways accomplish same goal, since i'm newcomer jenkins , concept of build servers in general, wondering if i'm doing 'right'. our company focusses on building websites various clients various platforms wordpress or magento. have next setup: we force our changes master or staging-branch in git. jenkins polls these branches , next when alter detected: pull repository git ( master in example) checkout branch called build-master resets branch origin/master does npm install if package.json found. does grunt build if gruntfile.js found. (here room other stuff phpunit or casperjs tests) commits changes , pushes origin/build-master . executes cap build-master deploy allow capistrano handle deployment on remote server...

java - Interfaces and dynamic method dispatch -

java - Interfaces and dynamic method dispatch - normal overriding (without utilize of interfaces) class { int x = 0; void show() { system.out.println("in a. x : " + x); } } class b extends { void show() { system.out.println("in b. x : " + x); } } class c extends { void show() { system.out.println("in c. x : " + x); } } class test { public static void main(string args[]){ obj = new b(); obj.show(); obj = new c(); obj.show(); } } this same doing interfaces: interface { int x = 0; void show(); } class b implements { public void show() { system.out.println("in b. x : " + x); } } class c implements { public void show() { system.out.println("in c. x : " + x); } } class test { public static void main(string args[]){ obj = new b(); obj.show(); obj = new c(); ...

angularjs - Localize URL's with ui-router and angular-translate -

angularjs - Localize URL's with ui-router and angular-translate - i using ui-router routing , angular-translate translations. accomplish having selected language bind url so: www.mydomain.com/en/ www.mydomain.com/ru/ www.mydomain.com/en/about www.mydomain.com/ru/about and respond accordingly. tried examples, did not find anything. if implemented similar solution, love hear how did it. thanks i utilize along these lines: coffeescript angular.module('app') .config([ '$stateprovider' ($stateprovider) -> $stateprovider.state 'app', abstract: true url: '/{locale}' $stateprovider.state 'app.root', url: '' $stateprovider.state 'app.root.about', url: '/about' ]) javascript angular.module('app').config([ '$stateprovider', function($stateprovider) { $stateprovider.state('app', { abstract: true, url: '/{loca...

r - How do I interpret the output of corrplot? -

r - How do I interpret the output of corrplot? - the corrplot packages provides neat plots , documents how create lots of examples. but don't understand output. can see if have matrix a_ij , can plot arrangement of n n square tiles, color of tile ij corresponds value of a_ij . examples appear have more dimensions: here can guess color shows correlation coefficient, , orientation of ellipse negative/positive correlation. eccentricity? the documentation method says: the visualization method of correlation matrix used. currently, supports 7 methods, named "circle" (default), "square", "ellipse", "number", "pie", "shade" , "color". see examples details. the areas of circles or squares show absolute value of corresponding correlation coefficients. method "pie" , "shade" came michael friendly’s job (with adjustment shade added on), , "ellipse" came d.j. murdoch...

python - How to handle multiple user type in Django -

python - How to handle multiple user type in Django - i'm trying create little website has 3 types of users ["client" , "volunteer" , "coordinator"] . each type of user has restrictions on views can access. 3 users have different login pages. approach 1 : accomplish this, i've added key session category , assign 1 of above given usertypes during login and, whenever view called, check whether user can access view. login.html: {% extends "base.html" %} {% block content %} {% if form.errors %} <p class="error"> sorry , invalid</p> {% endif %} <form action="/login_volunteer/authenticate/" method="post">{% csrf_token %} <label for="username"> username : </label> <input type="text" name="username" value="" id="username"> <label for="password"> password : </label> <i...

How to answer "why scala provides `object` keyword"? -

How to answer "why scala provides `object` keyword"? - this question has reply here: why singleton objects more object-oriented? 7 answers someone asked me: why scala provides object keyword? i reply object can: create single instance on language level create new instance of other types factories combine different traits but said "these object can do, not why". what should reply question? (i read articles object , can answer: because scala want back upwards module on language level? ) object there avoid static members. scala designed pure object oriented language, , static isn't object oriented. static makes code harder understand mix code doesn't belong conceptually. in general, separating static , instance members idea. also object reduces boilerplate implementing singleton pattern , makes useless types less ...

javascript - Lodash forEach Associative Array -

javascript - Lodash forEach Associative Array - is there foreach loop in lodash associative arrays? function called "foreach", i've found, works indexed arrays. example, if have array myarray values [1, 2, 3] , , do lodash.foreach(myarray, function(index) { console.log(index); }); and run function (in node ), expected result: 1 2 3 however, when seek associative array, doesn't work: lodash = require('lodash'); myarray = []; myarray['valone'] = 1; myarray['valtwo'] = 2; myarray['valthree'] = 3; lodash.foreach(myarray, function(index) { console.log('7'); }); as can see running in node , callback function doesn't fire when includes other array elements. seems skip loop entirely. first of all, why happen? sec of all, there function included in lodash problem, or, if not, there way utilize foreach function accomplish this, without changing original array in process? lodash has func...

python - Mechanize does not follow redirect after website login -

python - Mechanize does not follow redirect after website login - i've been having lot of problem getting should simple login script work on particular website. my code work on website (reddit), doesn't work on: https://eo-sso-idp.eo.esa.int/idp/umsso20/login after submitting form , printing response, browser seems sit down on page html web broswer "cannot find" despite beingness saved in local html file (copied , pasted console output notepad text file) username , password copied corresponding form fields. not follow redirect should take admin page. this code: # create new mechanize browser instance br = mechanize.browser() # set browser options br.set_handle_equiv(true) br.set_handle_redirect(true) br.set_handle_referer(true) br.set_handle_robots(false) br.set_handle_redirect(mechanize.httpredirecthandler) br.set_handle_refresh(mechanize.httprefreshprocessor(), max_time=1) # open login url br.open("https://eo-sso-idp.eo.esa.int/idp/umsso20/ad...

rest - Why Grails ignores the HTTP Accept header by default? -

rest - Why Grails ignores the HTTP Accept header by default? - from grails documentation .. grails ignores http take header unless add together grails.mime.use.accept.header = true setting config.groovy file. in other words, withformat() unaffected take header without setting why selection made​​ ? there concern using take header, such way grails default interprets format parameter ?? what's pro , cons of specify communication medium format parameter or take header in rest architecture ? some older browsers send either invalid take headers or */* isn't helpful grails can default utilize take header because otherwise on browsers xml or json sent instead of html within browser. having said behaviour has changed in more recent versions of grails. in more recent versions of grails (since 2.3.0) accept header is enabled default, ignored user-agent strings (i.e. browsers) https://github.com/grails/grails-core/blob/master/grails-resources/src/gra...

javascript - Detect unacceptable drag drop in jQuery-ui droppable -

javascript - Detect unacceptable drag drop in jQuery-ui droppable - i'm using jquery-ui draggable, droppable. main container should take plugin-containers droppables take plugins: $("#main").droppable({ activeclass: "ui-state-default", hoverclass: "ui-state-hover", accept: ".plugin-container", drop: function( event, ui ) { $( ).find( ".placeholder" ).remove(); $("<div></div>").html(ui.draggable.html()).appendto(this).droppable({ accept: '.plugin', drop: function (event, ui) { $('<div></div>').html(ui.draggable.html()).appendto(this); } }).sortable(); } }); the problem when plugin dragged main container, want to: hightlight plugin containers plugin can dropped if plugin dropped in main container show error message but droppable over , drop methods ...

html - Change default language in iOS app -

html - Change default language in iOS app - i developing hybrid ios app in ios 7 , php/html/js. have made webviewer , therein loaded web-part of app. i have photo uploader in html: <input type="file" accept="image/*" capture="camera" /> if tap button, ios show me 3 default options: 1) take photo 2) take existing 3) cancel all these options in english. possible set dutch? so, possible alter sort of app language? if localize application: http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014, , alter iphone language settings dutch, (settings->general->international->language), options shown in dutch. html ios hybrid-mobile-app

Does copy-and-swap still give the strong exception guarantee in C++11? -

Does copy-and-swap still give the strong exception guarantee in C++11? - the copy-and-swap idiom said provide strong exception guarantee. in c++11, std::swap uses move operations. consider next code: class myclass { aclass x; canthrowifmoved throwingobject; myclass(myclass&& other) noexcept x(std::move(other.x)), throwingobject(std::move(other.throwingobject)) { } friend void swap(myclass& first, myclass& second) noexcept { using std::swap; swap(first.x, other.x); swap(first.throwingobject, other.throwingobject); } myclass& operator=(myclass other) noexcept { swap(*this, other); homecoming *this; } }; if throwingobject throws during swap, strong exception guarantee broken. the noexcept keywords don't enforce during compile time. throwingobject can still throw, difference programme violently terminate . don't think crashing entire applicatio...

ios - Localization ios7 without change device's language -

ios - Localization ios7 without change device's language - i know how create application - developed in xcode - multilingual. read lot of tutorials localization don't want users go through settings->general->international->language in order alter application's language. instead, want application appear on settings , there have alternative alter language (only application's language). found app can't find tutorial. any tutorials or hinds name of way of localization helpful in order proceed app. update i found can done via custom settings bundle. want utilize localization storyboard. i created settings bundle don't know how proceed. update i used code on appdelegate.m file , works on mobile device. changes interface of mobile application based on settings bundle. 1. mobile application crashes on simulator , 2. code when open app, press middle button of device, go settings , alter language, go app app restarts! how can solve issues? ...

Schema.org type for a study course -

Schema.org type for a study course - i haven't been able find schema.org type fits sheet describing properties of course of study university. the html (without semantic markup using schema.org) more or less this: class="lang-html prettyprint-override"> <section> <h2>fact sheet</h2> <p><strong>formal qualifications:</strong> bachelor’s grade in design</p> <p><strong>credits</strong>: 240 ects</p> <p><strong>duration</strong>: 4 academic years or 240 ects</p> <p><strong>school period</strong>: oct june</p> <p><strong>timetable</strong>: morning group: mon fri 9am 2.30pm. eve group: mon fri 3:30 pm 9.00 pm * college reserves right modify schedules.</p> <strong>price</strong>: 112 €/ 1 ects … </section> i thought using product , lacks lots of things. any ideas? ...

libgdx - Task 'afterEclipseImport' not found in root project 'NEWGDL' -

libgdx - Task 'afterEclipseImport' not found in root project 'NEWGDL' - i'm trying create new project work on in eclipse using libgdx. managed project working before, after deleting files project became unusable. when seek utilize libgdx project setup i'm told "task 'aftereclipseimport' not found in root project 'newgdl'." (newgdl beingness selected workspace gdx projects) and there no projects import eclipse workspace. i'm trying build android, , box2d checked. could please tell me went wrong , how prepare problem? edit: reported issue , fixed 4 days ago, error no longer shows latest libgdx project setup app. libgdx project root

vb.net - How can I make custom DataGridViewColumn properties work at design time? -

vb.net - How can I make custom DataGridViewColumn properties work at design time? - recently i've written custom datagridviewcolumn host progress bar. column class has property i'd propagate cells of column. utilize code implement it:- <defaultvalue(5i)> _ public property blockwidth() integer homecoming _blockwidth end set(byval value integer) _blockwidth = value me.columncells.foreach(sub(cell) cell.blockwidth = value) end set end property and this:- private readonly property columncells ienumerable(of datagridviewprogressbarcell) if me.datagridview isnot nil homecoming me.datagridview.rows. cast(of datagridviewrow). where(function(r) typeof r.cells.item(me.index) datagridviewprogressbarcell). select(function(r) directcast(r.cells.item(me.index), datagridviewprogressbarcell)) else homecoming new datagridviewprogressbarcel...

version control - Is git rebase recommended while multiple developers working on same branch? -

version control - Is git rebase recommended while multiple developers working on same branch? - in http://git-scm.com/book/en/git-branching-rebasing#the-perils-of-rebasing it recommened rebasing should not done when repository public. and recent post in git merge vs rebasing recommends rebase should not done on branch shared between developers. i understand that, because developer might first merge code , decides rebase code, other developers might endup in creating multiple duplicate commits explained in perils of rebasing. what if developers comes on mutual understanding going rebase code instead of merging? recommendation still apply? p.s all these answers confuse me. thick reframe question again. lets assume there 2 developer working on 2 different computers. there central repository. 2 developers cloned , started working. developer 1: created branch local/master. lets local/iss123. pushed remote developer 2: pulled changes remote checksout local/is...