Posts

Showing posts from April, 2011

How do I get my menu to drop down? CSS & HTML -

i have tried making drop down menu. have made simple ones, cannot seem 1 work now, after adding more complex css. surely missing line of code somewhere, not sure where. know how subitems1,2,3,and 4 drop down item3 in menu? menu code <body> <div id = "horizontalmenu"> <ul class = "fancynav"> <li><a href = "item1.php" class = "homeicon">item1</a></li> <li><a href = "item2.php">item2</a></li> <li><a href= "#">item3</a> <ul> <li><a href = "sub1.php"> subitem1</a></li><br> <li><a href = "sub2.php"> subitem2</a></li><br> <li><a href = "sub3.php"> subitem3</a></li><br> <li><a href = "sub4.php"> subitem4</a></li> </ul> </li> ...

validation - Validating entire form with "required" in parsley without adding "required" to individual fields -

is there way validate entire form in parsley? in, want make sure fields validated "required" without adding keyword each of fields. following: <form action="file.jsp" method="post" data-parsley-validate required>

Perl's conditional operator in string context -

this question has answer here: why aren't newlines being printed in perl code? 3 answers let's take following minimalistic script: #!/usr/bin/perl # # conditional_operator.pl # use strict; print ( 1 ? "true" : "false" )." statement\n"; exit; i expect output "true statement". when execute snippet, see ... deviolog@home:~/test$ perl conditional_operator.pl true the " statement\n" concatenation seems ignored. my perl version v5.14.2. read perlop manual conditional operator , think, string concatenation should possible. can explain behaviour? always include use warnings; @ top of every script. to desired behavior, add parenthesis print called entire argument instead of first part: print(( 1 ? "true" : "false" )." statement\n"); if you'd had warni...

c# - Adding information to an already existing xml folder from a windows form -

i trying store information writen form following code keeps happening override 1 there no add it. have following code xml serilaztion. xmlserializer xmlserializer = new xmlserializer((iclass.gettype())); writer = new streamwriter(filename); xmlserializer.serialize(writer, iclass); creditcard cc = new creditcard(cardnumber, expirydate, creditcardtype); user u = new user(name, surname, gender, posistion, wage, amount, banktype, cc, username, password); xmlsave x = new xmlsave(u, "customers.xml"); i have try keep same format because school project.

java - I get access denied when I try to implement TwitterStream filter or sample function -

i access denied when try implement twitterstream filter or sample function. java code follows: package tweettmap; import twitter4j.*; import twitter4j.conf.configurationbuilder; public class stream { public void getstreams() throws twitterexception{ configurationbuilder cb; cb = new configurationbuilder(); cb.setoauthconsumerkey("my key"); cb.setoauthconsumersecret("my consumer secret key"); cb.setoauthaccesstoken("my acess token"); cb.setoauthaccesstokensecret("my token key"); twitterstream twitterstream = new twitterstreamfactory(cb.build()).getinstance(); statuslistener listener = new statuslistener() { @override public void onstatus(status status) { system.out.println("@" + status.getuser().getscreenname() + " - " + status.gettext()); } @override public void ondeletionnotice(st...

memory - How to set the OpenCL's local work space size? -

i'm doing image processing using opencl. for example, used 100*200 size image. in .cl code, half image pixel value by: { int width=get_group_id(0); int height=get_group_id(1); // col(width) int x= get_global_id(0); // row(height) int y= get_global_id(1); (unsigned char) data_output[x*width+y]= (unsigned char)data_input[x*width+y]/2; } after kernel's parameter setting run kernel by: clenqueuendrangekernel( queue,kernel_dip,2,null,global_work_size,local_work_size, 0,null,null); the global_work_size used image size: size_t global_work_size[2] = {100,200}; i found .cl code doesn't include code "get_local_id(0);" the local_work_size did have lots influence on performance. both "size_t local_work_size[2]= {1,1};"(small local work size) , "size_t local_work_size[2]= {50,50};" (big work size) slow. some suitable size below faster: size_t local_work_size[2]= {10,10}; so here question: why code with...

python - Why is cffi so much quicker than numpy? -

i have been playing around writing cffi modules in python, , speed making me wonder if i'm using standard python correctly. it's making me want switch c completely! truthfully there great python libraries never reimplement myself in c more hypothetical really. this example shows sum function in python being used numpy array, , how slow in comparison c function. there quicker pythonic way of computing sum of numpy array? def cast_matrix(matrix, ffi): ap = ffi.new("double* [%d]" % (matrix.shape[0])) ptr = ffi.cast("double *", matrix.ctypes.data) in range(matrix.shape[0]): ap[i] = ptr + i*matrix.shape[1] return ap ffi = ffi() ffi.cdef(""" double sum(double**, int, int); """) c = ffi.verify(""" double sum(double** matrix,int x, int y){ int i, j; double sum = 0.0; (i=0; i<x; i++){ (j=0; j<y; j++)...

src - Remote Script fail handling - JavaScript -

in code loading script remote server. here have done: var loadflag = false; var mywidgetscript = document.createelement("script"); mywidgetscript.type = "text/javascript"; mywidgetscript.charset = "utf-8"; mywidgetscript.src = document.location.protocol+ "//mytest.com/loader"; document.getelementsbytagname("head")[0].appendchild(mywidgetscript); mywidgetscript.onreadystatechange=mywidgetscript.onload = mywidgetscript.onload = function() { loadflag = true; if (!this.readystate || this.readystate == "loaded" || this.readystate == "complete") { //do want } }; if(!loadflag){ alert("not loaded"); } now want generate alert if script tag has failed load url. incase url has typo or if server mytest.com down. in code generating alert if url correct , server up... wrong code?... can have other way accomplish this..? try this... may help. var headtag = document.getelementsbytagnam...

bash - find oldest file from list -

i've file list of files in different directories , want find oldest one. feels should easy shell scripting don't know how approach this. i'm sure it's easy in perl , other scripting languages i'd know if i've missed obvious bash solution. example of contents of source file: /home/user2/file1 /home/user14/tmp/file3 /home/user9/documents/file9 #!/bin/sh while ifs= read -r file; [ "${file}" -ot "${oldest=$file}" ] && oldest=${file} done < filelist.txt echo "the oldest file '${oldest}'"

plsql - Assign Result Query to Variable -

how put select max query result variable , use in while loop in plsql? example fine. declare counter number; num_max number:='select max(num_sequencial) ide_identificacao'; begin num_max := num_max/1000; while(counter < num_max) ..... .. you should use select ... into clause: declare counter number; num_max number; begin select max(num_sequencial) num_max ide_identificacao; num_max := num_max/1000; while condition loop {...statements...} end loop;

c# - SQL Permissions differ in SSMS and ASP.NET? -

i have created schema , user called "webapi" used asp.net project stock levels. so, have simple stored procedure: select p.productcode, sum( sl.qty ) 'qty' dbo.stocklevel sl inner join dbo.product p on p.productid = sl.productid group p.productcode i have executed fine under ssms using "webapi" user works fine. but executing within asp.net error message of: the select permission denied on column 'productid' of object 'product", database 'testingdb', schema 'dbo'. here code i'm using in asp.net: string connectionstring = configurationmanager.appsettings["connectionstring"]; using (var conn = new sqlconnection(connectionstring)) { using (var cmd = conn.createcommand()) { conn.open(); cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "[webapi].[getstock]"; using (var reader = cmd.execute...

ios - Push Configuration Profile OTA -

i have setted mdm server push apps user on air. serious issue facing number of people enrolled 50%. push configuration profile mobile, once user connect device corporate wifi. right kept profile in webserver , ask users enroll devices weblink. i setup mdm environment android. should start? wherever serch, redirected this page . sample code link available in page redirects page sample of android app code given. unlike iphone is necessary have app mdm in android? yes. android requires app installed on android device. app allowed of functionality ios mdm protocol provides you. however, it's way more limited ios. speaking, ios mdm gradually improved on 3 major ios releases , it's pretty robust. android deviceadmin functionality didn't change after initial release. different vendors (samsung, motorolla) released own extensions bridge gap. also, android doesn't define client-server protocol. so, have define own protocol deliver equivalent of commands/conf...

mysql - Yii RESTFul with JSON format Update and Create -

i trying implement restful in yii framework json formatting. have single user table shown below: create table user( id int(10) not null, email varchar(100) not null, password varchar(64) not null, nickname varchar(30) not null, primary key(id) )engine=innodb; and in yii usercontroller.php class (my yii application has crud implemented gii). have following 2 functions handle crud apis using restful , json formatting shown below: public function actionread($id=''){ $requesttype = yii::app()->request->getrequesttype(); if($requesttype !== 'get' && $id === ''){ throw new exception('$id must specified or acces service get!'); return; } if($id !== '0'){ $user = yii::app()->db->createcommand('select * user id=:id limit 1'); $user->bindparam(':id', $id); $user = $user->queryrow(); }else{ $user = yii::app()->db...

jquery - How to show a div on top of the page in fixed position? -

i'm having issues keep loaded-content image on position:fixed. my container loads hidden content clicking button, transition loaded content should slide right left. should on top. the loaded-content <div class="sticky">cat image</div> should fixed on top. appreciated. <html> <div class="container">many photos</div> <button>loaded-content comes in transform(translatex(0%)</button> </html> <html> sticky image on top. <button>back button slides loaded content transform(translatex(100%)</button> </html> http://jsfiddle.net/6kpnn/ add css , specity div class on top <style> .sticky { position: fixed; top : 0px; left : 0px; width : (specify) ; height : (specity here); } </style>

c# - MenuItems in ToolStrip -

powerbuilder offers feature such menu item can appear in toolbar adding toolbar properties like(toolbaritemnametoolbaritemtext etc...). do have similar functionality in windows forms applications in c# such menuitem can appear in toolbar without explicitly adding toolstrip/toolbar control? in windows forms need add toolstrip control form display toolstripitems , such toolstripbuttons . toolstripitems added toolstrip.items collection. in short: no .

java - "Missing return statement" within if / for / while -

i have question regarding return statements used within if() while() or for() statements. can see in following method, expecting return string value. problem if use return within if statement block, compiler return error missing return statement . public string mymethod() { if(condition) { return x; } } of course change method header void , use system.out.println instead of return . right way it? missing something? any highly appreciated. if put return statement in if , while or for statement may or may not return value. if not go inside these statement method should return value ( null). ensure that, compiler force write return statement after if , while or for . but if write if / else block , each 1 of them having return in compiler knows either if or else execute , method return value. time compiler not force you. if(condition) { return; } else { return; }

openGL ES shaders wrong uniforms location -

vertex shader looks this: uniform mat4 projectionmatrix; uniform mat4 modelmatrix; uniform mat4 viewmatrix; attribute vec4 vposition; attribute vec4 vcolor; varying vec4 vdestinationcolor; void main(void) { gl_position = projectionmatrix * modelmatrix * viewmatrix * vposition; vdestinationcolor = vcolor; } objective-c code: _projectionmatrixslot = glgetuniformlocation(_programhandle, "projectionmatrix"); _modelmatrixslot = glgetuniformlocation(_programhandle, "modelmatrix"); _viewmatrixslot = glgetuniformlocation(_programhandle, "viewmatrix"); _positionattribslot = glgetattriblocation(_programhandle, "vposition"); _colorattribslot = glgetattriblocation(_programhandle, "vcolor"); here _projectionmatrixslot _viewmatrixslot _modelmatrixslot equals 4294967295 while _positionattribslot , _colorattribslot fine the compiler free throw away variables not used in code. there...

java - Null Pointer Exception for Ebean Insert Query -

i have e bean model of table countries , indicators. indicators model looks this public class indicators extends model { private static final long serialversionuid = 1l; @id public long id; @onetomany(mappedby = "indicator") public hashset<indicators> transactions; @manytoone @joincolumn(name = "countryid") public countries country; } and countries model looks this public class countries extends model { private static final long serialversionuid = 1l; @id @column(name = "countryid") public long countryid; @onetomany(mappedby = "country") public hashset<countries> indicators; } and trying call insert function private static void procm007_sp003(excelind excelrow, string indicator_code) { // insert indicators indobj = new indicators(); indobj.country.countryid=542l; indobj.save(); however, indobj.country.countryi...

php - PDO Statement not returning result -

$query = $db->prepare("select * coupons deleted = ? limit ?, ?"); $query->bindvalue("1", 0); $query->bindvalue("2", 2); $query->bindvalue("3", 5); try{ $query->execute(); $result = $query->fetchall(); return $result; }catch(pdoexception $e){ die($e->getmessage()); } unfortunately returns result no rows (but empty result not error), , when run sql query through phpmyadmin, fetches me multiple rows. suggestions helpful. can't through this. first comment question helped me well: here and solved problem. al above suggestions mentioned above tried , did not work.

java - how to extract PDF watermark content using iText apis -

i going through itext api docs & able create pdf watermark image or text did not find method get/extract watermark content pdf. so have pdf document containing watermarked text/image & want extract text or img , validate not able do. how extract watermark content using itext apis? or there other way validate watermark content? by validate mean if have existing pdf/image watermarked text [as done in 2nd link in above ref], want check whether has expected text/image. references: http://itextpdf.com/themes/keyword.php?id=226 http://www.java-connect.com/itext/add-watermark-in-pdf-document-using-java-itext-library.html how extract watermark content using itext apis? or there other way validate watermark content? extracting watermark content? there nothing special watermarks in pdfs in contrast regular page content. merely appear pretty in content stream , other content later in stream, therefore, drawn above it; or they appear pretty late in co...

music player - How to get album art from last.fm Android -

i'm making music player android, want provide feature users album art of song last.fm. i've got api key too. need retrieving image last.fm. any in getting image url appreciated. thanks in advance. p.s : more info music player, check link below https://plus.google.com/u/0/communities/115046175816530349000 i found solution check below add below asynctask loader public class retrievefeedtask extends asynctask<string, void, string> { protected string doinbackground(string... urls) { string albumarturl = null; try { xmlparser parser = new xmlparser(); string xml = parser.getxmlfromurl(urls[0]); // getting xml url document doc = parser.getdomelement(xml); nodelist nl = doc.getelementsbytagname("image"); (int = 0; < nl.getlength(); i++) { element e = (element) nl.item(i); log.d(log_tag,"size = " + e.getattribute("si...

text to speech - Android TTS has more languages available than found in settings -

i using android's tts (using google's engine) , quite confused settings , language support. how detect if language available: if (tts.islanguageavailable(currentlocale) >= texttospeech.lang_available) { ttsavailable = true; tts.setlanguage(currentlocale); tts.setonutteranceprogresslistener(new vputteranceprogresslistener()); } which works fine. in fact, works better expected. default google engine not has dutch voice (as found in settings > input > text-to-speech), yet engine claims available , speaks dutch. did google silently add tts voices , not open them settings? i don't have 50 reputation comment i'll answer here. a simple explanation might when android firmware released, tends target particular region, europe. so, european firmware might have pretty western, plus some, or eastern european languages built firmware. however, tts "service" within firmware, wrapped neatly in app, supporting java / android classes. ,...

cakephp - Class in menu link -

i have code menu in app, , need add class type one. <?php echo $this->html->link('home page', array('controller'=>'pages','action'=>'home_page'), array('escape'=> false)).' | '; ?> can me please? how can add it? try this $this->html->link('home page', array('controller'=>'pages','action'=>'home_page'),array('escape'=>false ,'class'=>'yourclass'));

c# - Refactor XAML in WPF -

my xaml has got long , hard maintain. wondering if there way refactoring? here simple example: <window x:class="refactorxaml.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <stackpanel> <button>new</button> <button>open</button> </stackpanel> </grid> </window> how can refactor stackpanel section , write this? <window x:class="refactorxaml.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> // refactored markup ...

stop preventing HTML code rendering with Return and Die function in php -

as know in php script when call return or die prevents rest of html codes rendering. in occasion when want stop php script not whole page do? ex: <?php if(!isset($_post['txt_username'])) { echo "please enter username"; return; } ?> <i want="this html">to rendered</i> i want html codes rendered afterward. reading. your question not clear, need stop php code execute, html render? might need output buffer or functions. e.g.: <form action="" method="post" > <input type="text" name="txt_username" /> <input type="submit" /> </form> <?php function dosmth(&$password) { if(!isset($_post['txt_username'])) { echo "please enter username"; return false; } $password .= "333"; echo "you password has been changed $password"; } $password = 128; dosmth($password);...

android - How to make certain parts of the textview to look bold? -

i'm fetching data contacts , displaying in textview. want 1 part t in bold.how that. tried doing this: sb.append(html.fromhtml("\n"+" contact name: " + name); it's not working..can please me you need format string in html form during creation apply formhtml method on whole string. html.formhtml() method returns displayable styled text(spanned) provided html string. if applying method on substring(with html tags) after appending them stringbuffer, sb.append(html.fromhtml("\n"+" < b>contact name< /b>:" + name) calls spanned.tostring() method resulting in removal of html tags hence viewing plain text in text view. try way solve problem stringbuffer sb=new stringbuffer(); sb.append("hello"); sb.append("<b>how</b>"); sb.append("are you"); tv.settext(html.fromhtml(sb.tostring()));

How can I define external API function in Postgresql? -

in project, need add external api function, example: select c.name c,s checkresult(c.name); the function checkresults () returns ture or false, , in function need call thirty party api function. how can achieve in postgresql? thanks. there 2 ways this. one use procedure language. can use language want after installing language in question: http://www.postgresql.org/docs/current/static/sql-createlanguage.html postgres typically compiled perl , python languages. after installing e.g. plerlu (since need remote access functions), do: create function funcname (argument-types) returns return-type $$ # pl/perl function body $$ language plperlu; http://www.postgresql.org/docs/current/interactive/plperl-funcs.html the other way use foreign data wrapper: http://wiki.postgresql.org/wiki/foreign_data_wrappers these need(ed?) written in c. there multiple examples in above-referenced page. example pulls third party api, see twitter fdw instance: select f...

java - JSF View Scope: How to Check if an object is in the view tree -

i use spring + jsf, view scope being managed spring. i've noticed on every request, view destroyed , created again, , @postconstruct method called on every request. in pages ok, since in method object initializations (mainly new calls). but in others pages problem because have make heavy queries initialize lists, , view behavior calls initialization method on every request... request in page veeeeeery slow. i know view scope stores bean , it's objects in session , later recover them; want know if there's way check if these objects stored don't need initialize heavy objects @ every request; them session. update the view scope used 1 implemented here: http://comdynamics.net/blog/109/spring3-jsf2-view-scope/ you need move data can reused on these pages session scoped bean , put method on allow reload data if necessary. data view scoped beans session bean. going route, should retrieving data database when need fresh data calling reload method on sess...

.htaccess - WordPress 301 redirect with old/new url -

i'm trying url of old wordpress without custom permalink new version of same site goold url doesn't work. i tried 301 redirection of old url newer... .htaccess : redirect 301 /\?page_id=184 http://mydomain.com/about can me ? you can try redirection this. this plugin redirect old urls target urls. hope you.

list - Workflow configured for mail sending to user when document adding in SharePoint 2010 -

i need send email via workflow here have configured workflow when document adding, need mail send admin. here workflow correct mail unable sending admin. i haven't configured smtp outgoing email in ca in sharepoint2010. have required smtp configuration ple suggest me. you need configure smtp settings in central administration. here guide on how it: http://hosting.com/support/sharepoint-2010/configure-emailsmtp-in-sharepoint-2010/ go central administration console in central administration, click system settings. on system settings page, in e-mail , text messages (sms) section, click configure outgoing e-mail settings. on outgoing e-mail settings page, in mail settings section, type smtp server name outgoing e-mail (for example, mail.example.com) in outbound smtp server box. in address box, type e-mail address want displayed e-mail recipients. in reply-to address box, type e-mail address want e-mail recipients reply. click ok , done

c# - Some tips concerning exception handling would be appreciated -

not sure if should here or on code review, here goes! i have little console application read in excel data of exceldatareader. code console application: class program { static void main(string[] args) { somedata data = new somedata(@"c:\sc.xlsx", "somedata_2014"); ienumerable<sometype> sometypes = somedata.getdata(); console.readline(); } } please don't worry naming of variables; company , don't want use company related. next somedata class: public class somedata { private string path; private string worksheetname; public somedata(string path, string worksheetname) { this.path = path; this.worksheetname = worksheetname; } public ienumerable<sometype> getdata(bool isfirstrowascolumnnames = true) { var exceldata = new exceldata(path); try { var ad = exceldata.getdata(worksheetname, isfirstrowascolumnnames); ...

match - matching words from a file exactly in php -

im trying see if words in string match words in file exactly. had sentance: "i love football" foreach ($match $macthes) { if (stripos("i love football",$match) !== false) { break; } } here the above method works, find love , want too, works when types shorter version of word, searching "pleased" put in "please" show result , dont want that. is there way can run method if exact match found? to find complete word can use regular expression word boundary character: \b if (preg_match('/\b'.preg_quote($emotion).'\b/', $value['message'])) { the important part put \b both before , after word or phrase looking for, denotes word boundary: a word boundary position in subject string current character , previous character not both match \w or \w (i.e. 1 matches \w , other matches \w), or s...

java - function that can use iText to concatenate / merge pdfs together - causing some issues -

i'm using following code merge pdfs using itext: public static void concatenatepdfs(list<file> listofpdffiles, file outputfile) throws documentexception, ioexception { document document = new document(); fileoutputstream outputstream = new fileoutputstream(outputfile); pdfwriter writer = pdfwriter.getinstance(document, outputstream); document.open(); pdfcontentbyte cb = writer.getdirectcontent(); (file infile : listofpdffiles) { pdfreader reader = new pdfreader(infile.getabsolutepath()); (int = 1; <= reader.getnumberofpages(); i++) { document.newpage(); pdfimportedpage page = writer.getimportedpage(reader, i); cb.addtemplate(page, 0, 0); } } outputstream.flush(); document.close(); outputstream.close(); } this works great! once , while, it's rotating of pages 90 degrees? ever have happen? i look...

ubuntu - gsvideo cant play video on pcduino with processing -

i installed processing on pcduino , installed gsvideo version 1.0.0 when run video following error cannot connect server socket err = no such file or directory cannot connect server socket jack server not running or canot started does have clue going wrong? i not have jackd installed because pulseaudio installed , running.

php - How to look at _POST values coming to the controller (Yii) -

i read book "yii", can't understand how @ global _post array receiving controller? view _form.php <div class="row"> <?php echo $form->labelex($model,'category_id'); echo chtml::dropdownlist('page[category_id]','', category::allcategory(), array( 'ajax' => array( 'type'=>'post', //request type 'url'=>ccontroller::createurl('subcategory/dynamicsubcategories'), //url call. //style: ccontroller::createurl('currentcontroller/methodtocall') 'update'=>'#page_subcategory_id', //selector update // 'data'=>array('category_id'=>'js:this.value'), //leave out data key pass form values through ))); echo $form->error($model,'category_id');...

php - Ruby web application working modes -

when write web app on php can works in different modes: fcgi (php-fpm), apache module (mod_php) , on. in cases when editing php scripts application updates immediatelly without need restart server. know ruby web app can works in different modes (i.e. fcgi withing unicorn + nginx). want idea common ways launch ruby web app , techincal details means (i.e. when should restart server update scripts), proc , cons. there many ways write ruby applications, classic 1990s-style cgi, fastcgi, independent http-capable processes mongrel or thin , more modern, recommended approach uses launcher passenger manage processes more directly. ruby on rails can have several operating modes. default 2 development , production . these have important differences: in development : anything in app/ or config/routes.rb reloaded each request. the log/development.log verbose possible, recording each query executed. assets served in raw form, can changed time. in production : appl...

Writing a login service in AngularJS -

i trying refactor angularjs application , introduce login service. controller has methods login() , logout() , getcurrentuser() , make http requests , handle user object. want move these functions service, because need call getcurrentuser() method multiple controllers. i have written following service: angular.module('common.login', []). factory('loginservice', function ($http) { return { user: null, error: null }; }); so @ moment service not doing anything. error: uncaught error: circular dependency: loginservice <- $http if remove $http dependency callback function, service works. have trouble understanding why there circular dependency. loginservice factory injected 2 places: **main module's config callback ** , **login module's controller callback **. config callback configures http interceptor, login controller uses http services. the circular dependency caused because configure ht...

sql - What's the curve for a simple select query? -

this conceptual question. hypothetically, when select * table_name table has 1 million records takes 3 secs. similarly, when select 10 million records time taken 30 secs. told selection of records not linearly proportional time. after number, time required select records increases exponentially? please me understand how works? there things can make 1 query take longer other simple selects no clauses or joins. first, time return query depends on how busy network @ time query run. depend on whether there locks on data or how memory available. it depends on how wide tables , in general how many bytes individual record have. instance expect 10 million record table has 2 columns both ints return faster million record table has 50 columns including large columns epecially if things documents stored database objects or large fields have text fit ordinary varchar or nvarchar field (in sql server these nvarchar(max) or text instance). expect becasue there less total data ...

java - Stanford CoreNLP sentiment -

i'm trying implement corenlp sentiment analyzer in eclipse. getting error: unable resolve "edu/stanford/nlp/models/lexparser/englishpcfg.ser.gz" as either class path, filename or url. installed of nlp files using maven not sure why looking else. here code getting error on. import java.util.properties; import edu.stanford.nlp.ling.coreannotations; import edu.stanford.nlp.neural.rnn.rnncoreannotations; import edu.stanford.nlp.pipeline.annotation; import edu.stanford.nlp.pipeline.stanfordcorenlp; import edu.stanford.nlp.sentiment.sentimentcoreannotations; import edu.stanford.nlp.trees.tree; import edu.stanford.nlp.util.coremap; public class stanfordsentiment { stanfordcorenlp pipeline; public stanfordsentiment(){ properties props = new properties(); props.setproperty("annotators", "tokenize, ssplit, parse, sentiment"); pipeline = new stanfordcorenlp(props); } public float calculatesentiment (string text) { floa...

html - Javascript addRule multiple selectors -

i'm experimenting addrule on css in html. works fine if this: document.stylesheets[0].addrule("#" + id + ':hover', 'max-height: ' + desiredheight + 'px;'); where id , desiredheight variables set. applies max-height when hover on element. question this: how can add structire this: body.link, body.appadd, body.pagelike { #id:hover{ overflow:hidden; maxheight: 400px; } } please ;) that structure has compiled down pure css before browser can understand it. so in particular case, like: document.stylesheets[0].addrule( 'body.link #'+id+':hover, body.appadd #'+id+':hover, body.pagelike #'+id+':hover, ', 'max-height: ' + desiredheight + 'px;' ); but if using id in 1 place recommended, you'll need (what have): document.stylesheets[0].addrule( '#'+id+':hover', 'max-height: ' + desiredheight + 'px;' );

symfony - Call an entity method in a controller -

i have 3 entities: invoice,payment , result the relationships between entities are: result(1,1)-------------(1,n)invoice(1,n)---------------(1,1)payment here's problem :i in paymentcontroller when create new payement ,i retrieve invoice entity , in same paymentcontroller create new result. here's paymentcontroller code: use myapp\accountbundle\entity\result; class paymentcontroller extends controller public function createaction() { $entity = new payment(); $request = $this->getrequest(); $form = $this->createform(new paymenttype(), $entity); $form->bindrequest($request); $amount=$form->get('amountreceived')->getdata(); if ($form->isvalid()) { $em = $this->getdoctrine()->getentitymanager(); $invoice = em->getrepository('myappaccountbundle:invoice')->find($entity->getinvoice()->getid()) if (!$invoice) { throw $this->createnotfoundexception(...

Excel VBA Cannot call function with onaction -

i write script ok button in userform create delete button on sheet delete whole line. problem when click delete button, cannot call function assigned onaction parameter. private sub okbutton_click() dim emptyrow long 'make feuil1 active feuil1.activate 'determine emptyrow emptyrow = worksheetfunction.counta(range("c:c")) + 1 dim deletebutton button dim t range set t = activesheet.range(cells(emptyrow, 2), cells(emptyrow, 2)) set deletebutton = activesheet.buttons.add(t.left, t.top, t.width, t.height) deletebutton .onaction = "deleteline" .caption = "delete" & emptyrow .name = "deletebutton" & emptyrow end 'close user form unload me end sub sub deleteline() msgbox "you clicked me" end sub

Matlab: Plotting error Analysis -

Image
i have created function expresses ideal characteristics of concentration vs time , real characteristics of concentration vs time gaussian noise. following curves of both ideal , real function i plot error curve expresses difference between ideal , real values(with noise) the characteristics must expressed in( noise - x axis vs error -y axis) instead of concentration vs time following function generates 2 curves expressed above function [c_t,c_t_noise] =noise_constrainedk2(t,a1,a2,a3,b1,b2,b3,td,tmax,k1,k2,k3) k_1 = (k1*k2)/(k2+k3); k_2 = (k1*k3)/(k2+k3); %dv_free= k1/(k2+k3); c_t = zeros(size(t)); ind = (t > td) & (t < tmax); c_t(ind)= conv(((t(ind) - td) ./ (tmax - td) * (a1 + a2 + a3)),(k_1*exp(-(k2+k3)*t(ind)+k_2)),'same'); ind = (t >= tmax); c_t(ind)=conv((a1 * exp(-b1 * (t(ind) - tmax))+ a2 * exp(-b2 * (t(ind) - tmax))) + a3 * exp(-b3 * (t(ind) - tmax)),(k_1*exp(-(k2+k3)*t(ind)+k_2)),'same'); mean=1:10 sigma=1:45...

serversocket - DataInputStream giving java.io.EOFException -

i have created small cli client-server application. once server loaded client can connect , send commands server. the first command list of files server loaded with. once socket connection established. request user enter command. clientapp.java socket client = new socket(servername, serverport); console c = system.console(); if (c == null) { system.err.println("no console!"); system.exit(1); } string command = c.readline("enter command: "); outputstream outtoserver = client.getoutputstream(); dataoutputstream out = new dataoutputstream(outtoserver); out.writeutf(command); then server capture user's command , send appropriate replies. severapp.java - socket server = serversocket.accept(); datainputstream in = new datainputstream(server.getinputstream()); switch (in.readutf()){ case "list": (string filename : files) { out.writeutf(filename); } out.flush(); } server.close(); next ...

angularjs - $stateParams returning undefined -

i have these routes defined: .state('sport', url: '/sport' templateurl: '/templates/sport' controller: 'sportctrl' ) .state('sport.selected' url: '/:sport' templateurl: '/templates/sport' controller: 'sportctrl' ) and have controller trying use :sport param given sport.selected state. angular.module('myapp') .controller('sportctrl', ['$scope', 'parseservice', '$stateparams', function ($scope, parseservice, $stateparams) { var sporturl = $stateparams.sport; ... }); for reason, returns undefined when call $stateparams.sport in controller, though think defined in routes. why case? thanks help! when access url /sport/12 , sportctrl instantiated twice: once state sport , , once state sport.selected . , first state, there no parameter associated state, $statepa...

ios - Bezier path not visible in view -

i copied code below stanford ios7 course adding bezier path view. however, when included code in viewdidload didn't show on screen uibezierpath *path = [[uibezierpath alloc] init]; [path movetopoint:cgpointmake(75, 10)]; [path addlinetopoint: cgpointmake(160, 150)]; [path addlinetopoint:cgpointmake(10, 150)]; [[uicolor whitecolor] setstroke]; [[uicolor whitecolor] setfill]; [path stroke]; [path fill]; afterwards, added log statement nslog(@"path: %@", path); prints ominous error message. this serious error. application, or library uses, using invalid context , thereby contributing overall degradation of system stability , reliability. notice courtesy: please fix problem. become fatal error in upcoming update. can explain doing wrong? the error message correct. using drawing commands, not inside drawing (graphics) context. hence commands thrown away (and bad). you should give drawing commands when within gr...

Cookie-based authentication and web API -

i'm architecting public web api service. equally consumed web pages , native mobile apps (ios, android , windows 8). should use cookie-based authentication? mean, best practice scenario? futher info: after little research in authentication/authorization/openid-connect field realized of handled browser, mean, redirects, coockie insertion , related "boiler-plate" stuff... when think boiler-plate have duplicate in natives apps, wonder if model best mobile apps. mean, maybe theres more mobile-native-friendly way... ps: know little generic still, it's i'm begginer in field of security , dont know how express doubts/concerns/"laziness" still... the api should stateless, , not manage sessions. each request api should made authentication details (e.g. oauth token). if web pages , mobile applications need maintain kind of session, should them clients of service maintain state. instance, web page might set session cookie user, native mobile a...

login - sonatype nexus does not fully log in -

i upgraded nexus 1.8.0.1 2.8.0-05 , cannot log in anymore. when try login nothing happens. there still "log in" button on top right , menu on left not show (except there when not being logged in). so, login has no effect. i tried log in invalid account info , gives me login error ("incorrect username, pass..."), login data checked. tried admin , user login - no difference. actual content still there (all repos artifacts) , shown in browser. how can log in? details: upgraded nexus 1.8.0.1 2.7.2-03 (file: "nexus-2.7.2-bundle.tar") , 2.8.0-05 (file: "nexus-2.8.0-05-bundle.tar") on centos 5.10 according upgrade notes , instructions found (except step plexus there no such file). nexus 2.7 got invalidmagicmimeentryexception according nexus-6102 fixed in 2.8 , therefore went on upgrading 2.8 , not happen anymore - i'm not sure, if has caused problem. this bit of shot in dark... know of issue cause this. if have ssl enabled reve...

html - Using jQuery to count dynamic <li> elements by class using event handler -

i'm trying use jquery count ul li elements class. class being toggled on , off jquery script: $(document).ready(function(){ $(".checkbox1").click(function(){ $("li.tom").toggleclass( "hider" ); }); }); i understand means need add event handler listen changes in ul : $('.cartlist').on('click', 'li.hider', function () { var total=$('.cartlist > li.hider').length; $('.totalcount').html('$' +total * 999); }); }); the script have written half works, in sense .on() handler using counts class hider , when li items clicked. no doubt because using .on('click'). i've read jquery docs .on() and, understand, should able use other dom hooks 'load', 'scroll' etc. however, when replace .on('click') .on('load') or .on('change'), nothing happens. also, unchecking checkboxes doesn't change total, because handler tied ul , doe...

css - how can i move div in a horizontal line? -

i know how can move 3 div's horizontal line? code : <div id="div1"> <img id="poza1" src="http://s13.postimg.org/x0yjq2xxv/programare.jpg?nocache=13 97486136" /> </div> <div id="div2"> <img src="http://s11.postimg.org/axam9glov/administrare.jpg?nocache=1397486260" width="468" height="167" id="poza2" /> </div> <div id="div3"> <img id="poza3" src="http://s30.postimg.org/ly7cy5xrx/tacografe.jpg?nocache=1397486471" /> </div> thank you. #div1, #div2, #div3 { float: left; } this works provided total width of 3 divs less parent (or page)

html - box shadow on figure element getting skewed due to root margin -

i've provided box-shadow on figure element. but, image appearing skewed due *{margin:10px} i've given. there way can still maintain margin , able land box shadow on figure element? html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>insert title here</title> <link rel="stylesheet" href="drop.css" > </head> <body> <section id="pics"> <figure id="pic1" class="pictures" > <img alt="figure1" src="http://b-i.forbesimg.com/kellyclay/files/2013/12/glass.jpg" title="pic1" > <figcaption class="figuredetails">fig1</figcaption> </figure> <figure id="pic2" class="pictures" ...

html - Google Chrome wrong position on small screen -

Image
in google chrome i've problem css: http://g4.nl/index.php/tour-x (use link in chrome): the picture doesn't adjust screen size text same. is there css fix chrome solve problem? don't have problem on other browsers. the code text including image: <p><strong><span style="line-height: 1.3em;" data-mce-mark="1"><span style="color: #31994d;">introductie</span></span></strong><strong><span style="line-height: 1.3em;" data-mce-mark="1"><br /></span></strong></p> <table style="height: 399px; width: 1319px;"> <tbody> <tr> <td align="left" valign="top"> <p style="text-align: justify;">de g4 tour-x een bijzondere 3-piece bal. hij combineert een aantal eigenschappen die men normaliter niet in één bal vindt. de bal voelt zeer zacht aan en geeft zeer veel backspin. daarnaast het ee...