Posts

Showing posts from March, 2015

python - The exe executable of my application, also opens a console -

python - The exe executable of my application, also opens a console - i create exe executable of application made ​​in pyqt, , went well, when run exe in windows before opening application opens console , while application open console also. i need tell me how create console not come out, or @ to the lowest degree not visible. i've seen answers problem c ++ python have not seen anything the best solution in post linked in comment post, on windows can set property on shortcut starts app, have console minimized. still shows in taskbar, there id need it, can handy in situations(like during dev utilize same script user will, not have bother evrytime start app manually minimize console). in general best utilize pythonw.exe or utilize .pyw extension script. python windows console pyqt exe

java - Extracting some nodes from XML Files -

java - Extracting some nodes from XML Files - i need extract nodes xml file formatted in way: <collection sentiment="negativo"> <comment> <sentiment> ...</sentiment> <chars>...</chars> <words>...</words> <text>blabla</text> <lang>english</lang> </comment> now assume there other <comment> elemente have <lang>spanish</lang> in same xml file. need create 2 separate xml files. first 1 nodes having kid <lang>english</lang> (let's phone call eng.xml) , sec 1 having <lang>spanish</lang> (let's phone call spa.xml) here java code: public void getenglishrows() throws ioexception{ outputstreamwriter f = new outputstreamwriter(new fileoutputstream("c:/eclipse/neg_eng.xml")); bufferedwriter buff; nodelist current_row = doc.getelementsbytagname("comment"); //mette in una lista tutti

linux - Cannot run npm as root -

linux - Cannot run npm as root - i trying grunt , running, next this, , cannot much farther first step. able type npm install -g grunt-cli but command fails, giving me advice please seek running command 1 time again root/administrator ok... seek run same command sudo sudo npm install -g grunt-cli and error sudo: npm: command not found which me, sort of weird, because shell able recognize npm without "sudo" thrown in front. how install globally/get sudo recognize npm valid program? i found out reply help of co-worker. basically, there file did not have permissions on, found looking @ error log. sudo'd chmod'd file code of 777, , ran npm install command again, , found worked. thought paste reply in case helps anyone. linux node.js install npm sudo

devforce - Join with distinct - Translating SQL to Linq Query -

devforce - Join with distinct - Translating SQL to Linq Query - i trying translate sql query working linq statement, unfortunately not easy expected. the original sql query looks following: select distinct tt1.artikelid ( select artikelid [dbo].[artsearcheinfachview] feld = 'listungsstatus' , wert = '0' ) tt1 inner bring together ( select artikelid [dbo].[artsearcheinfachview] feld = 'aktiveraktikel' , wert = '1' ) tt2 on tt1.artikelid = tt2.artikelid inner bring together ( select artikelid [dbo].[artsearcheinfachview] feld = 'artikelbezeichnung' , wert '%berentzen%' ) tt3 on tt1.artikelid = tt3.artikelid there more joins later on, build predicate builder later on, page included 2. i tried convert it. using devforce entity manager, unfortunately not working: public async task<int> ladeartikelcounteinfachnew(string sucheingabe) { var query = _artikelcontainer.artsearcheinfac

Defining the Content-Language header in Rails -

Defining the Content-Language header in Rails - according w3c, viable , preferred way communicate language of intended audience providinga content-language header. relevant part: metadata language of intended audience best declared outside document in http content-language header. how can send such header rails? it'd preferred utilize i18n framework this: response.headers["content-language"] = i18n.locale.to_s read more here: http://guides.rubyonrails.org/i18n.html ruby-on-rails-4

python - How can I open multiple XML documents stored in a single list? -

python - How can I open multiple XML documents stored in a single list? - this python list contains multiple xml files in single list. list_xml = ['hello.xml,'hi.xml','08333.xml'] i want parse hello.xml , store info list. 1 time completed, want read hi.xml . how can this? see pattern of next code. should help you. also, i'd advise go through fundamentals of programming. list_xml = ['a.xml', 'b.xml', ... ] out = [] xml in list_xml: # parse xml here # more code out.append(parsed_data) homecoming python xml-parsing

mysqli - Determine ranking with single mysql query -

mysqli - Determine ranking with single mysql query - i selecting set of items table , determine ranking display on page, code selecting items: `<? $attra_query=mysqli_query($link, "select * table category ='4'"); if(mysqli_num_rows($attra_query)> 0){ while($attra_data=mysqli_fetch_array($attra_query,1)){ ?>` in while loop determine ranking each of items so: select count(mi.location) + 1 rank table m left bring together ( select id,location,country, round(coalesce(total_rating/total_rating_amount,0),10) rating_per_vote table category = '4' ) mi on mi.location = m.location , mi.country = m.country , mi.rating_per_vote > round(coalesce(m.total_rating/m.total_rating_amount,0),10) m.id = '$attra_id'; i figure highly inefficient, there way combine 2 queries single 1 don't have run ranking query each item separately ? //edit sample data: id | location | country | categor

javascript - JS, HTML5 - PieChart not loading in -

javascript - JS, HTML5 - PieChart not loading in <div> - im trying loade piechart js file in div in html code. can't work except when have script containing js code in html code. want have code separated. here code far: index.html <head> <meta name="viewport" content="width=device-width" /> <title>index</title> <script type="text/javascript" src="scripts\chart.js"></script> <script type="text/javascript" src="scripts\canvasjs.min.js"></script> </head> <body> <div> <div id="chartcontainer" onload="loadpiechart()" style="height: 300px; width: 300px; margin-left:auto; margin-right:auto; background-color:#323232;"></div> </div> </body> chart.js function loadpiechart() { var chart = new canvasjs.chart("#chartcontainer", {

how it can be known when LOAD() in web2py is success -

how it can be known when LOAD() in web2py is success - using load() in controller below: def showresult(): msg='' result=load('rescontroller','res.load',ajax=true) if 'pass' in result: msg='congratulations, you've passed' response.flash= msg found this: when load() invoked (and before receive response res.load) passes "loading..." result variable in turns impact if condition. question this: there way create if status works after load() receive response? you misunderstanding how load works. html helper generates html div includes special attributes trigger javascript in browser when containing page loads (the javascript makes ajax phone call specified action, returns response browser). not execute http request within controller code , homecoming response there, cannot ajax response in controller generates load helper. note, load returns div helper, , html helpers de

Regex replace Harvard style bibliography references \d{4}:\s\d+ with comma -

Regex replace Harvard style bibliography references \d{4}:\s\d+ with comma - harvard bibliography, if not utilize mendeley on time can tough. [sihler 1999: 122; trask 2000: 164]. [benveniste 1935: 170-171, Бенвенист 1955, bomhard, kerns 1994: 56-59]. the way quote authors in phd wrong. should have had , instead of : . like [sihler 1999, 122; trask 2000, 164]. with \d{4}:\s\d+ http://regex101.com/r/me0rt9/1 can find them, how replace , instead of : in word? thanks. you need utilize lookahead , lookbehind or backreferences, http://www.regular-expressions.info/lookaround.html. i this: preg_replace("~(\d{4}):(\s\d+)~", "$1,$2", $str) in php instance illustration of latter solution. here's post talks backreferences in javascript: javascript - string regex backreferences regex

little change array sort code in php -

little change array sort code in php - first show code, help me, , in end explain need. database create table if not exists `tickets` ( `ticketid` int(10) not null auto_increment, `datetime` datetime not null default '0000-00-00 00:00:00', `game` enum('1','2','3') not null default '1', `gameid` int(100) not null, `userid` int(11) not null default '0', `sum` int(11) not null, `username` varchar(50) not null, `numbers` varchar(27) not null, `count` int(2) not null, `how_much_win` int(20) not null, `win` enum('yes','no') not null default 'no', `checked` enum('yes','no') not null default 'no', primary key (`ticketid`) ) engine=myisam; insert `tickets` (`ticketid`, `datetime`, `game`, `gameid`, `userid`, `sum`, `username`, `numbers`, `count`, `how_much_win`, `win`, `checked`) values (1, '2014-10-22 16:3

itext - How to add a shading pattern to a custom shape -

itext - How to add a shading pattern to a custom shape - i have drawn equilateral triangle follows using itext canvas.setcolorstroke(basecolor.black); int x = start.getx(); int y = start.gety(); canvas.moveto(x,y); canvas.lineto(x + side,y); canvas.lineto(x + (side/2), (float)(y+(side*math.sin(converttoradian(60))))); canvas.closepathstroke(); i wish multi color gradient in shape i.e. fill shading comprising of basecolor.pink , basecolor.blue . can't find way itext ? i've created illustration called shadedfill fills triangle drawing using shading pattern goes pinkish bluish show in shaded_fill.pdf: pdfcontentbyte canvas = writer.getdirectcontent(); float x = 36; float y = 740; float side = 70; pdfshading axial = pdfshading.simpleaxial(writer, x, y, x + side, y, basecolor.pink, basecolor.blue); pdfshadingpattern shading = new pdfshadingpattern(axial); canvas.setshadingfill(shading); canvas.moveto(x,y); canvas.lineto(x + side, y)

asp.net web api - Using Autofac's resolver on demand in WebAPI perRequest to handle Circular errors -

asp.net web api - Using Autofac's resolver on demand in WebAPI perRequest to handle Circular errors - i utilize autofac on basic level handle dependency injection. config @ moment simple: builder.registertype<testdbcontext>().as<dbcontext, testdbcontext>().instanceperrequest(); builder.registertype<userrepository>().as<iuserrepository>().instanceperrequest(); builder.registertype<testrepository>().as<itestrepository>().instanceperrequest(); my problem kind of related to: 'autofac circular component dependency detected' error i don't want curcular component dependency error don't include iuserrepository itestrepository constructor (it's included other way round). i wanted utilize sec suggestion above question's answer. how can code testrepository utilize userrepository on-demand? i've tried using beginlifetimescope next attempt: public class testrepository : itestrepository { public testre

printf - C Programming - integer value printing incorrectly -

printf - C Programming - integer value printing incorrectly - i'm using borland c v3.1 (dos version) this code #include<stdio.h> #include<conio.h> void wtf() { int array[15],i; int wtf_number=12345; for(i=0;i<16;i++) array[i]=0; printf("%d",wtf_number); } void main() { clrscr(); wtf(); getch(); } i should 12345 output, i'm getting 0 instead. help. your code incorrect. instead of for(i=0;i<16;i++) array[i]=0; you should have for(i=0;i<15;i++) array[i]=0; since array has 15 elements. c printf

mysql - How to get a SUM of grouped COUNT in SQL Query -

mysql - How to get a SUM of grouped COUNT in SQL Query - i'm trying sum of grouped count. my table result this. id | name | count 1 k 5 2 k 4 3 12 i want result lik this. id | name | count 1 k 9 3 12 these real query. select count( clubs_messages.id_user ) nbr, users.name, users.id, users.email users bring together clubs_messages on users.id = clubs_messages.id_user grouping clubs_messages.id_user union select 'sum' users.name, count( clubs_messages.id_user ) users bring together clubs_messages on users.id = clubs_messages.id_user so help please. i think have grouping name instead of user_id. check next query select count( clubs_messages.id_user ) nbr, users.name users bring together clubs_messages on users.id = clubs_messages.id_user grouping users.name mysql sql-server

python - Suggestion for Invoice generation in django 1.6 -

python - Suggestion for Invoice generation in django 1.6 - i want generate invoice application. tried using reportlab,however not much user friendly. there other modules available generate invoice in django1.6? if want generate pdf django have here. has illustration using reportlab, links 2 other pdf generation libraries , 1 command-line utility convert html pdf. python django

httprequest - (partial) HTTP Request isn't recognized by C# HTTP Server -

httprequest - (partial) HTTP Request isn't recognized by C# HTTP Server - in visual studio 13 console application, receive next byte stream on tcp-socket(receiving embedded device): post /setup http/1.1 content-length: 6 content-type: application/setup+tlv8 tlv8-data although seem valid http request, none of next attempts have successful been recognize http request: (on regular http requests work perfectly) .net httplistener class (does not inform me request has been invoked) grapevine (same thing, routes given on post or get) https://github.com/scottoffen/grapevine alchemy (onconnect method has been invoked, in according usercontext seeing request path: / . similar reported issue: https://github.com/olivine-labs/alchemy-websockets/issues/70 so far, i'm interested in requested path post or attached content (tlv formatted) body. am wrong in configuring? such as: need tell proper content-type ? there way rid of writing own simple text parser ? code sample

Find position of multiple elements in a list (jQuery) -

Find position of multiple elements in a list (jQuery) - i have list of several images, portrait class, , others landscape class: <img src="/images/fullsize/007.jpg" class="portrait"> <img src="/images/fullsize/008.jpg" class="landscape"> <img src="/images/fullsize/047.jpg" class="landscape"> <img src="/images/fullsize/048.jpg" class="landscape"> <img src="/images/fullsize/049.jpg" class="landscape"> <img src="/images/fullsize/050.jpg" class="portrait"> <img src="/images/fullsize/051.jpg" class="portrait"> <img src="/images/fullsize/052.jpg" class="landscape"> <img src="/images/fullsize/053.jpg" class="landscape"> <img src="/images/fullsize/054.jpg" class="landscape"> how identify position (within list) of .portrait imag

Akka Actor Props factory -

Akka Actor Props factory - akka , getting know each other. from : akka 2.3.6 (current) actor recommended practice these illustration actor called demoactor : class demoactor(magicnumber: int) extends actor { def receive = { case x: int => sender() ! (x + magicnumber) } } in recommended practices section of doc states : "it thought provide mill methods on companion object of each actor help keeping creation of suitable props close actor definition possible." : object demoactor { def props(magicnumber: int): props = props(new demoactor(magicnumber)) } question : what difference between specifying mill props method : object demoactor { def props(magicnumber: int): props = props(classof[demoactor], magicnumber) } in case missed it, difference argument props constructor : new demoactor(magicnumber) vs classof[demoactor], magicnumber from same akka documentation page bit farther in props section, mentions when using props

javascript - Get total values in google apps script -

javascript - Get total values in google apps script - i'm trying utilize "totalsforallresults" method in google apps script force out total values each metrics. printed out result of each metrics each dimension spreadsheet. , i'd see total values @ end of row. tried many times cat't work. i'll happy if give me advice. the problem lastly paragraph. code worked analytics info "totalsforallresults" doesn't work. var results = channelreportpc(firstprofile);  outputtospreadsheet(results); function channelreportpc(firstprofile) { var profileid = firstprofile.getid(); var tableid = 'ga:' + profileid; var startdate = electivestartdate('sd'); var enddate = electiveenddate('ed'); var optargs = { 'dimensions': 'ga:medium', // comma separated list of dimensions. 'sort': '-ga:sessions', 'segment': 'sessions::condition::ga

python - How to test datetime conversion with pytz and tzlocal? -

python - How to test datetime conversion with pytz and tzlocal? - so have datetime objects want show users in local time. using answered questions on here, i've come jinja filter accomplish this: from tzlocal import get_localzone import pytz def local_datetime(utc_dt): local_tz = get_localzone() local_dt = utc_dt.replace(tzinfo=pytz.utc).astimezone(local_tz) homecoming local_dt.strftime('%m/%d/%y @ %i:%m %p') app.jinja_env.filters['local_dt'] = local_datetime {{ user.last_login_at|local_dt }} # in template my thought run each time views page (hence filter) show in user's native timezone. it shows right on development machine, i'd create sure get_localzone() grabbing user's local timezone , not server's. my question is: how can test if working correctly? get_localzone() homecoming local timezone of server application running on. there nil in http headers of request can tell user's timezone. instead, st

java 8 - Repeated overriding of functional interface's abstract method? -

java 8 - Repeated overriding of functional interface's abstract method? - i have functional interface in java 8: public interface ifunclambda1 { public int someint(); } in main: ifunclambda1 ifuncl1 = () -> 5; system.out.println("\nifuncl1.someint: " + ifuncl1.someint()); ifuncl1 = () -> 1; system.out.println("ifuncl1.someint: " + ifuncl1.someint()); running yield: ifuncl1.someint: 5 ifuncl1.someint: 1 is functionality ok is? intended? if overriding done in implementing class, , implementation alter @ point, in every place that method called, behaviour same, have consistency. if alter behaviour/implementation through lambda expressions in example, behaviour valid til next change, later on in flow. feels unreliable , hard follow. edit: @assylias don't see how someint() has behaviour changed... if added param someint , have code: ifunclambda1 ifuncl1 = (x) -> x - 1; system.out.println("\nifuncl1.someint: &

api - What OAuth pattern/flow is this called? -

api - What OAuth pattern/flow is this called? - i'm attempting utilize oauth 2 in order create protected api. except, want of users on site require access token in order them access api. the reason beingness api exposed public, don't want public access api. application makes number of calls api via ajax requests. anyway, example, in application if user clicks on users profile, create ajax request to: example.com/api/user/id and homecoming json info user. but, want them protected access token required - registered users - view them. soundcloud doing i'm attempting achieve. every user authenticated oauth token. 1. login soundcloud 2. issue oauth token logged in user 3. utilize token create api requests i'm sure number of sites doing this, can't find specific tutorial on putting type of model assume it's popular model implemented on number of sites. what pattern called? it sounds referring "client-side javascript a

javascript - Fusion charts - licensed or open source? -

javascript - Fusion charts - licensed or open source? - is fusion charts licenced ? in few websites said has become open source since 2009. in other few sites said trial version utilize in development environment , not production environment commercial purpose...can of kindly clarify? http://www.fusioncharts.com/buy/#!website-apps says licenced http://blog.fusioncharts.com/2009/08/fusioncharts-free-now-open-source/ says free... please clarify don't want copyright violation thanks! fusion charts not same fusion charts free. fusion charts free open source, discontinued. fusion charts licensed. javascript charts fusioncharts

sql - Remove duplicate rows in MySQL -

sql - Remove duplicate rows in MySQL - i have table next fields: id (unique) url (unique) title company site_id now, need remove rows having same title, company , site_id. 1 way using next sql along script (php): select title, site_id, location, id, count( * ) jobs grouping site_id, company, title, location having count( * ) >1 after running query, can remove duplicates using server side script. but, want know if can done using sql query. a easy way add together unique index on 3 columns. when write alter statement, include ignore keyword. so: alter ignore table jobs add together unique index idx_name (site_id, title, company); this drop duplicate rows. added benefit, future inserts duplicates error out. always, may want take backup before running this... sql mysql duplicate-removal

c++ - boost ublas matrix view for transpose -

c++ - boost ublas matrix view for transpose - what best way multiply matrix transpose of matrix using boost::ublas. have access atlas/blas bindings. both memory , performance important. thus, crucial no copies created when doing transpose. current implementation looks this: atlas::gemm<mytype>(ublas::trans(*a), *b, *c); i trying replace ublas::trans memory management operation, e.g. form of matrix view. unfortunately, operations aware of (e.g. see matrix_range in matrix proxies) allow create views of matrix is, , not of transpose. while performance important, happy consider using ublas::prod operation, if necessary. c++ boost type-conversion linear-algebra ublas

STM32F103 USB HID -

STM32F103 USB HID - i'm trying connect board pc no success. here tried; tried "stm32 fs device lib". includes illustration project named custom hid. uses leds, extis , pin named usb_disconnect. ported code, removed usb_disconnect part , leds. when called usb_init(), nil happens. no device found pc. there no need configure custom endpoints, descriptor or else. communication personal use. want phone call functions i.e. usb_read() , usb_write(). is there simple library or illustration project can use? usb hid stm32

html - CSS responsive nested grid height -

html - CSS responsive nested grid height - i teaching myself how setup responsive grid layout automatic adjust on device size. far good, having issue the height of of boxes not adjusting. see here code http://jsfiddle.net/shuka/tbe32q3h/ html <body> <div id="section2"> <div class="container grid2"> <article class="col half">map</article> <article class="col half" style="background-color:#069;"> <div class="grid2"> <article class="col quater">box 1</article> <article class="col quater">box 2</article> </div> <div class="grid2"> <article class="col quater">box 3</article> <article class="col quater">box 4</article> </div> </article> <br/> </div>

visual studio 2013 - ctrl + enter doesn't work after installing resharper -

visual studio 2013 - ctrl + enter doesn't work after installing resharper - i installed resharper in visual studio 2013, ctrl + enter (insert blank line above cursor) doesn't work anymore. resharper re-maps ctrl+enter resharper_forcecompleteitem. map edit.lineopenabove (in tools -> options -> environment -> keyboard in visual studio) alternatively, if know vi keys install vsvim extension , utilize shift+o insert above , o insert below cursor. visual-studio-2013 resharper

android - Fused Location Provider unexpected behavior -

android - Fused Location Provider unexpected behavior - this how register app receive location updates: mlocationrequest = locationrequest.create(); mlocationrequest.setinterval(consts.one_minute * 10); mlocationrequest.setpriority(locationrequest.priority_balanced_power_accuracy); mlocationrequest.setfastestinterval(consts.one_minute); builder builder = new googleapiclient.builder(context); builder.addapi(activityrecognition.api); mgoogleapiclient = builder.addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); mgoogleapiclient.connect(); .... .... @override public void onconnected(bundle connectionhint) { locationservices.fusedlocationapi.requestlocationupdates(mgoogleapiclient, mlocationrequest, locationupdatespendinginent); } my pending intent been invoked in background in exact requested intervals... so far good. the problem: when wifi disabled/ not connected network, or when there no 3g/4g network info enable

try - except KeyError block in Python -

try - except KeyError block in Python - x tuple: (x1, x2) try: clusters[bestmukey].append(x) # statment 1 except keyerror: clusters[bestmukey] = [x] # statement 2 (1) how statement 1 , statement 2 different things? (2) why separated statements needed? clusters[bestmukey].append(x) requires clusters[bestmukey] exist , list can appended to. if clusters not have right key, raise keyerror. clusters[bestmukey] = [x] work (as long clusters dictionary, i'm assuming), , sets value new list 1 element. the effect of code create list new single value if key not exist, or add together value existing list if exist. the same effect achieved without try/except using defaultdict . defaultdict wraps logic itself. python keyerror

vb.net - cannot receive UDP Packet from microcontroller -

vb.net - cannot receive UDP Packet from microcontroller - i'm working on udp communication pc <-> arm lm3s6965 (luminary) through ethernet. on pc there vb.net application simulates udp server/client. when packet sent pc arm lm3s6965, packet received without errors, when arm lm3s6965 sends udp packet pc, packet lost somewhere (the application doesn’t receive it). the unusual thing wireshark captures these packets coming pc , seems valid. turning off firewall in windows did not help. know topic might wrong forum, can explain why wireshark captures these packets, application doesn’t? arm lm3s6965 (192.168.0.100), pc (192.168.0.116), sending , receiving goes through port number 3040, , sending broadcast message vb.net application received arm lm3s6965 micro controller. here vb.net code: public const mnport int16 = 3040 'port number send/recieve info on public const msbroadcastaddress string = "255.255.255.255" 'se

ruby - Create a rails controller which will update multiple tables in db -

ruby - Create a rails controller which will update multiple tables in db - i new rails. can create 1 controller take json info , update multiple table in db? contoller nuthing in view. i doing following:- routes.rb: post '/data' => 'data#submit' app/controllers/data_controller.rb: class datacontroller < applicationcontroller def submit info = json.parse request.body.read puts info end end then sending post request, restclient.post "localhost:3000/submit_result", data.to_json, {:content_type => :json} but gving error actioncontroller::routingerror (uninitialized constant datacontroller) you need create route in config/routes.rb it. if have action, definition like resource :data, only: [] post :submit end only: [] => makes default crud actions not beingness created. then in controller can following: class datacontroller < applicationcontroller

Spring Security redirects to forbidden page(403) -

Spring Security redirects to forbidden page(403) - i using spring-security on top of spring-mvc application. few points application working on. home page login page i.e /users(). login menu served html dropdown menu. implementing userdetailsservice() , userdetails() instead of authenticationmanager /provider required person view home page without roles. current situation : redirects 403 page mentioned in entrypoint-ref. no thought how redirect user.jsp or /users all examples can find on net somehow show same stuff implementing `authenticationmanager. code : security-context.xml <import resource="servlet-context.xml" /> <!-- global security settings --> <security:global-method-security pre-post-annotations="enabled" /> <!-- spring security framework settings --> <security:http pattern="/users" use-expressions="true" auto-config="true" disable-url-rewriting="true"

Rails - using `url_for` with route path in email does not include host -

Rails - using `url_for` with route path in email does not include host - while not documented nor shown in examples, url_for can used paths (e.g., url_for(signup_path) produce /signup ) vs controllers , actions. however, in doing not include host if 1 set in corresponding environment file. reference: http://api.rubyonrails.org/classes/actiondispatch/routing/urlfor.html why behavior? if want total url, use: url_for(signup_url) from rails guide on route helpers: each of these [ _path ] helpers has corresponding _url helper (such photos_url ) returns same path prefixed current host, port , path prefix. ruby-on-rails ruby-on-rails-4

data binding - Set isActive in view model then checkbox is checked -

data binding - Set isActive in view model then checkbox is checked - i need set true or false each isactive values in view model checkbox checked or not checked in client table. can't implement data-bind alter isactive values typescript viewmodel: class modelviewmodel{ products:knockoutobservablearray<product>; constructor() { products = ko.observablearray<product[]>(); } } typescript model: class product{ name: knockoutobservable<string>; isactive: knockoutobservable<boolean>; } constructor() { this.name = ko.observable<string>(); this.isactive = ko.observable<boolean>(); } html: <table class="table table-bordered"> <tbody data-bind="foreach: vm.products"> <tr> <td><input type="checkbox" id="chekbx" data-bind="value: isactive"></td> <td><span data-bind="text: name"><

forms authentication - c# Update Cookie, without forcing the user to login -

forms authentication - c# Update Cookie, without forcing the user to login - i have 'ui' setting controls appearance, user can alter setting, involves updating cookie. i seem able update, forces user authenticate again, how can update cookie without getting user autenticate again? //we need update usertoken menuoptionchanged var usertoken2 = new usertoken(schedule.minimisedmenubool); httpcookie cookie = formsauthentication.getauthcookie(usertoken.username, false); var ticket = formsauthentication.decrypt(cookie.value); var newticket = new formsauthenticationticket(ticket.version,ticket.name,ticket.issuedate,ticket.expiration,false,usertoken2.calculaterawtoken(),ticket.cookiepath); // encrypt ticket , store in cookie cookie.value = formsauthentication.encrypt(newticket); system.web.httpcontext.current.response.cookies.set(cookie); why saving ui appearance preferences in

android - Id on Nfc tag not unique? -

android - Id on Nfc tag not unique? - i reading nfc tags on android phone, there value written tag read this: @override protected string doinbackground(tag... params) { tag tag = params[0]; ndef ndef = ndef.get(tag); if (ndef == null) { // ndef not supported tag. homecoming null; } ndefmessage ndefmessage = ndef.getcachedndefmessage(); ndefrecord[] records = ndefmessage.getrecords(); (ndefrecord ndefrecord : records) { if (ndefrecord.gettnf() == ndefrecord.tnf_well_known && arrays.equals(ndefrecord.gettype(), ndefrecord.rtd_text)) { seek { homecoming readtext(ndefrecord); } grab (unsupportedencodingexception e) { log.e(tag, "unsupported encoding", e); } } } homecoming null; } private string readtext(ndefrecord record) throws unsupportedencodingexception { byte[] payload = record.getpayload(); string textencodi

servicestack - combine AspNetWindowsAuthProvider and CredentialsAuthProvider -

servicestack - combine AspNetWindowsAuthProvider and CredentialsAuthProvider - is possible utilize aspnetwindowsauthprovider , fallback credentialsauthprovider if current user not logged in windows domain? thanks it works other authproviders can register authentication options wish allow, e.g: plugins.add(new authfeature( () => new customusersession(), //use own typed custom usersession type new iauthprovider[] { new aspnetwindowsauthprovider(this) { allowallwindowsauthusers = true }, new credentialsauthprovider(), })); users still need explicitly log in chosen auth option, i.e. login windows auth need access /auth/windowsauth route whilst login credentials auth need explicitly post username/password, i.e: <form action="/auth/credentials"> <input type="text" name="username" /> <input type="password" name="password" /> <input typ

Create View based on condition in SQL Server -

Create View based on condition in SQL Server - this question asked several times, cann't figure out things. first, have situation need create view (must view), according result of 1 query. create view if (select count(oid)...)>1 select1 else select2 i know form not allowed. how can accomplish this? have tens of views need create. because these select statements contain spatial conditions, , database big , has many many tables, need 'most optimal' solution, or query forever. i read using stored procedures , ud functions, how create view them , max performances? don't need parameters in it, way create views defined condition. you can have view phone call stored procedure. create view conditionalview execute sp_conditionalview then set conditional code in stored procedure. sql sql-server stored-procedures view user-defined-functions

vba - Colored Text in a RichTextbox -

vba - Colored Text in a RichTextbox - i new richtextbox , have been trying alter font color, couldnt find out how it. is possible? thanks you can found here. vba richtextbox

java - Reading file and defining lines and elements? -

java - Reading file and defining lines and elements? - i'm trying assign rows capitalized alphabets , columns little alphabets, sec while statement not print reason fyi tried assigning rows numbers couldn't assign int strings. the txt file consists of : *without spaces between lines abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz and possiable alter element if given specific row , column? thank in advance. edit: in main class phone call methods in class. package archmap; import java.io.*; import java.util.*; public class readfile { private scanner reader; scanner vari = new scanner(system.in); public void openfile(){ seek { system.out.print("enter file location"); string y = vari.nextline(); reader = new scanner(new file(y)); }catch(exception e){ system.out.println("error

c# - How to diagnose InnerException content on deployed (client machine) in unknown thread? -

c# - How to diagnose InnerException content on deployed (client machine) in unknown thread? - i've got c# application running on microsoft .net (4.x), , on 2 machines application installs , run well. on other machines (client machines), can't debug : no visual studio, no symbol no debug mode. but, crash. have in windows event log: 例外情報:system.reflection.targetinvocationexception スタック: 場所 system.runtimetypehandle.createinstance(system.runtimetype, boolean, boolean, boolean byref, system.runtimemethodhandleinternal byref, boolean byref) 場所 system.runtimetype.createinstanceslow(boolean, boolean, boolean, system.threading.stackcrawlmark byref) 場所 system.runtimetype.createinstancedefaultctor(boolean, boolean, boolean, system.threading.stackcrawlmark byref) 場所 system.activator.createinstance(system.type, boolean) 場所 system.activator.createinstance(system.type) 場所 devexpress.xtrasplashscreen.threadmanagerbase.createform() 場所 devexpress.xtrasplashscreen.t

html - WordPress page-container padding -

html - WordPress page-container padding - i unable remove padding gap @ top of page below navbar in wordpress theme (divi). think i've identified possible culprit beingness page-container div, has top padding of 78px. http://i.imgur.com/wruf7aa.jpg 50px seems remove when tinkering within browser preview, won't carry on when create alter , reload page. http://i.imgur.com/uerrghl.jpg i've tried 10 different css overrides within theme, nil seems remove it. have possible suggestion? i'm out of ideas. the padding-top: 78px style has been added inline why overwrites padding-top add together within stylesheet. need utilize !important here. can add together css @ bottom of stylesheet , should work: .et_fixed_nav #page-container { padding-top: 0px !important; } html css wordpress padding

java - Currency app needs update -

java - Currency app needs update - i need som minor help now. app runs great when come in ex. usd, 2 sek results 13,38. if alter amount 3 nil happens. have alter currencys , forth create change. app alter result alter value. please help!:) package com.example.currencyconverter; import android.app.activity; import android.os.bundle; import android.text.textutils; import android.view.menu; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.edittext; import android.widget.spinner; import android.widget.textview; public class mainactivity extends activity { private string [] currency_name; private arrayadapter<string> adapter; private spinner spin1, spin2; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); setupthespinners(); } @override

jpa - JPQL Average Time Difference -

jpa - JPQL Average Time Difference - i have order bills , receive bills. bill can have multiple bill items. 1 order bill item may have none or more receive bill items. i want calculate lead time, average time difference between order , receipt in jpql (java persistance query language) query in days. utilize eclipselink 2.4 persistence provider. this query attempted. there way can take average lead time using jpql ? jpql = "select avg(b.createdat - rb.createdat) " + " billitem bi " + " bring together bi.bill b " + " joib bi.referancebillitem rbi " + " bring together rbi.bill rb " + " b.billtype in :bts " + " , rb.billtype in :rbts " + " , bi.item=:amp " + " , b.createdat between :fd , :td " + " "; jpa jpql

for loop - Compare all elements of a singly linked list to each other (C++) -

for loop - Compare all elements of a singly linked list to each other (C++) - i trying implement function compares nodes of singly linked list each other. for example, let's assume have linked list 8 nodes. (i don't have count tells me however) i need compare 1 2,3,4,5,6,7 , 8. need compare 2 3,4,5,6,7, , 8. obviously, can't compare 1 1, 8 8, , 2 1 after 1 , 2 compared. i know double for-loop, having hard time structuring this. can provide insight or pseudocode? i assume it's this: //i know list not empty. don't know if contains 1 node. node * current = list; node * compwith; if (current->next != null) { (current = list; current->next != null; current = current->next) (compwith = current->next; compwith->next != null; compwith = compwith->next) //compare here } however not exclusively sure loops stopping @ right time, , think i'm doing double comparisons somewhere. insight or pseudocode? c++ for-

html - CSS - DIV positioning problems -

html - CSS - DIV positioning problems - i trying place 2 div s next each other next id s: map_size , menu_option . whenever re-size screen, menu_option div goes below map_size one. also, have 1 div id button_position , contain multiple buttons. how can place these buttons below each other on center , create button name bigger? below html , css in advance! current fiddle class="snippet-code-css lang-css prettyprint-override"> body{ margin:0px auto; width:80%; height:80%; } /*map size*/ #map_size{ width:1190px; height:1300px; background:#0099ff; border-style: solid; border-color: black; position: relative; float:left; } /*menu bar option*/ #menu_option{ width:200px; height:600px; background:#0099ff; border-style: solid; border-color: black; position: relative; float:right; overflow:hidden; } #button_position{ width: 150px; height: 80px position: relative; } cla

statistics - What is this error in R? -

statistics - What is this error in R? - i have 2 variables: decsorgs2 , regionfactor (which factored "region") freq(decsorgs2) decsorgs2 frequency percent 0 disagree 365 53.76 1 agree 314 46.24 total 679 100.00 freq(regionfactor) regionfactor frequency percent 1 12 1.767 2 82 12.077 3 128 18.851 4 64 9.426 5 138 20.324 6 43 6.333 7 53 7.806 8 57 8.395 9 102 15.022 total 679 100.000 i'm trying anova aov(). aov(decsorgs2~regionfactor) error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : na/nan/inf in 'y' in addition: warning message: in model.response(mf, "numeric") : nas introduced coercion what error? don't understand of these terms. thanks edit: ok, did hail-mary random effort , recoded decsorgs2. initially had:

indexing - Why would this simple MySQL update query take so long? -

indexing - Why would this simple MySQL update query take so long? - my host has been sending me messages on lastly few months saying site using way many mysql minutes. send logs showing queries utilize time on occasion. of queries kind of long , complicated, understand why issue. few have me scratching head. 1 want focus on next this: update parentmessages set views=views+1 parentid='11308' the number example, parentid. parentmessages table has parentid primary key, think indexed , found. there 11,000 records in table, not many. here numbers host gave me how long query took on 6 instances yesterday: taking 0.126455 , 1.472929 , 1.638743 , 3.040538 , 7.130041 , 112.498037 seconds complete the 112 random glitch suppose, why take 3, 7 seconds sometimes?! best bet because have lot of indices on table don't know plenty mysql know if matter. , why 1/10th of sec , many seconds? here show create table: create table `parentmessages` ( `parentid`

POST text, image, integers to MySQL Database via PHP -

POST text, image, integers to MySQL Database via PHP - i developing website users can upload community listings. implementing via php , mysql. currently, except photo , description working, , scheme error, "you not registered due scheme error. apologize inconvenience." showing on page load. the database follows: id int(10) name (varchar(140) email (varchar(100) neighborhood (text) method (text) title (text) description varchar(1000) price float condit text photo varchar(30) data date the form code: <form action="newpost.php" method="post" enctype="multipart/form-data"> <p>first name: <input type="text" name="postername" size="40" maxlength="40" required/></p> <p>email: <input type="email" name="email" size="40" maxlength="40" required/></p> <p><label>neighborhood: <select name="n