Posts

Showing posts from April, 2012

lucene - Is Solr phrase slop order dependent or not? -

using default example docs , schema comes solr 4.7.0 (the 1 ipods etc.). a query phrase slop such as: http://localhost:8983/solr/collection1/select?wt=json&q=features:%22car%20white%22~4&fl=id,features&omitheader=true gives me 2 matching documents: { "response":{"numfound":2,"start":0,"docs":[ { "id":"f8v7067-apl-kit", "features":["car power adapter, white"]}, { "id":"iw-02", "features":["car power adapter ipod, white"]}] }} if change "car white" "white car" using same slop value of 4 first document in result. looking @ explain in browse, document returned in both queries says: (match) weight(features:"white car"~4 in 3) for other document, in first case says ..."car white"~4 in 4) changing order "white car" not match document. this seems

jekyll - How to access a data file in a plugin generator? -

i'd access data file have in _data folder , use in plugin generator, i'm not sure how. have: site.data.projects.each |project| ... end but when try compile tells me "undefined method 'projects' hash(...) nomethoderror. correct syntax? if post _data file looks can give better answer, try: site.data['projects'].each |project| ... end

gruntjs - What is the function of the quotes in grunt.init.config -

i see in gruntfile: grunt.initconfig({ 'connect': { testserver: { options: { why connect has quotes? tried removing , works anyway wonder why 'connect': { , not connect: { is there "good practise" convention, or other convention this? or these reserved words?

javascript - ExtJs - Change Textfield VType dynamically -

a rather straightforward question. no answer found anywhere. using extjs 4.2 i have 2 custom vtypes, , 1 textfield. want change textfield's vtype when user clicks radio button. i know text field has been created doing: textfield.vtype = 'othertype'; won't me. neither will: ext.apply(textfield,{vtype:'othertype'}); so obvious stuff out. i'm toying destroying , re-creating it, (if works) seems overkill. using ext.apply worked me, fiddle here: https://fiddle.sencha.com/#fiddle/4d4 hope helps..

cakephp change default action for controller (i.e. from “index”) -

i have controllers want default table , not index, present better in different format index pages use. how can change this? got it. others: the file /app/config/routes.php contains routing configuration, , default action can changed there router::connect( '/pages', array('controller' => 'pages', 'action' => 'display') );

File handling in C++ gives .exe stopped working error -

Image
i have basic file handling code of reading file named"student.dat" using visual studio. the output reads file , displays result in console visual studio pops dialog as code: #include<iostream> #include<fstream> #include<conio.h> #include<string> using namespace std; class student { int admno; // char name[20]; string name; public: void getdata() { cout<<"\n\nenter name of student "; //gets(name); cin>>name; getch(); cout<<"\nenter admission no. "; cin>>admno; // getch(); } void showdata() { cout<<"\nadmission no. : "<<admno; cout<<"\nstudent name : "; cout<<name

MVC, Twitter bootstrap modal dynamically loaded from partial via jquery -

i have mvc layout has standard bootstrap modal div etc ( http://getbootstrap.com/javascript/#modals ). on click of action link (where view uses bootstrap modal layout) have following jquery 1 $(".popupdialog").click(function (e) { e.preventdefault(); $('<div></div>').load(this.href, function () { $(this).find('#mymodal').modal(); }); }); it doesn't load modal @ all. if remove outer div standard twitter bootstrap modal , place in jquery, i.e. 2 $(".popupdialog").click(function (e) { e.preventdefault(); $('<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"></div>').load(this.href, function () { $(this).modal(); }); }); it works great don't want dynamically load 1st outer

c++ - Incompatible cv qualifiers in parent class method -

i'm tinkering c++ , gtkmm, trying create custom class calls upon .glade file build gtk rather basic interface. class derived gtk::window , when call get_widget method on class itself, error: types ‘const t_widget*’ , ‘myclass* const’ have incompatible cv-qualifiers class definition: class myclass: public gtk::window{ public: myclass(); protected: //... glib::refptr<gtk::builder> builder; //... } however trying upload data glade file class (on class constructor): //... builder = gtk::builder::create_from_file("../glade/myclass.glade"); builder->get_widget("window1",this); //... myclass* const not same const myclass* . in first 1 pointer constant, , in second 1 object is. declare : const myclass* but problem seems unrelated (my bad), gtk has special function derived class : gtk::builder::get_widget_derived , use instead.

Face Detection with Emgu CV in C# and WPF -

i doing face detection emgu cv in c# , wpf ,the problem program getting run,but nothing displayed in window- code is- mainwindow.xaml <window x:class="facerecognition.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="600" width="800" loaded="window_loaded"> <grid> <image name="image1" stretch="fill"></image> </grid> </window> mainwindow.xaml.cs using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using emgu.cv

makefile - In make, how do I run prequisites exactly once? -

let's pretend have 2 servers , b want have ability deploy separately , in makefile targets. let's there's preparation step want run once before deployment, whether it's 1 or both. how that? here's have far, it's not dry. clean: # cleanup stuff deploy: make clean ssh $(server) do-remote-deployment-stuff deploy-to-a: deploy server=myservera deploy-to-b: deploy server=myserverb deploy-all: deploy-to-a deploy-to-b see how it'd run 'clean' twice? instead of using recursion, put target want run once prerequisite: deploy-to-a: clean ... deploy-to-b: clean ... however, attempt set server= etc. won't work, , neither deploy-all rule. can't put make targets make recipes. can use pattern rules: servers = b a_server = myservera b_server = myserverb deploy-all: $(servers:%=deploy-to-%) deploy-to-%: clean ssh $($*_server) do-remote-deployment-stuff clean: # clean

php - All instances of Wordpress stops responding on same server? -

i have server several websites wordpress , mapped virtual-host folder lighttpd . have other websites, non-wp, mapped in same way. i'm experiencing random crashes of wordpress - ie. 3 wordpress websites stops responding, , have restart server fix problem. other websites unaffected. i'm @ loss how debug problem. i've looked through error logs, nothing stands out. php and/or mysql problem? server strong box, 8-core, 32gb ram. error logs dumps: lighttpd : /var/log/lighttpd/error.log : there nothing above php notice level. mysql : /var/log/mysql/error.log (quite few of these, whilst site working).: 140320 17:45:46 [error] /usr/sbin/mysqld: table './2famoustv/wp_comments' marked crashed , last (automatic?) repair failed server : /var/log/auth.log (there's bunch of these, not enough ddos): mar 20 20:13:42 ubuntu-1204-precise-64-minimal sshd[3535]: reverse mapping checking getaddrinfo no-reverse-dns.metronet-uk.com [109.111.197.158] failed

java - Attempting to redirect to 401-error.html: "401-error.xhtml Not Found in ExternalContext as a Resource" -

i attempting redirect unauthenticated users 401-error.html (static page) when org.jboss.seam.security.notloggedinexception thrown. with jsf 1.2, able create exception element in pages.xml /401-error.html view-id. however jsf 2.1 not have same behavior. a loop of notloggedinexceptions , facesfilenotfoundexception ("401-error.xhtml not found in externalcontext resource") exceptions occur. <security-constraint> <web-resource-collection> <web-resource-name>unauthenticated pages</web-resource-name> <url-pattern>/error/*</url-pattern> </web-resource-collection> </security-constraint> <error-page> <error-code>401</error-code> <location>/error/401-error.html</location> </error-page>

c# - Check if navigational property is loaded -

is possible check if navigational property has been loaded? when try access objectdisposedexception the objectcontext instance has been disposed , can no longer used operations require connection. public class factory { // .. public virtual icollection<machine> machines { get; set; } } // ... ilist<factory> set; using (mycontext context = new mycontext()) { set = context.factories.tolist(); } ... later on // possible check if .machines loaded here? if (set.first().machines == loaded) // let's open new context , load } the solution have found when searching use include() , include machines in first run, avoid loading until neccessary. tried box in new using(...){} still exception. i'd avoid attach since extremely slow when building large object graphs. i guess use bool ismachinesloaded or something, figured there ought way check without that.. i solved method: protected bool isloaded<tentity>(tentity entity, f

javascript - Jquery add and remove class to a div placed inside a li -

i wanna add , remove class div placed inside li, , when click li ineed remove rightshapeactive class activated div <ul id="servicesleft"> <li class="left1"> <span>lorem ipsum</span> <div id="rightshape" class="t"></div> </li> <li class="left1"> <span>lorem ipsum</span> <div id="rightshape" class="t"></div> </li> <li class="left1"> <span>lorem ipsum</span> <div id="rightshape" class="t"></div> </li> </ul> jquery(document).ready(function() { $('#servicesleft').delegate('li', 'click', function() { $(this).find('#rightshape').addclass('rightshapeactive').siblings().removeclass('rightshapeact

ios - Why is UIKeyboardWillShowNotification called every time another TextField is selected? -

Image
i have project contains uiscrollview , many uitextfield inside it. for first time select uitextfield , uikeyboardwillshownotification called, fine. whenever select new uitextfield (the keyboard still there), uikeyboardwillshownotification called again !!!, weird. i set symbolic breakpoint [uiresponder resignfirstresponder] , see hit before , after uikeyboardwillshownotification called !!! the other thing uikeyboardwillhidenotification called when hit "done" button on keyboard i'm sure not call resignfirstresponder , becomefirstresponder , endediting anywhere. (i mean not call wrongly) what can cause problem ? here stacktrace the problem set inputaccessoryview uitextfield , , cause uikeyboardwillshownotification being called again when new uitextfield selected this article working keyboard on ios explains well additional changes take place when connect external keyboard ipad. in particular case, notification behavior depends

How to remove drawable image from edittext through code in android -

i have placed image in edit text following code <edittext android:id="@+id/searchfilter" android:layout_height="wrap_content" android:layout_width="fill_parent" android:hint="enter search keyword" android:drawableright="@drawable/ic_launcher"/> i need hide image through java code thanks in advance try folloing code edittext.setcompounddrawableswithintrinsicbounds(0,0,0,0);

grails - Why values of list is changing while sending to a service -

i new grails , developing web application. i have list of long values getting ids of domain class objects. initially list [1,2,3]. need use list of values in service class saving associations. but same list getting in service class [49,50,51] why difference of 48 occurred? , how can list same sent. controller class: def createquestion(createquestioncommand createquestioncmd) { if( createquestioncmd.haserrors() ) { render(view:"create_question", model:[createquestioncmd:createquestioncmd , tags:tag.list()]) } else { question question = new question() question.title=createquestioncmd.title question.description=createquestioncmd.description list tags= createquestioncmd.tags question = questionservice.create(question,tags) render(view: "question_submitted") } } service class: def create(question question, list<long> tagid) { list<tag> taglist=gettagsbyid(tagid) question.save( failonerror:

how to get all roots of a child in xml using java -

i have xml file below. <root> <subchilda> <childa> <dataa>data</dataa> <datab>data</datab> </childa> </subchilda> <subchildb> <childb> <dataa>data</dataa> <datab>data</datab> </childb> </subchildb> </root> i can node values eg(dataa or datab 's value). need roots of data nodes. eg dataa in childa->subchilda->root. using java documentbuilder reading. edit using below code can recursively read nth child cant roots. public static void readnode( node node) { string id; nodelist sublist = node.getchildnodes(); (int j = 0; null != sublist && j < sublist.getlength(); j++) { node tmpnode = sublist.item(j); if (tmpnode.haschildnodes()) { element element = (element) tmpnode; id = element.getattribute("id");

input - HTML5: Why does my "oninvalid" attribute let the pattern fail? -

this little html5 password field works without oninvalid attribute (the pattern say: minimum 6 characters): <form> <input type="password" name="user_password_new" pattern=".{6,}" required /> <input type="submit" name="register" value="register" /> </form> see jsfiddle here . but when add oninvalid attribute gives out custom error message when user's input not fit pattern, entire field never becomes valid, see code here: <form> <input type="password" name="user_password_new" pattern=".{6,}" oninvalid="setcustomvalidity('minimum length 6 characters')" required /> <input type="submit" name="register" value="register" /> </form> see jsfiddle here . can spot mistake ? if set value setcustomvalidity() field invalid. setting non-zero length string ca

html - How can I polyfill a CSS background-size transition in IE 10 - 11? -

i'm trying introduce animation on hover few elements of site. i noticed looking bit glitchy in ie 10 , ie 11 , through bit of research found out browsers don't support css transition property background-size ! ok, fine, ms have removed conditional comments browsers, so: ideas how can give ie 10 , ie 11 simplified transition (keeping background-image same size) , yet still keep full animation can? css .home .hero a.animate { background-image: url("/images/home/question.gif"), url("/images/home/person.gif"), url("/images/home/bulb.gif"), url("/images/home/person-m.gif"), url("/images/home/person-f.gif"); background-position: 51% 14.5em, 50% 13em, 51% 14.5em, 90% 7em, 10% 7.5em; background-size: 10% auto,

php - Create multidimensional array for duplicate ID key value -

i trying read in array values csv , create sub-arrays belong primary key field id. e.g currently, have following array structure & content... id;number;product 1;k12;product1 2;157/03/2014;product1 2;;product2 2;product1 3;156/03/2014;product2 3;156/03/2014;product3 i have php function: function csv_to_array($file, $delimiter=';') { if(!file_exists($file) || !is_readable($file)) return false; $header = null; $data = array(); if (($handle = fopen($file, 'r')) !== false) { while (($row = fgetcsv($handle, 1000, $delimiter)) !== false) { if(!$header) $header = $row; else $data[] = array_combine($header, $row); } fclose($handle); } return $data; } such result achieve [1] => array ( [lp] => 1 [number] => k12 [product] => product1 ) [2] => array ( array (

vba - Excel Function - Dynamic file link -

i'm trying create excel function (udf) there gets data closed excel file, based on file name in cell. i have working in macro, can't function work. the macro - there working looks this: sub testgetdata() dim wbpath string dim wbname string dim wsname string dim cellref string dim ret string ' test data wbpath = "c:\users\tue\desktop\mgh\" wbname = "rentabilitet 30.xls" wsname = "rentabilitet" cellref = "f15" ret = "'" & wbpath & "[" & wbname & "]" & wsname & "'!" & range(cellref).address(true, true, -4150) msgbox executeexcel4macro(ret) end sub i have created function based on macro, not working. this: function samplefunc(wbpath string, wbname string, wsname string, cellref string) dim ret string ret = "'" & wbpath & "[" & wbname & "]" &am

c++ - Undetected error with new operator -

i messing around trying understand pointers , operator "new" and ended getting more confused on these 2 codes should result to, other not, wanted understand happened here. in advance. #include <iostream> using namespace std; int main() { int * p = new int(50); p[1] = 33; cout << *p << endl; } output: 50 and when tried #include <iostream> using namespace std; int main() { int * p = new int[50]; p[1] = 33; cout << *p << endl; } output: -842150451 i wondering meaning of each result. in first case int * p = new int(50); // allocates 1 int on heap, initialized value of 50 p[ 1] = 33; // p gives address of integer, // p[1] moves p pointer forward , accessing // pointed object results in undefined behavior, // means @ moment can happen // exception, crash, home war, nothing, everything,

java - How to keep a total with an array? -

question: write program creates 2 parallel arrays. first string array contains names of items in grocery list. second array of prices each item. must satisfy following conditions: print numbered list of items in first array prices. ask user select item , specify quantity. keep track of running total shopping. when enter 0 exit, print total amount due. i'm confused arrays, , having trouble calculating total. appreciated. here's have far... public static void main(string[] args) { scanner in = new scanner(system.in); system.out.println("items on list"); string[] list = {"eggs", "milk", "chicken", "cereal"}; double[] prices = {2.00, 2.50, 4.50, 1.00}; (int = 0; < 4; i++) { system.out.println((i + 1) + ". " + list[i] + " " + prices[i]); } system.out.println("what item want"); int item1 = in.nextint(); system.out.println("what quanti

java - Inject the same Instance of an Interface across my Application? -

in gwt/gwtp app have interface instantiate in entrypoint class: @override public void onmoduleload() { final a = gwt.create(a.class); } now want inject interface instance in presenters this: private final a; @inject public apppresenter(final eventbus eventbus, final myview view, final myproxy proxy, a) { super(eventbus, view, proxy); this.a = a; } my idea bind interface in gin module like: bind(a.class).aseagersingleton(); this guarantee 1 instance. problem interface has no constructor fail. ho instantiate of interface across application?

javascript - How can I get the length of a multidimensional array -

i have array follows: $('#mmtable').data('armsitems').push([[],[],[]]); $('#mmtable').data('armsitems')[0][0]['productnr'] = 1; $('#mmtable').data('armsitems')[0][0]['title'] = 1; $('#mmtable').data('armsitems')[0][0]['description'] = 1; $('#mmtable').data('armsitems').push([[],[],[]]); //------------------------------------------------- $('#mmtable').data('armsitems')[1][0]['productnr'] = 1; $('#mmtable').data('armsitems')[1][0]['title'] = 1; $('#mmtable').data('armsitems')[1][0]['description'] = 1; $('#mmtable').data('armsitems').push([[],[],[]]); //------------------------------------------------- $('#mmtable').data('armsitems')[2][0]['productnr'] = 1; $('#mmtable').data('armsitems')[2][0]['title'] = 1; $('#mmtable').data('arms

image processing - Simulate cataract vision in OpenCV -

Image
i'm working on project design low vision aid. image processing operation can simulate cataract vision normal eye using opencv? it useful if described symptoms of cataract , happens retinal images since not people here experts in computer vision , eye deceases @ same time. if retinal image gets out of focus , gets yellow tint can used opencv blur() function , boost rgb values yellow bit. if there different degree of blur across visual field recommend using integral images, see this post guess there @ least 3 operations do: add noise, blur, whiten: rect rect2(0, 0, w/2, h); mat src = i4(rect2).clone(); mat mnoise(h, w/2, cv_8uc3); randn(mnoise, 100, 50); src = src*0.5+mnoise*0.5; // add noise mat mblur; blur(src, mblur, size(12, 12)); // blur rect rect3(w, 0, w/2, h); mat mblurw = mblur*0.8+ scalar(255, 255, 255)*0.2; //whiten

html - Click button copy to clipboard using jQuery -

how copy text inside div clipboard? have div , need add link add text clipboard. there solution this? <p class="content">lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s</p> <a class="copy-text">copy text</a> after click copy text, press ctrl + v , must pasted. edit of 2016 as of 2016, can copy text clipboard in browsers because browsers have ability programmatically copy selection of text clipboard using document.execcommand("copy") works off selection. as other actions in browser (like opening new window), copy clipboard can done via specific user action (like mouse click). example, cannot done via timer. here's code example: document.getelementbyid("copybutton").addeventlistener("click", function() { copytoclipboard(document.getelementbyid("copytarget")); }); function copyt

c - Ensuring const safety -

is there way ensure const safety when dealing constant data? i mean, there way prevent kind of code? const int a; int* p = (int*)&a; *p = 0; there absolutely no way prevent kind of code showing. cast re-interprets pointer, letting caller whatever pleases. result, program gets undefined behavior, , may crash. unfortunately, not always crash, , on platforms never crash.

html - Regex to capture and store url -

i'm new perl , i'm trying harvest links , images website. i'm reading regular expressions , i've far managed lines of html contain links or images (at least believe so) with /<img src|<a href/i #i'm comparing every line of html but how capture , store actual url? turn this: <img src="http://i1.nyt.com/images/2014/03/23/us/23marriage2/23marriage2-largehorizontal375.jpg" into this: http://i1.nyt.com/images/2014/03/23/us/23marriage2/23marriage2-largehorizontal375.jpg in general, recommend using e.g. html::treebuilder rather regular expressions parse html. saying that, can of course try , use regexes fetch you're after - dependent on source material. generically capture img src or href bit (this assumes things such double quotes being used, example, , more brittle parsing solution): /<img[^>]*?src="([^"]*)"|<a[^>]*?href="([^"]*)"/i then if matches, image url in $1 , or li

gzip - Input output redirection UNIX -

say have file called package.tar.gz do: cat package.tar.gz | gzip -d | tar tvf - , shows me list of files in tar archive. however if do: gzip -d package.tar.gz | tar tvf - says tar: not tar archive i don't understand why is. if result of gzip -d in first case returns output can interpreted tar archive, why won't work in second case? i have seen autotools - tar not tar archive i'm not convinced it's issue tar in case since first command works... it looks me you're not passing -d option in second case. manpage, compressed files can restored original form using gzip -d or gunzip or zcat. what's appropriate style zcat sounds - gunzip + cat.

c++ - Xcode: malloc size doesn't seem to matter -

this question has answer here: what happens if use malloc wrong size? 4 answers in codes below, can change parameter of malloc whatever values (at least ones have tried), , looks okay. for example, can change "3 * sizeof(float)" "3 * sizeof(char)", or zero. , can still "correct" results. heap size doesn't seem matter @ all. this confuses me. how can happen? the codes written , run in xcode 5. float *favorites = malloc(3 * sizeof(float)); favorites[0] = 3.14158; favorites[1] = 2.71828; favorites[2] = 1.41421; (int = 0; < 3; i++) { printf("%.4f favorite %d\n", favorites[i], i); } free(favorites); favorites = null; this because doing program invokes undefined behavior . once ub invoked, bets off. may either expected or unexpected result. now try without allocating memory favoritee float *favo

how do i define delegate in php -

how define function within class , method empty, method change calling class (as delegate in c#) following error codes are: class myclass{ public $num1=0; public function func($a,$b); } $c=new myclass(); $c->func=function($a,$b){ return $a+$b; } $c->func(4,8);// error you can this: class myclass { public $num1=0; public function func($a,$b,$fn) { return $fn($a,$b); // return anonymous function } } $c = new myclass(); $c->func(2,5,function($a,$b) { // declaring anonymous function $a , $b parameters echo $a + $b; // result 7 }); demo

excel - XY Scatter Chart with Smooth Line doesn't consider Time in DateTime X-Axis -

Image
here sample data and here graph generated xy scatter chart smooth line in excel 2010. the data type of column time in table , x-axis changed time. however, date considered , time axis ignored in graph , considered '12:00'. there particular setting enable time considered? in spirit might someone, here answer.. modified setting in x-axis options. default, major unit 'auto', think value 0.5 indicates half day, why think 12:00 & 12:00 pm displayed. changed '0.2'. give intermediate values in graph. value can changed required.

sql - Force Index Not Working on Delete -

i trying use forced index on delete statement in sybase, query plan not seems pick index, showing table scan. what right way force index on delete? snippet of query using: set forceplan on delete #table1 #table2 tmp, #table1 t (index idx1) tmp.col1 = t.col1 , tmp.col2 = t.col2 the index idx1 created on col1 , col2 on #table1 larger table. is there wrong in query? using sybase ase 12.5

http - Python and SSL -- EOF occurred in violation of protocol -

i'm trying login web-site via python. have following code: import sys sys.path.append('clientcookie-1.3.0') import clientcookie sys.path.append('clientform-0.2.10') import clientform cookiejar = clientcookie.cookiejar() opener = clientcookie.build_opener(clientcookie.httpcookieprocessor(cookiejar)) opener.addheaders = [("user-agent","mozilla/5.0 (compatible)")] clientcookie.install_opener(opener) fp = clientcookie.urlopen("login_page_url") forms = clientform.parseresponse(fp) fp.close() # print forms on page form in forms: print("***************************") print(form) form = forms[2] form["username"] = "some_username" form["password"] = "some_password" fp = clientcookie.urlopen(form.click()) fp.close() fp = clientcookie.urlopen("some_url_for_authorized_users_only") html = fp.read() fp.close(); print(html.decode('utf-8')) output urlerror: <ur

PHP - replace all "\n" Occurrences in a string -

i getting string in php output lots of \n characters convert <p> new line characters in html outpot. i have tried following: strtr($mystring, "\n", "<p>"); string_replace ("\n", "<p>", $mystring); both of these doesn't seems work. ideas what's wrong in syntax? try this: php: <?php $mystring = 'hello\nworld'; echo '<p>'. implode('</p><p>', explode('\n', $mystring)) .'</p>'; ?> output: <p>hello</p><p>world</p>

security - SQL statement not correct -

if want account albert retrieve or modify relation except dependent , can grant of these privileges other users, how that? i tried grant function so: grant select employee albert grant select department albert grant select dept_locations albert grant select project albert grant select works_on albert but how let albert modify? schema: employee (fname, minit, lname, ssn, bdate, address, sex, salary, super_ssn, dno) department (dname, dnumber, mgr_ssn, mgr_start_date) dept_locations(dnumber, dlocation) project(pname, pnumber, plocation, dnum) works_on(essn, pno, hours) dependent(essn, dependent_name, sex, bdate, relationship) so far grant select rights. want grant update, too. , maybe insert , delete? grant select, update, insert, delete on employee albert ; ...

Sendmail catchall for sending messages -

i trying change development environment emails sent machine through sendmail redirected single address. i have seen several examples using feature(`virtusertable') @example.com catch-all@delivery.host.name but problem want catch everything, not @example.com, , redirect single address on external domain (gmail). have sendmail setup on centos 6.5. so, example, want catch emails sent user@examplea.com user@exampleb.com user@examplec.com and redirect them dev@myactualserver.com how set sendmail that? you may use smart host catch outgoing messages (messages non local mailboxes). sendmail.mc define(`smart_host',`local:catch-all') /etc/mail/aliases catch-all: johndoe1 if want send messages external account using smtp use: define(`smart_host',`esmtp:johndoe1@example.net') use luser_relay catch messages non existing local mailboxes in local email domains. use mail_hub catch messages local email addresses in local ema

java - Selecting radio buttons to make text appear -

using radio buttons displayed on panel, possible select radio button , display text on panel explaining user has selected? so here list of radio buttons public void radiobuttons() { btldap = new jradiobutton ("ldap"); btldap.setbounds(60,85,100,20); panelholder.add(btldap); btkerbegos = new jradiobutton ("kerbegos"); btkerbegos.setbounds(60,115,100,20); panelholder.add(btkerbegos); btspnego =new jradiobutton("spnego"); btspnego.setbounds(60,145,100,20); panelholder.add(btspnego); btsaml2 = new jradiobutton("saml2"); btsaml2.setbounds(60,175,100,20); panelholder.add(btsaml2); } user selects btldap btldap.setselected(true); now how make text appear on panel not message box if want display text when radio button selected use actionlistener . final jtextarea textarea = new jtextarea(); add(textarea); jradiobutton radiobutton = new jradiobutton(); add(radiobutton); radiob

java - apktool not recognized as external or internal command -

i trying run android apktool on windows 7 machine, getting above error. download apktool-install-windows-r05-ibot , apktool1.5.2 package , apktool.jar files has been present inside folder apktool.jar. have checked both jdk , jre has been installed , enviroment variables set both of them. tried $ ./apktool.jar if framework-res.apk still getting same error. info have added below path env variables, c:\program files\android\sdk\platform-tools tools - c:\program files\android\sdk\tools,c:\program files\android\sdk\build-tools\18.1.0. please let me know how fixed error or anthing doing wrong. folder name :apktoolpath. the apktoolpath folder located @ c:/ , contains aapt.exe,apktool.bat , apktool.jar in cmd run command c:>"c:\program files\java\jre7\bin\java" -jar apktoolpath\apktool.jar after cd apktoolpath cd:\apktoolpath>apktool d name_of_apk.apk

javascript - Centering spin.js spinner inside a (target) div -

i have following simple markup , style (see jsfiddle ): html: <div id="wrapper"><div id="content"></div></div> css: #content { background-color:lightyellow; height:200px; color:green; } #wrapper{ border:1px solid black; color:red; } i'm setting spinner target #content div using both vanilla js , jquery options , encounter couple of problems. first, in both cases, spinner not appear constructed in middle of targeted element's parent, contrary documentation says: positioning since version 2.0.0 spinner absolutely positioned @ 50% of offset parent. may specify top , left option position spinner manually. second, when using vanilla js, spinner not use color set on target. when starting using jquery, (i.e. #content uses green). am understanding documentation wrong? if so, how can center spinner inside specific element? if not, why isn't snippet above centering spinner inside target?

javascript - JQuery JScroll for Table -

currently working jquery plugin: jscroll implement lazy load table. but, don't know why, after use following code: $('#table-modify2').jscroll(); the lazy load still not working. not working here means display of data every time load page. for information, table's data come database , use jquery ajax data. here code: $(document).ready(function(){ $('#table-modify2').tablesorter(); $('#table-modify2').jscroll(); bericht(); }); function bericht() { $.post("func/bericht.php", { }, function(data) { con = displayresult(data); $('#table-modify2').find('tbody').html(con); $('#table-modify2').trigger('update'); //$("#table-checkout").html(con); }); } function displayresult(data) { con = ""; row = data.split("_"); for(i=0,j=row.length-1;i<j;i++) { col = row[i].split("#");

mysql - Group by the date part of a timestamp field -

i have users table. generate report of user joined day. problem is, datejoined field timestamp field, as query following as: select count(userid) tot users group datejoined does not work, how group by date part , not time of datejoined field? your code: select count(userid) tot users group datejoined you should chage as: select date(datejoined), count(userid) tot users group date(datejoined) the sqlfiddle

javascript - Mixed inputs (text and file) to send through $.ajax using data -

i tried send data 2 inputs php code, 1 of them text , other type file. second field multiple selection of files. well, here code of html section: <input type="text" id="padron-documento" class="form-control input-lg" name="padron-documento" placeholder="padrón" /><br /> <div class="alert alert-info"> <input type="file" id="archivos" name="archivos[]" multiple onchange="seleccionado()" /> </div> <div id="cargados"> <!-- here display loaded files. --> </div> ok, code of javascript section: function seleccionado(){ var archivos = document.getelementbyid("archivos");//we value of input id archivos var archivo = archivos.files; //here value of input (archivos) array //teh formdata object allow create form passing key/value send it, kind of object have multipar

javascript - Update all user objects in parse -

i have added column in user class holds users score in game, ios app. have javascript runs seperate app changes users scores based on other variables. can access user class via query , variables if try user.save(); if not work. there different save method need use save new user details. cannot done based off current user javascript changes every user in user class. thanks, you don't have access user object without being signed in, need other user objects own, should separate out class. you can circumvent using master key, though. check post: https://parse.com/questions/bypass-acl-on-cloud-code

php - Error in Inserting csv records to mysql table in wordpress -

i'm having problem on how can insert csv file selected table,i want insert csv records other columns blank. want insert records having duplicates here code: // if fields input; , file correct .csv format; continue if(!empty($_post['table_select']) && !empty($_post['csv_file']) && ($ext === 'csv')) { // grab columns $db_cols = $wpdb->get_col( "desc " . $_post['table_select'], 0 ); // array of db column names // number of columns hidden input field (re-auto-populated via jquery) $numcolumns = $_post['num_cols']; // open .csv file , it's contents if(( $fh = @fopen($_post['csv_file'], 'r')) !== false) { // set variables $values = array(); $too_many = ''; // used alert users if columns not match while(( $row = fgetcsv($fh))

ruby - The provided regular expression is using multiline anchors (^ or $)? -

this question has answer here: regular expressions validations in ror 4 5 answers i'm getting error: the provided regular expression using multiline anchors (^ or $). did mean use \a , \z, or forgot add :multiline => true option? when loading 1 page in rails application. it highlights model it's using saying error is: class associate < locations::associate this model: class associate < locations::associate # returns array of permissions valid @ associate level. # def self.associate_permissions associate_permissions end # generates array of permission values can used in new or edit # template. # def permission_list my_permissions = (permissions || '').split(/,/) list = [] associate.associate_permissions.each |value| list << {:label => value[0], :value => value[1], :checked => my_permission

java - Running servlet at correct location in eclipse? -

i'm using tomcat 7.0 , eclipse kepler. when deploy servlets onto server running @ /<project name>/<servlet name> when want them run @ /<servlet name> . how can change this? you need change context root name of web application: right click on project. click on properties. choose "web project settings". change context root property. clean server , restart it.

Java socket connection time out in Android Implementation -

i'm writing simple android code file transfer on java sockets. first of all, hard coded file path in server implementation check if files received @ client side or not. worked fine. created simple file browser separate java class user browse through files , select them well. purpose, created simple intent launch file browser class (the intent fired after socket initialization). problem starts here. before file browser thing, app working fine (with pre-defined set of files). now, i'm getting socket closed exception every time run app. doesn't reach intent firing stage. please me. i'm self taught , still learning android programming. here code snippets: server: public class mainactivity extends activity { arraylist<file> filearray = new arraylist<file>(); arraylist<string> filepathnamearray = new arraylist<string>(); socket socket = null; serversocket serversocket = null; int request_code = 1; @override protected void oncreate(bundle saved

python - Pygame screen width -

i made program displays word , plays sound effect everytime click space bar. problem when word blited screen either blits halfway on screen or halfway off screen. tried using statement says if x > 800 know there has better way , don't know appreciated! import pygame, random, sys pygame.locals import * pygame.init() screen_size = ((800,600)) pygame.mixer.music.load("derp.wav") screen = pygame.display.set_mode(screen_size) while true: newsat = random.randint(1,100) r = random.randint(1,255) g = random.randint(1,255) b = random.randint(1,255) newsize = random.randint(1,50) myfont = pygame.font.sysfont("ubuntu", newsize) derp = myfont.render("derp",newsat,(r,g,b)) newx = random.randint(1,800) newy = random.randint(1,600) newspot = random.randint(1,800) event in pygame.event.get(): if event.type == quit: sys.exit() if event.type == keydown: if event.key == k_space:

javascript - IE 8 debugger doesn't stop on TypeError -

i'm trying angular.js/jquery app running in ie8. have things working, spews lot of console errors: typeerror: 'undefined' null or not object these errors in developer tools don't have source location (file & line) associated them, , debugger doesn't break on errors when these being thrown, if "break on error" enabled. other disabling portions of code search cause, there way figure out coming from? i'm getting dozens of them in every angular digest cycle, it's not straightforward figuring out page actions cause them. it's not obvious what, if anything, they're breaking on page, haven't yet had ability test whole thing, it's hard conclude they're benign; if are, i'd prefer rid of them; they're noisy , i'm concerned may visible user under ie error-handling configurations. though i've never used it, i've heard debugbar improvement on standard ie8 developer tools. also, jjzabkar mention

html - div not firing onclick event in javascript -

my div element : <div id="div"></div> below javascript.: function makediv() { var divmy = document.getelementbyid("div"); var row =''; var color='#ccc'; for(var i=0;i<2;i++) { divmy.innerhtml += " <div class='dynamic' id='inner"+i+"' onclick=searchfilterations(i)>"+i+"</div> "; color='black'; } } function searchfilterations(e){ alert(e); } problem is: searchfilterations() function not firing on click.what error? here fiddle : http://jsfiddle.net/cjt4s/4/ please call makediv function onload event window.onload = makediv; function makediv() { var divmy = document.getelementbyid("div"); var row =''; var color='#ccc'; for(var i=0;i<2;i++) { // divmy.innerhtml += " <div style='width: 100px;height: 30px

javascript - extjs 4.2 treepanel bufferedRenderer scroll to specific node -

i use extjs 4.2 , bufferedrenderer large tree. when need scroll specific node have use grid.view.bufferedrenderer.scrollto(rowindex) in http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/grid/buffer-grid.html but when not have row index node object how can scroll it? if tree nodes expanded - simple: have count previous nodes, if nodes collapsed? you can try this grid.getview().scrollrowintoview(rowindex)

javascript - how can check two variable in the condition? -

$('.supplier').on('click', function(){ var supplier = $('.supplier').is(":checked"); var customer = $('.customer').is(":checked"); // if both unchecked, hide table if( supplier && customer == false){ alert('hide table'); } // if supplier checked, show supplier, else hide supplier }); i want hide table if don't check .suppler , .customer thanks much. one thing hasn't been addressed in previous answers (great are) you're calling function when click .supplier . i'd imagine want call function when click on either .supplier or .customer . if so, you'll need add .customer selector: $('.supplier, .customer').on('click', function(){ var supplier = $('.supplier').is(":checked"); var customer = $('.customer').is(":checked"); // if both unchecked, hide table

javascript - Re-resolving a jquery.Deferred (or other promise) -

afaik deferreds can resolved once, have scenario i'm storing lot of deferreds in table. it's possible these deferreds' values need updated but other modules want store local reference original deferred, can't overwrite entire deferred new object. is there way can overwrite deferred's value or if (as suspect) it's inadvisable (even impossible) there tried , tested approaches problem? here's skeleton code illustrate problem // articles module var articles = {}, // anid = 'uuid'; articles[anid] = $.get('/articles/' + anid); //another module var localcopyofarticle, getarticle = function (anid) { localcopyofarticle = articles[anid] } getarticle('uuid'); // articles articles[anid] = $.get('/articles/refresh/' + anid); //another module again console.log(localcopyofarticle) // oh no - it's out of date afaik deferreds can resolved once correct. promise transitioned pending state fulfill

Correct path for images in javascript using Cakephp -

i new in cakephp, , have script, converted cakephp. have there rotate background use 4 images this: $.backstretch([ "img/bg/1.jpg", "img/bg/2.jpg", "img/bg/3.jpg", "img/bg/4.jpg" ], { fade: 1000, duration: 8000 }); when open script name_domain.com use controller users , action login, see images , work perfect, when try use register (controller=>users, action=>signup) images not load. put ../img.... working here , not in index. how can link correctly images. try "/img" not working. any appreciated. declare javascript variable in default.ctp var image_host = "<?php echo $this->webroot.'/img/'; ?>"; and can use in javascript file too <script> $.backstretch([ image_host + "bg/1.jpg", image_host + "bg/2.jpg", image_host + "bg/3.jpg", image_host + "bg/4.jpg" ], { fade: 1000, duration:

Unable to send text from html file to c file -

i'm trying write basic html file , cgi script. html file have 1 text box , button. button send contents of text box cgi file (without content of text box showing in url) print out contents of text box. instead of happening, cgi file prints out '-|' regardless of put in text box. here .html file: <html> <head> <title>template webpage</title> </head> <body bgcolor="white" text="black"> <form action="http://cgi.cs.mcgill.ca/~eross12/cgi-bin/results.cgi" method="gets"> <div><label>input: <input name="data" size="5"></label></div> <div><input type="submit" value="send!"></div> </form> </body> </html> and here c file supposed receiving text html file: #include <stdio.h> #include <stdlib.h> int main(void) { char *data; char *input; printf("%s%c