Posts

Showing posts from March, 2015

c# - Invalid Object Name in ExecuteNonQuery -

i'm trying develop application allows track spending part of class. run error "invalid object name 'dbo.acctransactions" my windows form code: string command = "insert dbo.acctransactions (id, transact_id, payee, dateof, amount, category)" + "values (@id, @transact_id, @payee, @dateof, @amount, @category)"; sqlcommand cmd = new sqlcommand(command, con); cmd.parameters.addwithvalue("@id", 1); cmd.parameters.addwithvalue("@transact_id", 2); cmd.parameters.addwithvalue("@payee", payeetextbox.text); cmd.parameters.addwithvalue("@dateof", datetime.today); cmd.parameters.addwithvalue("@amount", convert.todecimal(amounttextbox.text)); cmd.parameters.addwithvalue("@category", categorytextbox.text); con.open(); cmd.executenonquery(); con.close(); my connection string: sq

How to merge bins in R -

so, trying merge bins of histogram whenever number of observations in bin less 6. library(fitdistrplus) mydata <-read.csv("book2.csv",stringsasfactors=false) qf3<-as.numeric(mydata[,1]) histrv<-hist(qf3,breaks="fd") binvec<-data.frame(diff(histrv$breaks)) binbreak=histrv$breaks freq<-histrv$count datmean=as.numeric(mean(qf3)) datsigma=as.numeric(sd(qf3)) templist<-as.numeric()#empty list (i in 1:nrow(binvec)){ templist[i]=pnorm(binbreak[i+1],datmean,datsigma)-pnorm(binbreak[i],datmean,datsigma) } pi<-data.frame(templist) chisqvec<-(freq-length(qf3)*pi)^2/(length(qf3)*pi) xstat=sum(chisqvec) the above code provide histogram 5 bins contain less 6 observations, bins 6000-7000, 7000-8000, 8000-9000, 9000-10000, , 10000-11000. each of these 5 bins contain 2, 5, 2, 2, , 1 observations respectively. merge bins can have more 5 observations. in other words, have 2 bins 6000-8000 , 8000-11000 can contain 7 observations , 5 observations. d

java.lang.NoClassDefFoundError: org/hibernate/Session hibernate jars is set -

Image
i inherited several projects javas in new job, i'm having problems settings. i'm facing problem researched common. "java.lang.noclassdeffounderror: org / hibernate / session", put jars unnecessary hibernate mapped in classpath. im using tomcat 7, hirbernat 4, jre7. every project extends compnet have necessary jars in lib folder. do need put mapped jars in project ? the erro catch here: @override public void init(servletconfig config) throws servletexception { super.init(config); hibernateutil.currentsession(); } classpath: <classpathentry kind="src" path="src"/> <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry exported="true" kind="lib" path="/compnet/lib/xstream 1.3/xpp3_min-1.1.4c.jar"> <attributes> <attribute name="org.eclipse.jst.component.dependen

Ruby on Rails: Making a printable character sheet -

i'm planning on building online character builder in-development roleplaying system. have handle on of technical aspects of builder, 1 thing keep getting hung on how make printable character sheet. for rails application, best way approach this? using html pdf solution wicked_pdf work best, or better using prawn facilitate generation of sheet? or different trick? i've seen (in general) character sheet generators overlay information on top of fixed sheet - approach, or there better ways it?

F# transforming and aggregating a list of lists -

i have following set of data let results = [[true;false;true];[true;true;false];[false;false;false]] i want turn into let summary = [2;1;1] is can done of box? thinking list.collect can't work. thanks in advance based on sample, suppose want sum number of true values in 1st, 2nd, 3rd etc. elements of input lists, respectively. one way turn list of booleans list of numbers containing ones or zeros , aggregate lists. so, input, list numbers be: [[1; 0; 1]; [1; 1; 0]; [0; 0; 0]] this can using nested list.map : results |> list.map (list.map (fun b -> if b 1 else 0)) now need zip lists , add corresponding numbers. given first 2 lists, can using list.map2 follows: list.map2 (+) [1; 0; 1] [1; 1; 0] = [2; 1; 1] the whole thing can written single nice pipeline using partial application: results |> list.map (list.map (fun b -> if b 1 else 0)) |> list.reduce (list.map2 (+))

class - Android Variable Usage within Classes -

i have class within activity , can not use variables in subclass in activity class. why happening?! this in subclass: try { httpresponse response = client.execute(getrequest); inputstream jsonstream = response.getentity().getcontent(); bufferedreader reader = new bufferedreader(new inputstreamreader(jsonstream)); stringbuilder builder = new stringbuilder(); string line; while((line = reader.readline()) != null) { builder.append(line); } string jsondata = builder.tostring(); log.e("data", jsondata); person = new jsonobject(jsondata); email = person.getstring("email"); } catch (clientprotocolexception e) { e.printstacktrace(); log.e("no data", "nothing");

box api - Integrating a Web Application with BOX.NET using Content API -

i in process of conducting poc integrating 1 of our corporate applications box.net. corporate application resides on amazon cloud , use app perform crud operations on box. can go ahead , start using content api (rest) provided box.net? on box side have go , register application obtain api key. please confirm if understanding correct. thanks that's correct. start using box.com api should go http://developers.box.com , api key application. depending on language code in, there sdks can use, or can code directly against rest content api. the box apis free build against. users login application have go through oauth2 flow allow application access box content.

mysql - How to get other columns from a row when using an aggregate function? -

i'm embarrassed i've been trying accomplish hours without success. i've read dozens of similar questions on stackoverflow , tried countless different things, not have enough grasp of sql achieve i'm trying accomplish. i have 2 tables, products , product_prices . simplicity, suppose following: products: id product_prices: id | p_id | price | date_added what need added price, along date price added. so, in other words, each product, need recent price , date_added (along product id, p_id , of course). if needed recent date , price 1 product id known, can this: select price, date_added product_prices p_id = 1 order date_added desc limit 1 however, type of query not work when need recent date , price all of products. i believe solution use max() aggregate function in conjunction group by , subquery, cannot work. here test database on sql fiddle: http://sqlfiddle.com/#!2/881cae/3 i realize there lot of similar questions on here, have read m

python - Are compound if statements faster, or multiple if statements? -

say have 2 pieces of code: if foo == true , bar == false , baz == true: and if foo == true: if bar == false: if baz == true: which faster? on machine ipython in [1]: foo = true in [2]: bar = false in [3]: baz = true in [4]: %%timeit ...: if foo , not bar , baz: ...: lambda: none 1000000 loops, best of 3: 265 ns per loop in [5]: %%timeit ...: if foo: ...: if not bar: ...: if baz: ...: lambda: none 1000000 loops, best of 3: 275 ns per loop it looks there whopping 10ns overhead if split up. if 10ns matters, should using language. so practical purposes, no, there no difference. if little deeper, can see tiny difference comes though. in [6]: def compound(): ...: if foo , not bar , baz: ...: lambda: none in [7]: def multiple(): ....: if foo: ....: if not bar: ....: if baz: ....: lambda: none in [8]: import dis in [9]: dis.dis(c

Displaying binary tree in Haskell -

data bintree = empty | node (bintree a) (bintree a) deriving (show) i'm trying figure out way display binary tree in manner such each level go down in tree, want add additional * next name of node , have them separated \n . for example: let x = node "parent" (node "childleft" (node "grandchildleftleft" emp emp) emp) (node "childright" emp emp) putstrln $ displaytree x should return: "parent" *"childleft" **"grandchildleftleft" *"childright" my function (only prints 1 * ): displaytree :: show => bintree -> string displaytree emp = "" displaytree (node head emp emp) = (show head) displaytree (node head left emp) = (show head) ++ "\n*" ++ displaytree left displaytree (node head emp right) = (show head) ++ "\n*" ++ displaytree right displaytree (node head left right) = (show head) ++ "\n*" ++ displaytree left ++ "\n*" ++ displayt

detect if phone screen is on/off in iOS -

i have requirement in application detect if phone screen on/off when application in background? found can possible using private framework spring board. can public apis? thank. try this: in appdelegate.m - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { //other code [self registerfordevicelocknotif]; } //register notification -(void)registerfordevicelocknotif { //screen screendisplaystatus notifications cfnotificationcenteraddobserver(cfnotificationcentergetdarwinnotifycenter(), null, screendisplaystatus, cfstr("com.apple.iokit.hid.displaystatus"), null, cfnotificationsuspensionbehaviordeliverimmediately); cfnotificationcenteraddobserver(cfnotificationcentergetdarwinnotifycenter(), //center null, // observer screenlockstatus, // callback cfstr("com.apple.springbo

nodemailer - How can I form a wrapper for another module in Node.JS? -

i have following custom module using wrapper nodemailer var nodemailer = require("nodemailer"); function emailer(to, subject, message) { this.to = to; this.subject = subject; this.message = message; this.smtptransport = nodemailer.createtransport("smtp",{ service: "gmail", // sets automatically host, port , connection security settings auth: { user: "*******", pass: "*******" } }); this.send = send; function send() { this.smtptransport.sendmail({ //email options from: "******* <*****>", // sender address. must same authenticated user if using gmail. to: this.to, // receiver subject: this.subject, // subject text: this.message // body }, function(error, response){ //callback if(error){ //console.log(error); }else{ //console.log("message sent: " + response.message); } smtptransport

c# - Remove the space between single characters only -

i have following string , i'm trying remove space between only single characters , leaving words spaced. example string this s e n t e n c e. the result needs be: this sentence. another example of: words must remain spaced **s n g l e** characters **l k e** joined. would become: words must remain spaced **single** characters **like** joined. res = regex.replace(s, @"(?<=\b\w)\s(?=\w\b)", "");

mysql - PHP Error Retrieving Data From Remote Database (Not Populating Query) -

the following code takes data form retrieved remote database. $find = mysqli_real_escape_string($connect, $_post['name']); echo ' '.$find; $query_seek = mysqli_query($connect, "select * test_2 name = '$find' "); if($query = $query_seek) { echo 'query successful'; } when run it, query not seem resolve or echo data. simple using method versus post? prefer not have query pass through url security if can't helped it. assume syntax sql correct ran on server side through phpmyadmin's sql client. glaringly incorrect? this block comes after check input verified length , no white space.

javascript - Eclipse java Press enter key after giving input -

i writing input in text box using following code: driver.findelement(by.xpath("//*[@id=\"tocgotoinputbox\"]")).sendkeys(s); after have press enter key , using following code: driver.findelement(by.xpath("//*[@id=\"tocgotoinputbox\"]")).click(); but not working. there other way press enter key after giving input in text box?

C - deleting node in doubly linked list -

when try delete every other element in list using deleteinst method method nothing linked list , there no errors. i'm not sure why it's not working i've seen same deleteinst method used in different program. maybe has pointers. if run deleteinst(track.prev, &head); without while loop list still remains unchanged. please let me know if have idea or need more info. thank time. int main() { node *head; node *track; head = readnodelist(stdin); track = lastnode(head); //goes last node. while(track != null){ int i=0; //delete every other node if(i%2 == 1){ deleteinst(track, &head); } i++; track = track->prev; } } void deleteinst(instruction *victim, instruction **head){ if(*head == null || victim == null) return; if(*head == victim) *head = victim->next; if(victim->next != null) victim->next->prev = victim->prev; if(victim->prev != null) victim->prev->next = victim->n

angularjs - Sharing async model data between controllers -

warning: long question i new angular , i've gone through few tutorials , examples such official tutorial on angularjs website. recommended way data app , share data between controllers seems clear. create service shared controllers makes asynchronous request server data in json format. this great in theory, , seems fine in extremely simple examples show 1 controller, or when controllers don't share logic depends on shared data. take following example of simple budget application based on yearly income , taxes: create app dependency on ngresource : var app = angular.module('budgetapp', ['ngresource']); netincomectrl controller handles income , tax items, , calculates net income: app.controller('netincomectrl', function ($scope, budgetdata) { var categorytotal = function (category) { var total = 0; angular.foreach(category.transactions, function (transaction) { total += transaction.amount; });

dimensions - Windows Store load URL image and get size -

i need load 8 images image or bitmapimage elements in c# windows store (windows rt) app, , need find dimensions (even before being displayed). can download images, can't figure out how size (size zero). reason size 0 bitmap image has not loaded, can't figure out how wait till image loaded, catch function indicates image has loaded. here key code, imageopened or imagefailed never called: bm.imageopened += bm_imageopened; bm.imagefailed += bm_imagefailed; bm = new bitmapimage(new uri(arbitraryimageurithatkeepschanging, urikind.absolute)); image.imagefailed += image_imagefailed; image.imageopened += image_imageopened; image.source = new bitmapimage(new uri(arbitraryimageurithatkeepschanging, urikind.absolute)); /* .. @ point image still has not been loaded, can't find dimensions or if failed or not, , functions catch image opened , failed never called..*/ all need load images external web site, , find dimensions, before displaying images.

java - ActionListener gets an error it says(Finals is not abstract and does not override abstract method) -

here code. import java.awt.*; import java.awt.event.*; public class finals extends frame implements windowlistener,actionlistener{ public textfield tf1; public button btn0,btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btnadd,btnminus,btndivide,btnmultiply,btnequals,btnbackspace; public finals(){ panel outputpanel = new panel(new flowlayout()); tf1 = new textfield(" ",30); outputpanel.add(tf1); panel btnpanel = new panel(new gridlayout (5,5)); btn0 = new button ("0"); btn1 = new button ("1"); btn2 = new button ("2"); btn3 = new button ("3"); btn4 = new button ("4"); btn5 = new button ("5"); btn6 = new button ("6"); btn7 = new button ("7"); btn8 = new button ("8"); btn9 = new button ("9"); btnadd= new button("+"); btnminus = new button("-"); btndivide = new button (&

c# - Focus does not move to next new row in grid view when press tab key -

i have designed wpf page. not able set proper tab navigation on grid view. controls (grid view) on page not following tab index. page contain grid , save,cancel button. there gridview. grid has rows , columns. each row contains 2 autocompletebox , 6 textboxes. when first enter value on first autocompletebox,then enter tab move next box , on. enter value in last text box , press enter button, new row formed in grid. press tab focus move on outside button(save button). want move focus on next box( first autocomplete box,not on save button) in second row in grid.pls help... have tried set/ correct control.tabindex properties of freshly added item? see msdn - control.tabindex property . maybe using addingnewitem event in order manipulate added items before displayed. see msdn - datagrid.addingnewitem event .

How can I take the contents of a C# class and put into / take out of a string? -

i have following 2 classes: public class testquestionmodel { public testquestionmodel() { this.answers = new list<testquestionanswermodel>(); } public int testid { get; set; } public int testquestionid { get; set; } public int questionnumber { get; set; } public virtual icollection<testquestionanswermodel> answers { get; set; } } public class testquestionanswermodel { public int answeruid { get; set; } public bool? correct { get; set; } public bool? response { get; set; } public string text { get; set; } } what store answers string , put class: public class testquestion { public int testid { get; set; } public int testquestionid { get; set; } public int questionnumber { get; set; } public string answerstring { get; set; } } can tell me how can in both directions (putting in string , taking out) possible way: public string serialize(icollection<testquestionanswermodel> ans

cocoa - App that is a viewer and editor for the same data type? -

the nsdocument system files read , write particular data type. type needs both read-only , read-write? i'm planning e-mail app; need read-write document type composing messages before sending, , read-only type reviewing sent messages (from sent items folder). mail.app works this. would done 2 nsdocument subclasses? (they use same rfc822 class model class.) how make 1 document type read-only? it's still 1 document. have different ui display editing. in case of email display editing new or reply/reply all/forward action methods. (quoting original mail appropriate. ) technically go , open "read only" mail file in editor can open file.

c++ - Reading in an ascii extended character -

i'm having problem reading in extended ascii character , converting it's decimal value. tried doing this: unsigned char temp; while(temp = cin.get != eof) { cout << (int)temp << endl; } but prints out number 1; the problem here: while(temp = cin.get() != eof) . you assigning temp truth value of cin.get() != eof . until eof encountered, see 1 output. changing to: while((temp = cin.get()) != eof) . will give more closely expecting.

android - How to connect local sqlite database in phonegap -

i have database 1_user.db in local system , want connect through phonegap. have tried not working in case of local db document.addeventlistener("domcontentloaded", ondeviceready, false); var db = window.opendatabase("1_user", "1.0", "just dummy db", 200000); //will create database dummy_db or open //function called when device ready function ondeviceready(){ db.transaction(populatedb, errorcb, successcb); }

iphone - How to know that user has rated the app on appstore or not -

i have downloaded irate link https://github.com/nicklockwood/irate , running fine in app. can come know whether user rated app in app store or not, or opened link? because want perform action if user rate app. thanks in advance. once user outside of app - don't think there can track actions. unless had control on rating systems, don't.

android - How to run this code in a Thread or Async Task? -

when tried running code error, strictmode thread policy, added line. strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy); i later discovered not best approach have run in thread or ansync task, run in thread or asynctask. please edit code when answering @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // requestwindowfeature(window.feature_no_title); // getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, // windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_live_streaming); actionbar actionbar = getsupportactionbar(); actionbar.setdisplayhomeasupenabled(true); abm = new actionbarmenu(livestreaming.this); strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .permitall().build(); strictmode.setthreadpolicy(policy); if (internetstatus.getinstance(this).isonline(this)) { xmlpar

javascript - how do i toggle the visibility of an html element using knockoutjs ? -

i using knockoutjs v3.1.0. trying build master-detail view. problem having elements not showing (though hiding). mock code @ http://jsfiddle.net/jwayne2978/qc4rf/3/ this html code. <div data-bind="foreach: users"> <div>row</div> <div data-bind="text: username"></div> <div data-bind="visible: showdetails"> <div data-bind="text: address"></div> </div> <div> <a href="#" data-bind="click: $root.toggledetails"> toggle div </a> </div> this javascript code var usersdata = [ { username: "test1", address: "123 main street" }, { username: "test2", address: "234 south street" } ]; var usersmodel = function (users) { var self = this; self.users = ko.observablearray( ko.utils.arraymap(users, function (user) { return { username: us

How to add a new entry in OpenLDAP using JXplorer? -

i using jxplorer browser openldap. have imported ldif file, when try add new entry directory following error: because there no schema published directory, adding new entry unavailable. any idea how can resolve this? thanks

MySQL Error Number 1064 -

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'create table if not exists etl_users_banned ( id mediumint(5) not null aut' @ line 14 how fix this? here's code create table if not exists `etl_users_banned` ( `id` mediumint(5) not null auto_increment, `user_id` mediumint(9) not null default '0', `active` tinyint(1) not null default '0', `protection` tinyint(1) not null default '0', primary key (`id`) ) engine = myisam default charset=latin1 auto_increment=58 ;

windows - How to move back one level from the current working directory in perl -

i trying move 1 level current working directory not getting success doing . use strict; use warnings; use cwd qw(); $path = cwd::cwd(); print "debug : $path\n"; from above code can current working directory need go 1 level down. exp : current working directory = 'c:/abc/tmp/folder' needed directory = 'c:/abc/tmp' you don't need module change current working directory. just chdir '..'; will need. chdir built-in operator, nothing needs installed.

Is Java pass by value in case of objects also? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 73 answers i have searched lot , every found java pass value still not satisfied answers. below code. here if passing object of hashmap getting updated value while in case of integer not that. difference between these both. how pass value working in both cases- public static void main(string[] args) { hashmap hm = new hashmap(); system.out.println(hm.size()); //print 0 operation(hm); system.out.println(hm.size()); //print 1 ; why it's updating hashmap. integer c = new integer(3); system.out.println(c); //print 3 getval(c); system.out.println(c); //print 3: why it's not updating integer hashmap. } public static void operation(hashmap h) { h.put(“key”, “java”); } public static void getval(integer x) { x = x + 2; system.out.println(x

r - Multinom with Matrix of Counts as Response -

according of multinom , package nnet , "the response should factor or matrix k columns, interpreted counts each of k classes." tried use function in second case, obtaining error. here sample code of do: response <- matrix(round(runif(200,0,1)*100),ncol=20) # 10x20 matrix of counts predictor <- runif(10,0,1) fit1 <- multinom(response ~ predictor) weights1 <- predict(fit1, newdata = 0.5, "probs") here obtain: 'newdata' had 1 row variables found have 10 rows how can solve problem? bonus question: noticed can use multinom predictor of factors, e.g. predictor <- factor(c(1,2,2,3,1,2,3,3,1,2)) . cannot understand how mathematically possible, given multinomial linear logit regression should work continuous or dichotomous predictors. the easiest method obtaining predictions new variable define new data data.frame. using sample code > predict(fit1, newdata = data.frame(predictor = 0.5), type = "probs") [1] 0.

visual c++ - Warning C4278: 'GetCurrentDirectory': identifier in type library 'GCRComp.tlb' is already a macro; use the 'rename' qualifier -

i'm migrating vc++ 6.0 application visual studio 2008. i've fixed migration errors, i'm fixing warnings. following warning occurs in 40 instances, after trial , errors , research in google, i'm not able fix warning. please find below instance of c42778 error, if fix 1 below, i'll follow same approach fix remaning 39 warnings. warning c4278: 'getcurrentdirectory': identifier in type library 'gcrcomp.tlb' macro; use 'rename' qualifier ------code snippet zipfile1.h ------- #import "gcrcomp.tlb" rename_namespace("gcrtools") // c42778 ------code snippet gcrcomp.tlh ------- virtual hresult __stdcall raw_getcurrentdirectory { /*[out]*/ bstr * dirname, /*[out, retval]*/ variant_bool * okstatus)=0; virtual hresult __stdcall get_currentdirectory { /*[out, retval]*/ bstr * pval)=0; __declspec(property(get=getcurrentdirectory)) _bstr_t currentdirectory; variant_bool getcurrentdirectory ( bstr * dirname); _bstr_t

shell - How do I get the percentage of used storage in the UNIX server -

i want percentage of disk space in unix server filesystem size used avail use% mounted on /dev/sda1 457g 90g 344g 21% / udev 2.0g 4.0k 2.0g 1% /dev tmpfs 798m 1.1m 797m 1% /run none 5.0m 0 5.0m 0% /run/lock none 2.0g 23m 2.0g 2% /run/shm cgroup 2.0g 0 2.0g 0% /sys/fs/cgroup i using following command percentage data df -h > space.txt space=`head -2 space.txt | tail -1 | cut -d' ' -f15 | sed 's/%.*$//'` is there command "used percentage" directly you use this: used=$(df / | awk 'end{print $5}') echo $used 56% rather running df without specifying filesystem mean , looking in mass of lines, specify / filesystem front, know result on last line. take advantage of using end in awk 5th field in last line only.

laravel - php redirect to another page in lavarel -

i have modal view (the 1 bootstrap) in front end. upon clicking submit button user going function in controller: route::post('post_question', array('uses' => 'questioncontroller@postquestion')); and @ end of postquestion want redirect page. i tried: return redirect::to('mywebsite/question/1'); return response::make( '', 302 )->header( 'location', 'mywebsite/question/1' ); return redirect::route('question/'.$question_id)->with("question",question::find($question_id)); header("location: mywebsite/question/$question_id"); none seem work though. the thing is, can see request in xhr page not redirected. modal somehow blocking behavior? you can redirect ajax request. however, find results not quite expected. on redirect, laravel should set response code header redirect response , content of redirected page sent. you 1 of 2 things depending on how wanted handle things.

jquery - how to reverse the curtain scroll effect multiple times on a single page layout -

i trying recreate effect opposite directions , layers opposite well. so @ end of example final page scrolls revealing fixed form... i want effect in reverse, first page fixed , 2nd page scrolls covering it. when 2nd page covers whole page becomes fixed , form scroll covering second page. can not figure out please or shoot me in right direction. here fiddle: http://jsfiddle.net/kppn6/39/ also recreate effect % or em tags pages 100% of viewport , once scroll covering 100% of original page become fixed. is possible? if how?

javascript - script element with async attribute still block browser render? -

Image
i use cuzillion tool build page : <head> <script async></script> </head> <body> <img /> <img /> <img /> </body> there 1 script element in head, async attribute , 2 second delay, 3 second execute. but page load timeline in chrome is: when script executing, still block browser render process? but why? shouldn't execute asynchronously? however doesn't block parser: the execution of script blocks parsing, rendering, , execution of other scripts in same tab. attribute async not change that. the thing async tell browser script should fetched (assuming it's remote file) without blocking activities. after script downloaded, script starts executing @ next available opportunity (that is, right after current script, if any, finishes running; new script won't, of course, interrupt running script). once happens, rendering blocked. so, fast web server, downloading happens fast as

sql - INNER JOIN one column on more than one column in another able? -

i have 3 tables following: ids: id | id_code 1 | abcde 2 | jklmn 3 | pqrst players: full_name| initials john s. | js anne p. | ap jen l. | jl games: id | player | points | player2 | points2 1 | js | 2 | ap | 1 2 | ap | 1 | jl | 3 2 | jl | 3 | js | 4 3 | jl | 4 | ap | 1 ====== i want following output: id | id_code | full_name | points | full_name_player_2 | points2 i can't figure out how more 1 join statement... update with new structure: select i.id, i.id_code, p1.full_name, g.points, p2.full_name, g.points2 @ids inner join @games g on g.id = i.id inner join @players p1 on g.player = p1.initials inner join @players p2 on g.player2 = p2.initials old database i think result. let me know if works. select i.id, i.id_code, p1.full_name, g.points, p2.full_name, g.points2 @ids inner join @players p1 on p1.id = i.id inner join @

jquery - Force each row in bootstrap table to be a one-liner when table is wider than screen -

Image
i building dynamic table consists of 1-50 columns depending user selects. when user selects 1-6 colums there no problem showing data on screen (see ex.1 ) when user selects more 6 columns table tries squeeze view on screen resulting in each row being expanded multiple lines (see ex.2 ). the column width not defined varies depending on text show. how can make sure row one-liner ex.1 no matter how many columns user selects? i have jsfiddle demo code: <table class='table'> <thead> <tr> <th>column 1</th> <th>column 2</th> <th>column 3</th> <th>column 4</th> <th>column 5</th> <th>column 6</th> </tr> </thead> <tbody> <tr> <td>row 1</td> <td>row 11</td> <td>row 11 1</td>

python - How to customize error response in a Turbogears2 controller -

i'm using turbogears2 develop small web application. , in of "controllers", response client json object error information inside instead of html page follows standard error page template, because ajax client can read error message , have it's own way display it. there multiple ways can achieve this. if bound controller can register controller wrapper them (using tg.hooks.wrap_controller ) , return json instead of plain error when needed. controller wrappers documented on http://turbogears.readthedocs.org/en/latest/turbogears/hooks.html#controller-wrappers otherwise options use decorator on controller function catch error. done tgext.crud when reporting json errors through catch_errors custom decorator: https://github.com/turbogears/tgext.crud/blob/master/tgext/crud/decorators.py#l114 the controller wrapper solution more powerful can applied third party controllers. otherwise can hijack errorcontroller in controllers/error.py return json using json

Redirect using PHP rather than redirects in Cpanel -

probably question has been asked before cannot seem find satisfying answer. i have following urls website: mywebsite.com/profile.php?id=abc mywebsite.com/profile.php?id=xyz mywebsite.com/profile.php?id=mno i create redirects enter url mywebsite.com/abc redirect mywebsite.com/profile.php?id=abc mywebsite.com/xyz redirect mywebsite.com/profile.php?id=xyz mywebsite.com/mno redirect mywebsite.com/profile.php?id=mno i either url entered mywebsite.com/abc , changed mywebsite.com/profile.php?id=abc in browser's address bar or remain mywebsite.com/abc. i know how using redirects tool in cpanel - more efficient me using php and/or pdo rather creating each 1 manually. i know asked php way this, .htaccess rule, add 1 rule , work urls: rewriteengine on rewriterule ^([^/]*)$ /profile.php?id=$1 [l] this accomplish want: mywebsite.com/mno redirect mywebsite.com/profile.php?id=mno mywebsite.com/abc redirect mywebsite.com/profile.php?id=abc mywebsite.com/xyz redirect

CSS3 Ribbon in HTML table -

i refer tutorial of css3-tricks ribbon tutorial . i'd adjust th element inside table css3 looks ribbon in tutorial. i've set jsfiddle test it, unfortunetly can't it. can me? try giving display: block .ribbon , , take off background table. here's example 1 . or can try add table: position:relative , z-index:-2 . here's example 2 . update 1 , here 100% width: example 3 . update 2 example 4 example 5

bash - Colon used after the equal sign in a shell script -

the following taken gnu ld configure file: if test $ac_verc_fail = yes; ld=: critic_missing="$critic_missing ld" fi what's meaning of colon? the : shell builtin equivalent true command. used no-op, e.g. after if statement. please see this excellent reply @earl more information. best regards //kh.

Retaining form values in Ruby on Rails -

i working on ror application , retain form values after form reloads on error server side user doesn't have go through filling form again. this standard functionality, enabled use of @instance variable . allows send data ruby class (controller) , process returned data in single instance you'd this: #app/controllers/posts_controller.rb def new @post = post.new #-> notice instance variable end def create @post = post.new(post_params) @post.save end private def post_params params.require(:post).permit(:title, :body) end this enables maintain instance of newly created activerecord object. means each time can't submit form, you'll receive errors inputted data

php - .htaccess only apply to it's own directory -

i want domains bit tidier removing extensions in url. here 2 examples. before: domain.ext/index.php after: domain.ext/index/ this i've gathered (inactive) question here: rewritecond %{request_filename} !-d rewritecond %{the_request} ^get\ /[^?\s]+\.php rewriterule (.*)\.php$ /$1/ [l,r=301] rewritecond %{request_filename} !-d rewriterule (.*)/$ $1.php [l] rewritecond %{request_filename}.php -f rewriterule .*[^/]$ $0/ [l,r=301] right i'm developing in directory root, , it's replacing following url: domain.ext/versionx/search.php with: domain.ext/search.php which of course doesn't exist right now. there way modify code affect files in it's own directory? you can use code instead: rewritecond %{the_request} \s/+(?:index)?(.*?)\.php[\s?] [nc] rewriterule ^ /%1/ [r=301,l,ne] rewritecond %{request_filename} !-d rewritecond %{document_root}/$1.php -f [nc] rewriterule ^(.+?)/?$ /$1.php [l] rewritecond %{request_filename} !-f rewriterule

javascript - data from db only post records on the first column -

i have table column has select type property. data coming database, when using fetch_array first row row retrieves records below script problem. query concerned after //for terminal <div id='tab2' class='website_comops_3rd_shift'>// loop 3rd shift (1st) <table border='1' id='table_id' style='margin: 10px'; cellpadding='1' cellspacing='1' bordercolor='#333333' bgcolor='#c0ccd0' > // <tr> <th><font size='2' face='baskerville' id='systems'>systems</font></th> <th><font size='2' face='baskerville' id = 'schedule'>sched</font></th> <th><font size='2' face='baskerville' id='start_time'>start_time</font></th> <th><font size='2' face='baskerville' id='end_time'>end_time</font></th> <th><font size=&