Posts

Showing posts from July, 2010

functional programming - How to map a function in Common Lisp? -

i made function in common lisp (defun f (&key n p x) (* (combinacion n x) (expt p x) (expt (- 1 p) (- n x)))) and works fine. thing want make function in common lisp lake following haskell function ff n p x = sum . map (f n p) $ [0 .. x] namley, map function f partially applied list. i made following function create lists (defun range (&key max (min 0) (step 1)) (loop n min max step collect n)) and works fine too, need know how make mapping. common lisp doesn't have partial applications built in, have write lambda expression want. (defun map-f (n p limit) (let ((x-list (range :max limit))) (mapcar #'(lambda (x) (f :n n :p p :x x)) x-list)))

matrix multiplication with factor of array matlab -

have matrix have size x y , matrix b x 1 in matrix b have element represent kind of co factor correspondent matrix want program * b ( * factor of each array ) example a (4 * 3) = [ 2 4 6 ; 5 10 15 ; 7 11 13 ; 1 1 1]; b (4 * 1) = [ 4 ; 1/5 ; 3 ; 7]; want * b [ 2*4 , 4*4 , 6*4 ;5/5 , 10/5 , 15/5 ;7*3 , 11*3 , 13*3 ;1*7 , 1*7 , 1*7]; expected result = [ 8 16 24 ; 1 2 3 ; 21 33 39 ; 7 7 7]; i try use scalar multiplication didn't work since scalar multiplication must have same size of array how solve this? use bsxfun desired result of multiplying row elements of a single row value in b bsxfun(@times,a,b)

How to work around the stricter Java 8 Javadoc when using Maven -

you'll realize jdk8 lot more strict (by default) when comes javadoc. ( link - see last bullet point) if never generate javadoc of course you'll not experience problems things maven release process , possibly ci builds fail worked fine jdk7. checks exit value of javadoc tool fail. jdk8 javadoc more verbose in terms of warnings compared jdk7 that's not scope here. talking errors ! this question exist collect proposals on it. best approach ? should these errors fixed once , in source code files? if have huge code base might lot of work. other options exist ? you welcome comment stories of fails pass. horror stories of fails wsimport tools wsimport tool code generator creating web service consumers. included in jdk. if use wsimport tool jdk8 nevertheless produce source code that cannot compiled javadoc compiler jdk8 . @author tag i'm opening source code files 3-4 years old , see this: /** * best class * @author john <john.doe@mine.com> *

sql - Get children and grand-children at all levels for specified parent -

i have table called groups. structure of table : groupid 1------- groupname | parentid *------- now want find children , grand-children specific parent. i have tried below code. gives me children upto 2nd level : list<string> groups = new list<string>(); var parent = (from g in db.groups g.groupid == 1 select g).firstordefault(); var children = (from x in db.groups x.parentid == parent.groupid select x); groups.addrange(children.select(x => x.groupname)); foreach (group children in children) { var grandchildren = (from x in db.groups x.parentid == children.groupid select x.groupname); groups.addrange(grandchildren); } stringbuilder builder = new stringbuilder(); foreach (string str in groups) { builder.append(str.tostring()).appendline(); } messagebox.show(builder.tostring()); you can try doing recur

java - ConcurrentModificationException without modifying object -

i've got following piece of code causing concurrentmodificationexception. i'm not modifying products object @ all, list<product> products = product.findactivebyfilter(filters); set<long> temp = new hashset<long>(); list<product> resultsettemp = new arraylist<product>(); (product product : products) { // << exception points if(!temp.contains(product.getid())){ temp.add(product.getid()); resultsettemp.add(product); } } products.clear(); products.addall(resultsettemp); i've seen exception pop-up several times, cannot reproduce (it happens randomly). product.findactivebyfilter method returns new instance of list<product> has been build cached list<product> . edit: i've found way reproduce error. code called when client wants products (its webshop), , website loads more items when client scrolls down. triggers exception (as server not-yet done responding products, , gets call it). race co

c - why return in if and else not working -

i have simple doubt. trying 2 processes comm using named pipes. it's working fine press n ans, it's not executing return of main. printing "received child : " in parent process. #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include <errno.h> #include <fcntl.h> #include <sys/stat.h> #include<string.h> #include<ctype.h> #include<wait.h> #define np1 "/tmp/np1" #define np2 "/tmp/np2" #define max_buf_size 255 #include <sys/types.h> int main() { int rdfd, wrfd, ret_val, count, numread; char buf[max_buf_size]; char ans; char cp[50]; pid_t pid; ret_val = mkfifo(np1,0666); if ((ret_val == -1) && (errno != eexist)) { perror("error creating named pipe"); exit (1); } ret_val = mkfifo(np2, 0666); if ((ret_val == -1) && (errno != eexist)) { perror("error creating named pipe");

dependencies - Android use App1 sources in App2 without installing App1 on device -

i'm developping 2 apps different names (app1 , app2 instance) , resources (icons , strings mostly) , internal behaviours. i'm trying use .java sources files app1 app2. if import app1's sources in app2's project app1 installed on device upon app2 launching while i'd app2 installed. cannot make app1 library import app2's project since resources conflicting! how use app1's .java files inside app2 without copying them , changing package name 1 one , having remember modify app1's files when bug corrected app2 or new feature added in 1 app , vice-versa? thanks in advance help, gg. parents can't inherit child classes, same goes scenario asking. what can create parent library inherited both app, , perform changes on parents library.

c# - Return entities after intersecting with list of web controls using LINQ -

i can use following return ids (strings) match following intersect: var ids = db.questionoption .select(a => a.controlid) .intersect(cs.select(b => b.clientid)) .tolist(); how intersect ids fetch entity, not matching id? first can ids : var idlist = cs.select(b => b.clientid); then can use contains this: var result = db.questionoption.where(a => idlist.contains(a.controlid)).tolist(); or, can use join : from q in db.questionoption join x in cs on q.controlid equals x.controlid select q

php - Generate all possible 3 positive integers that sum to N -

i not math , can't wrap head around this, want generate every possible 3 positive numbers there sum n example 100, instance: 0 - 0 - 100 0 - 1 - 99 1 - 1 - 98 you don't need answer me php code, general idea on how can generate numbers sufficient. thanks. brute force option in case: can use 2 nested loops , takes less 10000 tests only. // pseudo code (i = 0; <= 100; ++i) (j = 0; j <= 100; ++j) { if ((i + j) > 100) break; k = 100 - - j; print(i, j, k); } if duplicates e.g. 0, 0, 100 , 0, 100, 0 should excluded , can use modified code: // pseudo code (i = 0; <= 100; ++i) (j = i; j <= 100; ++j) { if ((i + j) > 100) break; k = 100 - - j; if (j <= k) print(i, j, k); }

How to stop re-loading of buffered video during orientation changes in android device -

i have videoview in want play video after buffering complete. i have managed 2 different xml code layouts landscape , portrait each. my issue when change orientation of device, video buffering restart again. try putting android:configchanges="screenorientation" in activity tag of manifest file. this way activity not recreated. i think you.

c# - Lambda expression to return one result for each distinct value in list -

i have large list of class object , using following lambda function return elements meet condition. var call = calllist.where(i => i.applicationid == 001).tolist(); this return list of objects have id of 001. i curious different applicationids there are. lambda function list , return list element have different applicationid fetches 1 of those. if understand question can try: var list = calllist.groupby(x => x.applicationid).select(x => x.first()).tolist(); so if have list like: appid:1, appid:1, appid:2, appid:2, appid:3, appid:3 will return: appid:1 appid:2 appid:3

html - iframe Google maps won't print in chrome -

Image
since latest google maps update, i'm unable print map via chrome browser. if try print firefox, , have @ preview, map shows up. my code: <iframe width="600" height="300" marginheight="0" src="http://maps.google.com/maps?ie=utf8&amp;q=loc:{address} {number}@{latitude},{longitude}&amp;z=14&amp;output=embed&amp;iwloc=near" frameborder="0" marginwidth="0" scrolling="no"> </iframe> it displays following (in chrome): and if try print it, get: while in firefox , safari, shows perfect. assume chrome issue? (i've tested on different chrome browsers, on different computers, both mac , pc) or there i'm missing, or should add new maps. small detail, if go developer site of google maps ( https://developers.google.com/maps/documentation/embed/guide ) , try print there, won't print either. think strange, since both maps , chrome build google. does else have i

scope - Javascript: Issue with variable scoping and anonymous function -

i have sample code: function(){ var events = []; var pages = ["a", "b", "c"]; for(var pageindex in pages){ var pagename = pages[pageindex]; var e = function(){ console.info(pagename); }; events.push(e); } for(var eventindex in events){ console.info("index: " + eventindex); events[eventindex](); } } output: index: 0 c index: 1 c index: 2 c desired output: index: 0 index: 1 b index: 2 c is there standard practice this? each e function create closure accesses external variable pagename enclosing code. pagename see value at time function run . @ end of loop pagename "c" , of functions use when executed. you can fix wrapping function in following way, bind current value of pagename function create: function(){ var events = []; var pages = ["a", "b", "c"]; for(var pageindex in pages){ var pagename = pages[pageindex];

regex - One Regular Expression to validate US and Canada ZIP / Postal Code -

i developing stationery program. customers have choice pick region either or canada. when enter address have enter zip/postal code. trying validate field cannot use reg exp either or canada. require regular expression validates both country zip code. not knowing language you're using, not use abbreviations character classes: ^[0-9]{5}$|^[a-z][0-9][a-z] ?[0-9][a-z][0-9]$ depending on language, might able abbreviate to ^([0-9]{5}|[a-z][0-9][a-z] ?[0-9][a-z][0-9])$ or ^(\d{5}|[a-z]\d[a-z] ?\d[a-z]\d)$ to support zip+4: ^(\d{5}(-\d{4})?|[a-z]\d[a-z] ?\d[a-z]\d)$ and if want picky canada codes: ^(\d{5}(-\d{4})?|[a-ceghj-nprstvxy]\d[a-ceghj-nprstv-z] ?\d[a-ceghj-nprstv-z]\d)$

How to split a string conditionally in R? -

i split string multiple columns based on number of conditions. an example of data: col1<- c("01/05/2004 02:59", "01/05/2004 05:04", "01/06/2004 07:19", "01/07/2004 02:55", "01/07/2004 04:32", "01/07/2004 04:38", "01/07/2004 17:13", "01/07/2004 18:40", "01/07/2004 20:58", "01/07/2004 23:39", "01/09/2004 13:28") col2<- c("wabamun #4 off line.", "keephills #2 on line.", "wabamun #1 on line.", "north red deer t217s bus lock out. under investigation.", "t217s has blown cts on 778l", "t217s north red deer bus in service (778l out of service)", "keephills #2 off line.", "wabamun #4 on line.", "sundance #1 off line.", "keephills #2 on line", "homeland security event lowered yellow ( elevated)") df<- data.frame(col1,col2) i able split column w conditionall

c# - Is it possible for one entity to take data from two tables? -

is possible have 1 entity takes data 2 tables? for example. table1 has columns: id, name, table2_id table2 has columns: id, fullname i have entity properties: id, name, fullname what expect configure (fluently) entity framework build query: select t1.id, t1.name, t2.fullname table1 t1 join table2 t2 on t1.table2_id = t2.id is possible without has 2 separated entities , 1 merge both? after quick google find how merge data tables 1 entity. need configure entity framework this modelbuilder.entity<myentity>() .map( m => { m.properties(x=> new { x.id, x.name }); m.totable("table1"); }) .map( m => { m.property(x=>x.fullname); m.totable("table2"); }); but how tell entity framework join tables on table2_id table1 , id table2 . i know can create view , map entity view, if possible i'd use scenario presented. yes, if id same in both tables, can make 1:1 mapping map single entity. you can table per concrete ty

java - Getting date in format dd-MMM-yyyy -

i have below method shown below in date coming of string: public static java.sql.date getsimpledate11(string datestring) { if (datestring == null) { return null; } java.util.date date = null; java.sql.date sqldate =null ; try { dateformat df = new simpledateformat("yyyy-mm-dd"); df.setlenient(false); date = df.parse(datestring); sqldate = new java.sql.date(date.gettime()); } catch (parseexception pe) { throw new runtimeexception("the date entered invalid or has incorrect format"+ datestring); } return sqldate; now want change format: want store date in format dd-mmm-yyyy. what should do? now want change format want store date in format dd-mmm-yyyy you don't need explicit conversion requested date format dd-mmm-yyyy . dates not directly concerned date formats. sql driver class convert proper database specific format before inserting date field of database table. using mysql driver : // statement cause

html - IE 8 - 9 Conditional Stylesheet not triggering -

i've added following ie8 , ie9 use ie8.css doesn't seem using @ when emulate being on ie8 or ie9. (don't have them installed using ie11 developer tools normal.) <!--[if !ie]><!--> <link rel="stylesheet" href="<?php http_host; ?>/styles/global-en.css" type="text/css" media="screen" /> <!--<![endif]--> <!--[if lt ie 9]> <link rel="stylesheet" href="<?php http_host; ?>/styles/ie8.css" type="text/css" media="screen" /> <![endif]--> <!--[if lte ie 8]> <link rel="stylesheet" href="<?php http_host; ?>/styles/ie8.css" type="text/css" media="screen" /> <![endif]--> live url: http://bit.ly/1r4dvw5 the emulator of ie11 abit screwed up, check post: http://www.impressivewebs.com/ie11-emulation-conditional-comments/ what suggest install ietester: http://www.m

python - how to insert the data from csv file into sqlite db? -

there csv file in format. x1 0 1 3 6 x2 4 9 4 5 x3 8 6 7 1 i want insert database 3 fields "x1","x2","x3" following data. x1|x2|x3 0|4|8 1|9|6 3|10|7 6|5|1 i think have transform data when read csv file. import sqlite3 db="test.sqlite" con = sqlite3.connect(db) cur = con.cursor() dat=open("data","r") id,line in enumerate(dat.readlines()): ? con.executemany('insert test values(?,?,?)', value) how right format of value here? transpose data zip(*rows) , remove first line , insert .executemany() call: import csv import sqlite3 open('data', 'r', newline='') infh: rows = list(csv.reader(infh)) columns = zip(*rows) next(columns, none) # skip first column sqlite3.connect('test.sqlite') conn: cursor = conn.cursor() cursor.executemany('insert test values (?, ?, ?)', columns)

objective c - Password Verification - How to securely check if entered password is correct -

i'm developing app requires multiple passwords access varying data areas. example, group of people set chat requires password authentication view. here's how i'm considering doing it: i have keyword, let's hypothetically: banana when user enters password, use rncryptor encrypt banana using entered key, , store encrypted string server. later, when tries enter password, take hashed value server , try decrypt using password entered key. if decrypted value equals banana know entered correct password. i'm new security, i'm not sure if appropriate solution. appreciated. update after making alterations suggested @greg , aptly named @anti-weakpasswords, here's have: - (nsdictionary *) getpassworddictionaryforpassword:(nsstring *)password { nsdata * salt = [self generatesalt256]; nsdata * key = [rncryptor keyforpassword:password salt:salt settings:mysettings]; nsmutabledictionary * passworddictionary = [nsmutabledictionar

plugins - SonarQube Sonar - Project File Bubble Chart -

i have latest sonarqube , it's plugin "project file bubble chart". everything working fine. on dash, see valid information every plugin installed. the newly added "project file bubble chart" plugin - seems has bug or may browser. time use mouse's left button, notice box bubble chart boundary gets expanded few centimeters per each mouse click. sometimes, if refresh page, normal plugin, again time might see getting expanded moving mouse here n there on screen or using mouse roller (middle button). are seeing shenzi well? firefox doesn't have behavior/issue.

java - Scanner reading inputs but outputting previous inputs -

this question has answer here: scanner skipping nextline() after using next(), nextint() or other nextfoo()? 13 answers consider following snippet: system.out.print("input iteration cycles"); scanner reader=new scanner(system.in); int iteration = reader.nextint(); system.out.print("input choice: var or par"); string choice=reader.nextline(); system.out.print(choice); i hoping 1 line prints first input , next print out print next input either var or par, seems second print prints out second input in addition first input. idea why? nextint() not advance next line. must make explicit call nextline() after it. otherwise, choice given newline. add line code: system.out.print("input iteration cycles"); scanner reader=new scanner(system.in); int iteration = reader.nextint(); reader.nextline(); //<==a

AngularJS : after isolating scope and binding to a parentFunction, how to pass parameters to this parentFunction? -

i'm trying hard understand scopes in angularjs , running problems. i've created simple "comments" application that has input box publishing comment (text + 'reply' button) [this working fine] clicking 'reply' button unhides input box publishing reply (with 'publishreply' button) clicking 'publishreply' button, publishes reply below original comment , indents it. i generate comments within 'commentsdirective' using ng-repeat , embed 'replydirective' within each ng-repeat. i'm able bind parent scope's functions child directive's isolated scope, i'm not able pass arguments function. again, think, scope related problem preventing me hide/unhide 'replydirective' on-click of 'reply' button. grateful help. here code in plunker: http://plnkr.co/edit/5amlboh6iepby9k2ljde?p=preview <body ng-app="comments"> <div ng-controller="maincontroller">

sql - How to group by a, b and return set of N rows of b -

using postgres 9.3.2, want count of req_status grouped req_time , customer_id , return set of n rows each customer_id , when req_status count zero. req_time req_id customer_id req_status ----------------------------------------------- 2014-03-19 100 1 'failed' 2014-03-19 102 1 'failed' 2014-03-19 105 1 'ok' 2014-03-19 106 2 'failed' 2014-03-20 107 1 'ok' 2014-03-20 108 2 'failed' 2014-03-20 109 2 'ok' 2014-03-20 110 1 'ok' output req_time customer_id req_status count ------------------------------------------- 2014-03-19 1 'failed' 2 2014-03-19 1 'ok' 1 2014-03-19 2 'failed' 1 2014-03-19 2 'ok' 0 2014-03-20 1 

matlab - solve system of two differential second order equations -

i'm trying solve system of 2 differential second-order equations in matlab, using dsolve function, got error because somehow, dsolve function not convergent. thats i've tried run: syms x3(t) x2(t); t=linspace(0,1,20); sol=dsolve(10*diff(x2,2)==500000*(1-x2)+10000*(x3-x2)-1000*(diff(x3)-diff(x2))... ,350*diff(x3,2)==10000*(x2-1)-1000*(diff(x2)-diff(x3)),... x2(0)==0,x3(0)==0); sol=dsolve(diff(x3,2)==5+x2,diff(x2,2)==5+x3,diff(x3(0))==0,x2(0)==0) x3=eval(vectorize(sol.x3)) x2=eval(vectorize(sol.x2)) [x3, x2]=dsolve(diff(x3,2)==5+x2,diff(x2,2)==5+x3,x3(0)==1) s = dsolve(diff(x3,2)==5) thanks! :-)

datetime - Format current date and time -

i wondering if me. i'm new @ asp want format current date , time follows: yyyy-mm-dd hh:mm:ss but can following response.write date can me out please. date formatting options limited in classic asp default, there function formatdatetime() can format date various ways based on servers regional settings. for more control on date formatting though there built in date time functions year(date) - returns whole number representing year. passing date() give current year. month(date) - returns whole number between 1 , 12, inclusive, representing month of year. passing date() return current month of year. monthname(month[, abbv]) - returns string indicating specified month. passing in month(date()) month give current month string. as suggested @martha day(date) - returns whole number between 1 , 31, inclusive, representing day of month. passing date() return current day of month. hour(time) - returns whole number between 0 , 23, inclusive, represent

sql - ORA-00936: missing expression oracle -

i have query select dal_rownotable.dal_id ( select ticket.id "dal_id", rownumber ( order ticket.id ) "dal_rownumber" ticket_table ticket ( ticket.type = n'i' ) , ( ticket.tenant null or ticket.tenant in ( select * ( select tenant_group_member.tenant_id tenant_group_member tenant_group_member.tenant_group = hextoraw('30b0716feb5f4e4bb82a7b7aa3a1a42c') order ticket.id ) ) ) ) dal_rownotable dal_rownotable.dal_rownumber between 1 , 21 what problem allow query throwing ora-00936 missing expression? anyone? appreciated...error thrown @ column:80 @ beginning of first order by: your query can simplified. has things layers of subqueries , unnecessary order by in in subquery. want rownumber can rownum : select dal_rownotable.dal_id (select ticket.id "dal_id"

javascript - Dijit Dialog Button Event Not Executing -

i have dijit dialog (jsfiddle) created programmatically. when dialog show called pass id's buttons @ runtime. trying create click event functions execute id's passed @ runtime. however events not executing. know how attach function dialog buttons. html <button id="show">show dialog</button> js require([ "dijit/form/checkbox", "dijit/dijit", "dijit/form/textarea", "dijit/form/filteringselect", "dijit/form/textbox", "dijit/form/validationtextbox", "dijit/form/datetextbox", "dijit/form/timetextbox", "dijit/form/button", "dijit/form/radiobutton", "dijit/form/form", "dijit/_dialogmixin"]); require([ "dojo/parser", "dojo/_base/declare", "dojo/domready!", "dojo/ready"], function (parser, declare, ready, dialog) { parser.pa

java - Time complexity of a method that checks a sublist in a linked list -

i need write method public int sublist (charlist list) gets list , returns how many times list exist. for example: my list a b c d b g e parameter list it a b return 2 . my list b b b b parameter list b b return 3 . the method should efficient possible. currently problem don't know mean when efficient possible, if loop through list n times, , everytime find same character loop on both list , go o(n^2)? there better way make o(n) or below? this in effective searching string in string, o(n) complexity http://en.wikipedia.org/wiki/knuth%e2%80%93morris%e2%80%93pratt_algorithm and find first occurrence can keep looking next occurrence in remaining list it's still o(n) find occurrence

java - How to add an object as a property of a JsonObject object? -

here doing: jsonobject jobj = new jsonobject(); jobj.addproperty("name", "great car"); i hoping add property value object follows: jobj.addproperty("car", a_car_object); but appears gson not allow me jobj.addproperty("car", a_car_object) . going following: string json = new gson().tojson(jobj); to json string. is doable? using gson right way? or should use hashmap throw data , new gson().tojson() ? you way: jobj.add("car", new gson().tojsontree(a_car_object));

AngularJs Controller scope in tooltip form -

i trying implement form in tooltip , dynamically inserted. th form on submits calls function in person controller , input field mapped scope model. problem using bootstrap tooltip, creates tooltip outside scope of controller. have considered using angular ui bootstrap tooltip component? see tooltip section here: http://angular-ui.github.io/bootstrap/ . haven't used tooltip component specifically, have used other components , able integrate them controller following provided examples. if doesn't answer question, please add code snippets question can figure out why isn't working.

mysql - HTML and PHP Database Connectivity -

i using code. insert name , rollno in table named 'tablename' in database 'dbname'. db.php <html> <body> <form name="db" action="db.php" method=post> enter name <input type=text name="nam"/><br><br> enter rollno. <input type=text name="rno"/><br><br> <input type=submit value="click me"/> </form> <?php $nam = $_post['nam']; $rno = $_post['rno']; mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('dbname') or die(mysql_error()); $sql="insert tablename values('$nam','$rno')"; mysql_query($sql); ?> </body> </html> it show error, that notice: undefined index: nam in c:\wamp\www\db connectivity\db.php on line 10 notice: undefined index: rno in c:\wamp\www\db connectivity\db.php

c# - How to get the TFS workitem validation error message by code? -

Image
i know workitem.validate method can arraylist of fields in work item not valid( msdn ). but seem contain invalid fields , names, not contain error messages, i.e. why they're invalid, useful situation of submitting workitem without using built in tfs controls. how error tip "new bug 1: tf200012: field 'title' cannot empty."? for better understanding, please see picture. using vs2010 sp1 chinese language, , error discription translated above. visual studio client wraps tfs error messages. can't capture tf* errors can fieldstatus , print own message. var invalidfields = workitem.validate(); if (invalidfields.count > 0) { foreach (field field in invalidfields) { string errormessage = string.empty; if (field.status == fieldstatus.invalidempty) { errormessage = string.format("{0} {1} {2}: tf20012: field \"{3}\" cannot empty." , field.workitem.state

java - Why is my table not visible when it's in a JScrollPane? -

i've been trying hours, different things , searching everywhere solution, can not table in addscorecardupper() show up. horizontal scrollbar, no content, 2 pixels worth of border. import java.awt.borderlayout; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class yahtzeegui extends jframe{ /** * */ private static final long serialversionuid = 3255683022699487295l; private jframe frame; private jpanel panel; private jpanel dicepanel; private jscrollpane scrollpane; private jbutton btnroll; private jbutton[] btndice = new jbutton[5]; private jtable table; private yahtzee y = new yahtzee(); public yahtzeegui(){ createwindow(); addbuttonroll(); addbuttondice(); addscorecardupper(); //addscorecardlower(); frame.add(panel); frame.setvisible(true); } public void createwindow(){ frame = new jframe(); frame.sett

php - does Using clean URL's with query strings change the path/directory -

when use .htaccess , mod_rewrite redirect url query strings, for example: http://www.mysite.com/index.php?group=a&id=23 to url this: http://www.mysite.com/index/a/23 does change path on server, used link .css , .js files? when have main.css in same folder index.php , have change link file like: <link href="../../main.css" rel="stylesheet" type="text/css"> or can stay this: <link href="main.css" rel="stylesheet" type="text/css"> yes changes path browser send. browser not know mod_rewrite rules @ all.

php - enable button only if older than 90 days -

good day i have delete button deletes entries on database, problem want disable button , enable if older 90 days. i used code , it's working if it's not older 90 days still replies "successfully deleted" although not deleted , why thought easier disable delete button , enable if entry older 90 days please assist thanking you $sql="delete client_post id = '$id' , date < date_sub(now(), interval 90 day)"; $result=mysql_query($sql); if($result){ echo('entry '.$id.' deleted <br>'); } else{ echo('<br>failed delete'); }; change if statement to: if($result && mysql_affected_rows() > 0){ problem code checking if $result true, while $result identifier of mysql_query() results. should check how rows affected query.

knockout.js - knockout trim in mvvm validations -

i using knockout mvvm works fine don't want send data containing white spaces server side code. here sample code //regular customer self.nameforregularcustomer = ko.observable("").extend({ required: { message: 'promotion name required' }, maxlength: { message: 'promotion name can not exceed 100 character', params: '100' } }); self.statusforregularcustomer = 1; //for create mode 1 new self.keywordforregularcustomer = ko.observable("").extend({ required: { message: 'keyword required' }, maxlength: { message: 'keyword can not exceed 100 character', params: '100' } }); self.promotionmsgforregularcustomer = ko.observable("").extend({ required: { message: 'promotion message required' } }); self.promotiondescforregularcustomer = ko.observable("").exte

How to get user agent from a thymeleaf html page -

in application using spring + thymeleaf. want user agent including cetain files. <% string browser = request.getheader("user-agent") %> i need done in thymeleaf page.how can that. appreciated you can access httpservletrequest object #httpservletrequest so, example, can print user agent <span th:text="${#httpservletrequest.getrequest('user-agent')}">mozilla/5.0 (compatible; msie 10.0; windows nt 6.1; trident/5.0)</span

javascript - adMod with phonegap cloud build -

i have html5 & javascript application building using phonegap 's cloud build. can't find way implement admob app without using java in way. i built app using notpadd++ , , and phonegap cloud github , don't have single line of java . research showed me using adsense on mobile application not allowed, i'm in bit of pickle... i'm on phonegap version 3.1.0 . there plugins can find through docs @ phonegap build @ present there not easy way this. this 1 of things many users have been asking (including me). please go pgb support community , add voice want this.

c# - Start WebClient Windows Service from Manual state in code -

the webclient windows service installed , set manual default; due customer's restrictions unable change automatic. when service stopped , try access files directory.enumeratedirectories exception: an unhandled exception of type 'system.io.directorynotfoundexception' occurred in mscorlib.dll additional information: not find part of path '\mysever\myfolder'. when webclient service started works fine. accessing path using explorer works fine webclient service started part of request. from code, how can tell windows want access webclient service should start it? i have following (working) code, unsure if requires administrator permission or if there better way this: using (servicecontroller servicecontroller = new servicecontroller("webclient")) { servicecontroller.start(); servicecontroller.waitforstatus(servicecontrollerstatus.running); } effectively want execute command net start webclient , above code cleanest wa

java - Eclipse: "Unfortunately, XXX has stopped" error when testing on an Android phone -

please forgive me, since first time make android program. so i've followed tutorial on youtube make simple program take user inputted number, multiply 5 , display on label. it got no errors. when tried run on android phone, got error "unfortunately, xxx has stopped". i've checked , run hello world program eclipse initiated program with. thank kind attention. mainactivity.java package com.example.converter; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.*; // * wild character, import widgets import android.os.build; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancesta

android - RuntimeException: Unable to instantiate application -

when run application, everytime getting below exception in logcat: 04-14 09:29:53.965: w/dalvikvm(1020): threadid=1: thread exiting uncaught exception (group=0x409c01f8) 04-14 09:29:53.985: e/androidruntime(1020): fatal exception: main 04-14 09:29:53.985: e/androidruntime(1020): java.lang.runtimeexception: unable instantiate application android.app.application: java.lang.nullpointerexception 04-14 09:29:53.985: e/androidruntime(1020): @ android.app.loadedapk.makeapplication(loadedapk.java:482) 04-14 09:29:53.985: e/androidruntime(1020): @ android.app.activitythread.handlebindapplication(activitythread.java:3938) 04-14 09:29:53.985: e/androidruntime(1020): @ android.app.activitythread.access$1300(activitythread.java:123) 04-14 09:29:53.985: e/androidruntime(1020): @ android.app.activitythread$h.handlemessage(activitythread.java:1185) 04-14 09:29:53.985: e/androidruntime(1020): @ android.os.handler.dispatchmessage(handler.java:99)

tfs2013 - How do we connect to TFS from all Git repositories in a Team Project? -

Image
i'm running latest visual studio 2013 ultimate @ work update 1. have latest team foundation server 2013 well. several of excited new git repository integration, there appears pretty big limitation. want add multiple git repositories single team project , able access builds , work items visual studio 2013. works if git repository named same team project. this limitation visual studio online well. open source sourcelink project shows work items , builds in visual studio 2013 because i've named remote vso repository origin , team project , git repository both named sourcelink. visual studio 2013 update 2 ctp 2 looks has nice git updates, however, don't see this. there plans address this? want able access work items , builds every git repository in team project. @jamill clued me solution in comments above. git has different workflow used tfvc. must connect repository, not team project. had click refresh button for repositories show up, , double click on r

c - TCP client/server send/receive files -

i writing tcp server/client program , want send files server client. here code not work sending file. use recv() , send() send files. in advance. client side: char *location = "/home/kostas/downloads/download.txt"; file *download = fopen( location, "w+" ); if( download == null ) { printf( "error\n" ); fflush( stdout ); } int transfer = 0; memset( buffer, 0, 1024 ); while( ( transfer = recv( connfd, buffer, 1024 , 0 ) > 0 ) ) { int write = fwrite( buffer, sizeof( char ), transfer, download ); memset( buffer, 0, 1024 ); if( ( transfer == 0 ) || ( transfer != 1024 ) ) { break; } } memset( buffer, 0, 1024 ); if( read( connfd, buffer, sizeof( buffer ) ) < 0 ) { printf( "read error\n" ); fflush( stdout ); } server side : //i filename read/write file *file = fopen( filename, "r"); memset( buffer, 0, 1024 ); int = 0; while( ( = fread( buffer, sizeof( char ), 1024, file ) ) < 0 )

c - (Threads Problems) Full Termination -

i have have problem thread termination ([c] - linux). problem can not finish thread , deallocate resources. because if recall program, see old thread still running the server code more less this: int quit=0; void* sending(); main(){ ....... pthread_t thread_send; pthread_create(&thread_send, null, sending, null); //pthread_join(thread_send); here useful? thread don't finish- return 0; } void *sending(){ while(quit==0){ if(...){ quit=1; } } //pthread_exit(null); here useful ? return 0; } how can use pthred_exit() or pthred_kill(); or pthread_detach or pthread_join? terminate thread , deallocating memory used thread. thank you!

javascript - Trying to retrieve all users of a role -

i'm trying retrieve of users of given role display display users in role. i.e. users in role superadmin screen list of users in role baseuser. i tried var query = (new parse.query(parse.role)); query.equalto("name", "baseuser"); query.include("users") query.find({ success: function(role) { console.log(role) }}) this gives me 400 bad request. i tried var query = (new parse.query(parse.role)); query.equalto("name", "baseuser"); query.find({ success: function(role) { query = (new parse.query(parse.user)); query.equalto("role",role) query.find({success: function(users) { console.log(users) }}) }}) similarly 400 bad request. advice? updated var query = (new parse.query(parse.role)); query.equalto("name", "superadmin"); query.first({ success: function(role) { query = (new parse.query(parse.user)); query.equalto("role",role) query.find({success: function(use

jquery - Tumblr Issues with Navigation -

i can't seem figure out causing issue navigation bar. here's problem. navigation not become static (fixed top), nor drop down links work on main site. if take @ http://devildogusainc.org you'll notice how navigation bar functions. when visit http://blog.devildogusainc.org broken. drown down menu's not function, nor navigation bar affix top when reaches x pixels when page scrolled. any welcomed , if needed can clarify problems if confused. thank you! if found error on console "uncaught typeerror: cannot read property 'offsetwidth' of null in main.js:40" check javascripts includes.