Posts

Showing posts from April, 2013

java - Trouble with intersection between line segments -

i have path stored points in arraylist , want check if line segments intersecting. unknown reason it's not working! don't message in logcat despite i'm drawing shape intersects. preciate if see have done wrong or have suggestions how improve code. // intersection control if(touchactionup) { // loop throw points except last 3 (int = 0; < points.size()-3; i++) { line line1 = new line(points.get(i), points.get(i+1)); // begin after line above , check points after (int j = + 2; j < points.size()-1; j++) { line line2 = new line(points.get(j), points.get(j+1)); // call method check intersection if(checkintersection(line1, line2)) { log.i("intersection", "yes!"); } } } } and method: // method check intersection between lines private boolean interceptioncontrol(line line1, l

c# - "Field-like events" and "events in general" clarification? -

a field-like-event way of declaring both delegate variable , event @ same time. so field event ( public event eventhandler myevent; ) may translate : ( taken here ) private eventhandler _myevent; public event eventhandler myevent { add { lock (this) { _myevent += value; } } remove { lock (this) { _myevent -= value; } } } notice private backup field. however , corrected jon ( comments section ) , general-event doen't have backup field . : public event eventhandler myevent { add { console.writeline ("add operation"); } remove { console.writeline ("remove operation"); } } notice - no backup field. but said winform act : for instance, in situations there lots of events few subscribed to, have map key describing event delegate handling it. wind

How to subtract values from textbox in form from Field in table (Access '07 VBA)? -

i developing canteen transaction system in ms access 2007. in "add food item:" form, have series of textboxes , comboboxes, button, "add item" , listbox. names of text , combo boxes follows : textbox names: txtrate, txtqty combobox names: cbxicode, cbxitems on click of add item button, selected item quantity, rate etc. gets tranferred listbox. (i asked asked transfer question here ) now, in tblitems, there "qtyavailable" field indicates available quantity of existing food items. how i: subtract quantity of food item user enters qtyavailable field in tblsampledata? advanced appreciated. thanks, s sandeep write query def performs task on table. can set parameters in query def enclosing them in square brackets. when ms access not recognize name in square brackets, prompt user value. once works correctly, search net vba examples on using ado or dao copy of query def in memory, set parameter value(s), , execute query. record

Warning: rename(k.jpg,) [function.rename]: No error in C:\xampp\htdocs\xampp\uploader.php on line 15 -

warning: rename(k.jpg,) [function.rename]: no error in c:\xampp\htdocs\xampp\uploader.php on line 15 i keep getting error, though file keeps getting moved correct folder... $target_path = "schlimage/"; $school_name= $_session["school_username"]; $nm=$_files['uploadedfile']['name']; $target_path = $target_path . basename( $_files['uploadedfile']['name']); if(move_uploaded_file($_files['uploadedfile']['tmp_name'], $target_path)) { echo "the file ". basename( $_files['uploadedfile']['name']). " has been uploaded"; } else { echo "there error uploading file, please try again!"; } rename($nm,$school_name); rename($nm,$school_name); change to $co = substr_count($nm,'.'); $ex = explode('.',$nm); rename($target_path,"schlimage/".$school_name.".".$ex[$co]); see rename php function

android - Why I am getting null pointer exception in the following code? -

this code, getting npe in function writefile(). point passing string writefile() method creates file using createfile() , writing string newly created file. the file created in in directory, nothing being written it. string shows output @ logcat too, clear not empty string. public file createfile( ){ file storagelocation = new file( environment.getexternalstoragedirectory(), path); storagelocation.mkdirs(); if(!environment.getexternalstoragestate().equals(environment.media_mounted)) { toast.maketext(context, "cannot use storage.", toast.length_short).show(); } try{ file file = new file(storagelocation, getfilename()+".xml"); file.createnewfile(); } catch( ioexception e){ e.printstacktrace(); } return file; } public string getfilename( ){ simpledateformat sdf = new simpledateformat("dd-mm-yyy",locale.uk); return sdf.format(c.gettime( )); } public void writefile( strin

c++ - Cascades NavigationPane: connect to an object signal into another qml file -

i've created blackberry application using wizard navigationpane template, , added components on detailspage.qml (like button , textfield ). i want connect slot function on button in detailspage.qml, when clicked read text textarea on same page. my problem when application launched, qml loaded main.qml. if try reference object on detailspage.qml findchild return 0x0, because cannot find it. main.qml file is: // navigation pane project template import bb.cascades 1.0 navigationpane { id: navigationpane page { // page picture thumbnail container { background: color.black layout: docklayout { } button { horizontalalignment: horizontalalignment.center verticalalignment: verticalalignment.center text: qstr("new todo") imagesource: "asset:///images/picture1thumb.png" onclicked: {

How to unload project in Xamarin? -

i can't find method unload project in xamarin! solution big , project can't loaded in xamarin. want unload it,they test project. the way find leave project in solution remove build configuration. right click on solution > preferences > genereal > build > configurations , un-check project. this way project can stay on solution compiler not try compile it.

css - Content-dependent div with labels -

Image
<div id="combobox"> <label><input type="checkbox" id="tag3" name="checkbox" onclick="toggletag('tag3')"/>dialogproc</label><br/> <label><input type="checkbox" id="tag2" name="checkbox" onclick="toggletag('tag2')"/>fds</label><br/> </div> i'm using div container checkboxes labels. corresponding css: div#combobox { max-height: 150px; overflow: auto; border: 1px solid #000000; } and want - vertical scrollbar (no horizontal one), capped height , content-dependent width. 1 exception - doesn't take vertical scrollbar's width account. when there few lines/checkboxes , vertical scrollbar isn't needed - width of div width of widest checkbox. when scrollbar appears, width of div unchanged: the label broken 2 lines. fixed span : <span><label><input t

swing - Java JScrollBar Design -

Image
i want customize jscrollbar design. use mac develop app eclipse. tried scrollpane.getverticalscrollbar().setbackground(color.black); nothing happen. my code: scrollpane = new jscrollpane(scriptview); scrollpane.setborder(borderfactory.createemptyborder()); scrollpane.getverticalscrollbar().setunitincrement(6); window.getcontentpane().add(scrollpane); the object scriptview class jeditorpane . how should look: thanks every help. i guess looking transparent scrollbar. this presented idea(not tested code): import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.basic.*; public class translucentscrollbartest { public jcomponent makeui() { jtextarea cmp = new jtextarea(); string str = "1234567890abcdefghijklmnopqrstuvwxyz"; for(int i=0; i<20; i++) { cmp.append(str+str+"\n"); } cmp.setforeground(color.white); cmp.setbackground(color.black); cmp.setopaque(true);

css transitions - CSS3 - 3D Card flip animation without using click events -

this question has answer here: flip 3d card css 1 answer i'm new in css3, , interested in 3d animation it. have question , hope can me. there way make card flip effect without using click events ? have searched lot not generate results little experience. please, me? you can css-transitions , no javascript @ all. using :target css attribute detect state of card css a { display: block; margin-bottom: 10px; padding: 10px; width: 135px; background: red; border: 1px solid black; border-radius: 10px; color: white; text-transform: uppercase; text-decoration: none; } a.unflip { display: none; } div.card { position: relative; } img { position: absolute; width: 190px; height: 265px; -webkit-transition: 1s; -moz-transition: 1s; -o-transition: 1s; -ms-transition: 1s; transition: 1s; } img.front { z-index: 1; } img.back,

php - $_GET method is not set even after passing a query string -

this jquery code: <script type = "text/javascript"> $('document').ready(function(){ $('#mybutton').click(function(){ var querystring = $('frmemployee').serialize(); $.ajax({ url: 'anotherphp.php', type: 'get', data: querystring, success: function(){ alert('success!'); } }); }); }); </script> after clicking mybutton, expect php code execute. <?php require_once('db_connect.php'); if(isset($_get['f_name'])){ $f_name = $_get['f_name']; $m_name = $_get['m_name']; $l_name = $_get['l_name']; mysql_query("insert tbl_employee (f_name, m_name, l_name) values('$f_name','$m_name','$l_name')"); } ?> my problem of $_get functions seems emp

java - OPENGL ES 2.0 texture in circle -

trying load texture circle, have big troubles it. original texture: original texture here's code: private void circle(){ int segments = 20; vertices = new float[segments * 3+6]; texture = new float[segments * 3+6]; float angle = (float)(2*math.pi/segments); vertices[0]=0; vertices[1]=0; texture[0]=0.5f; texture[1]=0.5f; for(int = 0; < segments; i++){ vertices[3+(i*3)]=(float)math.sin(angle * i)*0.7f; vertices[3+(i*3+1)]=(float)math.cos(angle*i)*0.7f; texture[3+(i*3)]=(float)math.sin(angle * i)*0.5f+0.5f; texture[3+(i*3+1)]=(float)math.cos(angle * i)*0.5f+0.5f; } vertices[3*segments+3]=0; vertices[3*segments+4]=0.7f; } and getting this: my result what doing wrong? thank you

java - Resources and config loading in maven project -

i'm using maven desktop applycation. read maven standart directory layout , have project structure now: app |-- pom.xml `-- src |-- main |-- java | `-- java classes |-- resources | `-- images | `-- app images `--config `--config.xml i want find way load resources , config files. read articles , topics , found (simplified example code): //class loading config public class preferences { public preferences() { inputstream image = preferences.class.getresourceasstream("images/image.png"); inputstream config = preferences.class.getresourceasstream("config.xml"); } } but image , config variables contains null. trying different variants of loading (from root folder, this.getclass() instead of preferences.class, , others), have null. don't understand resource loading system , didn't find documentation it. nice, if gives explanation mechanism (or

javascript - Jquery concatenting very simple counter with a Variable -

following question, have working script create dynamic form fields : fiddle i thought figure out rest, not understand why when try assign new name , id attributes textarea , gives me nan . if : i++; var newname = jquery(prevdiv).attr('name'); prevdiv.find('textarea').attr('name',i ); it sets ok, if try : prevdiv.find('textarea').attr('name',newname +i ); ..which need - nan . i know js qualities close zero, syntax wrong ? you have no name attr in jquery(prevdiv) element. name attribute on textfield. your code should : var newname = jquery(prevdiv).find("textarea").attr('name'); prevdiv.find('textarea').attr('name',newname + ); updated fiddle : http://jsfiddle.net/ny5y7/

xml - repeatable blocks with range in oracle -

please find below table. entire data within docstart , docend. data further enclosed within baccstart , baccend. type of block repeatable. have pick of abcd repeatable , total(occurring once per block) , accname (occurring once per block) each block within baccstart , baccend , form xml <baccstart> <total>100</total> <abcd>abcd</abcd> <accname>name</accname> </baccstart> for each such block. presently using loop, performance not mark. have around 200 such blocks have form xmls within 15 seconds. presently loop taking around 53 secs. rownum name value 1 docstart null 2 baccstart null 3 abcd abcd 4 abcd abcd2 5 pqrs pqrs 6 pqrs pqrs2 7 total 100 8 accname name 9 baccend null 10 baccstart null 11 abcd abcd 12 abcd abcd2 13 pqrs pqrs3 14 pqrs pqrs4 15 total 150 16 accname name 17

java - Cell of a String array and String doesn't match -

here's java code: string s="foo"; for(int i=0;i<5;i++) if(myarray[i]==s) return true; by debugging, i'm sure first element of myarray same string s, doesn't match, because program jump on if block(the condition false). there can me? you should use string.equals() compare types of string . if(myarray[i]==s) should be if(myarray[i].equals(s)) { } at moment, you're testing if s , myarray[i] same object, not different objects containing same value.

INSERT and return ID, or if DUPLICATE KEY return existing ID in MySQL -

i have "tags" table, has unique on "tags" column, prevent duplicates. i have "bookmarks_tags" table, relates bookmarks tags, , has unique on "bookmark_id" , "tag_id" columns, prevent duplicates. however, need people able add same tag, , accomplish this, need means of retrieving id of existing tag use reference in "bookmarks_tags" table. is there way of writing insert if detects duplicate, returns id of duplicate? or, alternatively, insert ... select more appropriate "bookmarks_tags" table? the key thing here has work under both conditions; add new, or retrieve old. also, last_insert_id() useless in scenario, tag in question have been added @ time. any ideas? one way using insert ignore : insert ignore tags (tags,...) values (the_new_tags, ...); select tag_id tags tags=the_new_tags;

compiler construction - Ambiguous grammar in parse phase -

i want build compiler own language, wrote grammar , finished lexer phase question in parse phase part of ebnf grammer statement → block | assignment | callstatement | declaration | inputstatement |outputstatement | ifstatement | whilestatement callstatement → identifier { /[expression/] } {. identifier } /( arguments /) lefthand → identifier { /[expression/] } {. identifier { /[expression/] } } i use recursive descent parser method , problem distinguish between callstatement , lefthand ,how should solve ,i apologize if can't explain idea :(

performance - SQL Server query optimization date calculations -

Image
i trying find more efficient way of re-writing query. any suggestions? thinking of displaying fiscal month name number itself, compare , return month name. (case --proj_end_fis_mon when (mymw.mfg_year_no = fyqm.fiscal_year_no , mymw.mfg_month_no = 12) (convert(varchar,(mymw.mfg_year_no-1))+'-'+(case when fm.fiscal_month_name 'jan%' '01' when fm.fiscal_month_name 'feb%' '02' when fm.fiscal_month_name 'mar%' '03' when fm.fiscal_month_name 'apr%' '04' when fm.fiscal_month_name 'may' '05' when fm.fiscal_month_name 'june' '06' when fm.fiscal_month_name 'july' '07' when fm.fiscal_month_name 'aug%' '08' when fm.fiscal_month_name 'sep%' '09' when fm.

objective c - Distance between two points on circle in specific direction -

i have 2 points on circle, (x1y1) , (x2y2). how calculate distance between them in counter , clock wise direction. currently, using following formula calculate distance between 2 points on circle. please suggest. - (cgfloat)calculatedistancebetween:(cgpoint)point1 point2:(cgpoint)point2 { cgfloat dx = point2.x - point1.x; cgfloat dy = point2.y - point1.y; return sqrt(dx*dx + dy*dy ); } this maths question really. you're looking arc length (which equals angle in radians multiplied radius) your function stands can't calculate arc length, because doesn't know circle (it takes 3 points define circle). - (cgfloat)calculateshortestarcdistancebetween:(cgpoint)point1 point2:(cgpoint)point2 center:(cgpoint)center { cgfloat dx1 = point1.x - center.x; cgfloat dy1 = point1.y - center.y; cgfloat dx2 = point2.x - center.x; cgfloat dy2 = point2.y - center.y; cgfloat angle1 = atan2f( dy1, dx1 ); cgfloat angle2 = atan2f( dy2, dx2 );

Can't show / hide a part in WordPress with the normal loop -

i tried following. when there content show, show + show h3 <h3>overview</h3> , if not show noting. but not work me. code: <?php $heroimage = get_field('hero_image' ); $alt = $image['title' ]; ?> <?php if ($heroimage) : ?> <div class="grid_12"> <img src="<?php echo $heroimage; ?>" alt="<?php echo $alt; ?>"/> </div><!-- end div.grid_12 --> <?php endif; ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <article class="grid_8"> <h3>overview</h3> <?php the_content(); ?> </article><!-- end article.grid_8 --> <?php endwhile; ?> the first part of hero image image plugin advanced custom fields. problem lies on if have_posts etc..

jquery - Why does moving my script references to the bottom of _SiteLayout.cshtml cause the tabs to no longer work? -

i'm using jquery-ui tabs in site. i've got this: <script src="~/scripts/jquery-2.0.0.min.js"></script> <script src="~/scripts/jquery-ui-1.9.2.min.js"></script> <script type="text/javascript" src="../fancybox/jquery.fancybox.pack.js"></script> <script src="~/scripts/modernizr-2.6.2.js"></script> ...and works fine, when i, suggested performance reasons, move bottom of page (after html, above jquery "ready" function), no longer works - nav links bland uls. if performance enhancement drop script down bottom of page, how can , still have ui work should?

database - couch db - URI address -

i have bd "list" products like: { "_id": "car1", "_rev": "1-6e192e3f87447ec187052941cf365071", "price": "950", "shop": "shop1" } i have created view "shop" check products/cars have @ 1 of 3 shops: function(doc) { emit(doc.shop,{product:doc._id}); } reduce function function (key, values) {return (values);} now receive same uri did this: ...\curl -x .../list/_design/shop/_view/shop?key="shop1" why doesn't work? questions like: ...\curl -x .../list/_all_docs works views why can't result view? if function above have written, it's invalid javascript view crash , return nothing. need quotes around product .

xaml - DataGridTemplateColumn Sorting capabilities Telerik RadDataGrid Windows 8 -

normally sorting capabilty ( little triangle in column header + functionality on header click ) comes out of box if using "typed" column, setting propertyname property model. example work datagridtextboxcolumn. but, if have use custom columns enter datagridtemplatecolumn not have propertyname property. question: how can achieve "easy" sorting on such column. should easy setting "sortingmemberpath" , that's it. do need subclass "typed" column , create own datagridcombboxcolumn, example ? you can achieve desired functionality implementing columnheadertapcommand , adding / removing necessary sortdescriptors manually. more information datagrid commands can found here . glyph in column header can shown through column.sortdirection property. also, suggested approach suitable , in future intend extend current logic allow sortdescriptors use mapping in templated columns. best regards, ivaylo

Hibernate + MySQL. Ways to optimize selecting and loading data -

i'd test how selecting , loading data in java application using hibernate , mysql can optimized. i divided results found 2 groups mysql indexes - sure stored procedures - there difference if select done in stored procedure? views - there difference if select definition kept in view? query cache - work if same select second time? hibernate hibernate cache - similar query cache? how can configured? lazy loading - can help? are there other ways? use simple queries several joins , aggregation functions. need demonstate time changes between "before" , "after" optimization. for more information tried read this , language complicated me. batch fetching important when read e.g. collection. in case hibernate can many rows of collection in 1 sql request, faster. hibernate caching solution (read ehcache instance) can store retrieved data on memory , if nothing changes on side can retrieve without asking sql engine what's going o

Changing winform style in C# -

okay, of may familiar krypton toolkit component factory. if not, check out here . anyways, can change form style using toolkit opening designer code form , changing line: inherits system.windows.forms.form to this: inherits componentfactory.krypton.toolkit.kryptonform that visual basic though. achieve using c#. in form's code-behind file instead of this: public partial class form1 : form type this: public partial class form1 : componentfactory.krypton.toolkit.kryptonform note, isn't changing of form's style, changing of base class. open code-behind, should press f7 in designer default.

performance - How to use the variable that I create in jquery -

var appthour = $('select[name="ctl00$m$g_20abfee5_53b6_4db3_b243_ae9b79cab374$ctl00$ctl05$ctl09$ctl00$ctl00$ctl04$ctl00$ctl00$datetimefield$datetimefielddatehours"]').val(); var endhour = $('select[name="ctl00$m$g_20abfee5_53b6_4db3_b243_ae9b79cab374$ctl00$ctl05$ctl11$ctl00$ctl00$ctl04$ctl00$ctl00$datetimefield$datetimefielddatehours"]').val(); $('appthour').blur(function() { $('endhour').val($(this).val()); }); this doesn't seem work. tried , still doesn't work. $appthour.blur(function() { $endhour.val($(this).val()); }); thanks actually appthour , endhour elements. do appthour.blur(function() { endhour.val($(this).val()); }

ios - MagicalRecord date parsing -

i've got date in following format: 2013-05-04t05:07:09+00:00 i'm using magicalrecord map nsdate automatically. far can see above date format should comply magicalrecord's default date format: yyyy-mm-dd't'hh:mm:ss'z' . i have tried custom dateformat entry in attribute's user info (see this article ): yyyy-mm-ddthh:mm:ss+z , yyyy-mm-dd t hh:mm:ss z , yyyy-mm-dd't'hh:mm:ss'+'z but none of them work in order have parse date , returns nil regardless of setting custom dateformat or using magicalrecord's default format. let's @ string: 2013-05-04t05:07:09+00:00 this is: four digit year hyphen zero-padded month hyphen zero-padded day of month 't' character zero-padded hour ':' character zero-padded minute ':' character zero-padded second timezone (with direction gmt , separating colon) thus, according the date format specifiers documentation , pattern you'd want

c++ - QGraphicsWidget's mouse drag. -

Image
how implement mouse draging on qgraphicswidget? i tried with setflag(qgraphicsitem::itemismovable); and works sometime (?) for example, node 6 can move mouse, rest of nodes wont move. also, how can implement when move node, edge attached node move it. the real reason may have not provided override of shape() function. function used define "collision" geometry: parts of object can click on. if inherrit qgraphicsitem directly, seems work fine without providing definition, qgraphicswidget overrides shape() function , returns qwidget::rect() (which may not defined in class), default implementation qgraphicsitem isn't being used anymore when inherit qgraphicswidget ! if provide definition of shape function returns ellipse surrounds circle draw node, bet might start working. example: qpainterpath mygraphicswidget::shape() const { qpainterpath path; path.addellipse(qpointf(0, 0), 25, 25); return path; } this may old question, spen

MySQL Count values in a column, Update and replace value which has a limit amount -

i have problem mysql update statement. have more 100.000 entries in table. approaches not successful. (see below) first, want count number of values (thats easy): select values1 ,count(values1) table group value1 having count(value1) <= 1000; second, want replace values of column values1 appears <= 1000 times. so tried these statement: update table t set t.value1 = "limitamount" exists (select value1 (select * table) f group f.value1 having count(f.value1) <= 1000); when tried sql statement, received: error code 1205. lock wait timeout exceeded. try restarting transaction. try this update table t set t.value1 = "limitamount" exists (select value1 (select * table) f f.value1 = t.value1 group f.value1 having count(f.value1) <= 1000); notice where f.value1 = t.value1 condition in subquery

node.js - Run NodeJS event loop / wait for child process to finish -

i first tried general description of problem, more detail why usual approaches don't work. if read these abstracted explanations go on. in end explain greater problem , specific application, if rather read that, jump "actual application". i using node.js child-process computationally intensive work. parent process it's work @ point in execution reaches point must have information child process before continuing. therefore, looking way wait child-process finish. my current setup looks this: importantdatacalculator = fork("./runtime"); importantdatacalculator.on("message", function (msg) { if (msg.type === "result") { importantdata = msg.data; } else if (msg.type === "error") { importantdata = null; } else { throw new error("unknown message datagenerator!"); } }); and somewhere else function getimportantdata() { while (importantdata === undefined) { // wai

Zend framework2 email validation for specific address like for gmail and to block a specific email address -

i have input filter email address , want restrict specific email service provider, please me out this. i have 1 more form , want allow restricted email service provider registered here. please tell me how can restrict 1 particular email service provider , in form allow 1 specific email service provider. thanks in advance $inputfilter->add($factory->createinput(array( 'name' => 'email', 'required' => true, 'filters' => array( array('name' => 'striptags'), array('name' => 'stringtrim'), ), 'validators' => array( array( 'name' => 'emailaddress', 'options' => array( 'messages' => array( 'e

performance - Android adding image to app, makes it slow -

i have imagebutton, when click it gives me alertdialog add image imagebutton. when add image, app becomes slow , laggy. if want reselect image app crashes. can me out this? code: public class mainactivity extends activity { private final int select_file = 1; private final int request_camera = 0; private imagebutton btnimg; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); btnimg = (imagebutton) findviewbyid(r.id.btnaddthumbnail); btnimg.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { selectimage(); } }); } private void selectimage() { final charsequence[] items = { "take photo", "choose gallery", "cancel" }; alertdialog.builder builder = new alertdialog.builder(mainactivity.this); builder.settitle("add photo!"); builder.setitems(items,

provisioning - How to provision software using Vagrant without sudo -

i'm trying setup vagrant virtual machines support learning through seven databases in 7 weeks . i'm provisioning software using basic shell scripts performs appropriate actions within sudo environment. however, i'm using vagrant user run tutorials, , provisioning install appropriate node / npm modules vagrant, rather through sudo. my current npm command last line in provisioning script, module unavailable when vagrant tried execute node scripts. apt-get update apt-get -y install build-essential apt-get -y install tcl8.5 wget http://redis.googlecode.com/files/redis-2.6.0-rc3.tar.gz tar xzf redis-2.6.0-rc3.tar.gz cd redis-2.6.0-rc3 make make install make test mkdir /etc/redis mv redis.conf /etc/redis/redis.conf sed -i.bak 's/127.0.0.1/0.0.0.0/g' /etc/redis/redis.conf sed -i.bak 's/daemonize no/daemonize yes/g' /etc/redis/redis.conf sed -i.bak 's/dir .\//dir \/var\/lib\/redis/g' /etc/redis/redis.conf cd src/ wget https://raw.github.com/gist/105

arduino - Leonardo: Gets detected in Device Manager but then gets disconnected -

an arduino leonardo gets detected in device manager , gets disconnected. so, doing. connecting arduino leonardo laptop. gets detected in device manager (i have updated driver well). however, hear beep , leonardo gets uninstalled. if push 'reset' button gets detected again. however, after few seconds gets disconnected again. device manager displays message currently, hardware device not connected computer. (code 45) note: working fine couple of weeks ago. using windows 7. looks problem whit soft-reset of leonardo, normaly whe connect leonardo, appears on device manager ard...bootloader(comx), few seconds , leonardo appears in different com port. know, in case after dessappear. try select port in arduino ide, have try load sketch blink.ino, , press reset button @ same time, when sketch beginning uploaded release de reset, tha works me,

fxml - Using custom javafx label doesn't work -

ok i've created own customer label, example it's extremely basic. did extend javafx label in custom class called mylabel. i'm using fxml create gui. when can't seem instantiate custom class error. "can not set net.blacksquirreldevs.tests.mylabel field net.blacksquirreldevs.tests.samplelabelcontroller.samplelabel javafx.scene.control.label" here code everything main.java package net.blacksquirreldevs.tests; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.scene.scene; import javafx.scene.layout.anchorpane; import javafx.stage.stage; public class main extends application { @override public void start(stage primarystage) throws exception { primarystage.settitle("samplelabel"); anchorpane anchorpane = (anchorpane) fxmlloader.load(getclass().getresource("samplelabel.fxml")); primarystage.setscene(new scene(anchorpane)); primarystage.show(); } public static void main(string..

xslt - Get only elements that are not repeating in an XML -

i have scenario xml doc contains nodes repeating. want rid of such nodes. please note not " removing duplicates ". want remove entries of nodes occuring more once. ex xml <readuserobsresponse> <userobs> <obsobjectid>1510</obsobjectid> <userobjectid>443</userobjectid> </userobs> <userobs> <obsobjectid>540</obsobjectid> <userobjectid>514</userobjectid> </userobs> <userobs> <obsobjectid>1521</obsobjectid> <userobjectid>514</userobjectid> </userobs> <userobs> <obsobjectid>547</obsobjectid> <userobjectid>544</userobjectid> </userobs> </readuserobsresponse> desired output : want remove both entries userobjectid 514 <readuserobsresponse> <userobs> <obsobjectid>1510</obsobjectid> <userobjectid>443</userobjectid> </userobs> <userobs> <o

r - Fiting 2-parameters weibull distribution for tabulated data -

Image
i'm trying adjust weibull distribution 1 tabulated data. after process point cloud, columns number of returns each 1-meter slices of height. example: a = matrix(c(7,12,10,10,20,3,15,40,33,57,58,60,79,132,174,201,191,184,115,70,22,2,0),1,23) colnames(a) <- c(13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5) in example above, height class center 13.5 meters has 7 points inside. if plot matrix possible visualize data distribution: barplot(a) does have suggestion how fit weibull 2-paramters tabulated data? thanks in advance! you maximum likelihood on censored data. a = matrix(c(7,12,10,10,20,3,15,40,33,57,58,60,79,132,174,201,191,184,115,70,22,2,0),1,23) colnames(a) <- c(13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5, 28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5) centers <- as.numeric(colnames(a)) low <- centers - .5 <- centers + .5 ll

linux - Is pm.max_children in php-fpm equal to the maximum number of parallel downloads? -

i'm preparing web server (gentoo linux, nginx, php-fpm, php) website. during configuration came pm.max_children value in fpm config. default 50. if plan serve big files php, each client block whole thread during download? happen 51st client trying open website / start download? according i've read - 1 child = 1 thread. if run server on let's quad core newest series xeon cpu 32gb ddr3 - how many clients or threads cpu / system survive? is there limit in linux of maximum open sockets / threads / processes? os gentoo amd64 (fresh installation), nginx 1.4.0, php-5.4 thanks help. if stream files via php, yes, each download php process. why it's bad idea so. php should used process data comprehensible webpage. serving files webserver. perhaps can rewrite application generate unique files , redirect location , have webserver handle it. number of open sockets configured via limits on per process basis. sockets count towards number of open files.

java - Webstart Chrome After 100th Download -

Image
we have java application our customers launch via webstart. have usability problems : up hundred clicks on link jnlp file, "chrome" downloads jnlp file, names incrementally : index(1).jnlp, index(2).jsp, etc. , launces application. after 100 downloads, when user clicks on link, chrome opens "save as" dialog. user clicks on save; , chrome asks "this file exists, want replace it?" , user says yes, , chrome downloads jnlp etc. this process creates usability problems. avoid started changing name of jnlp file regularly. when users click on new jnlp link first time, chrome asks "this type of file can harm computer. want keep .......jnlp anyway?" before downloading file. , creates step of clicking button. , of course scares user. in spite of chrome's problematic handling of issue, firefox smoothly continues incrementing file name number after 100. how can solve problem chrome, without asking user complicated adjustments in computers?

python - Tkinter Calculator Bug -

i making simple python tk calculator, there bug: calculator won't work unless push 1 of buttons before numbers put in when diplays error says "enter numeric values!" after calculate input numbers if open , input numbers won't work here code: from tkinter import * import math def calculate(): try: num1 = float(enter1.get()) num2 = float(enter2.get()) result = num1 * num2 label3.config(text=str(result)) except valueerror: label3.config(text='enter numeric values!', fg="white") def calculate2(): try: num1 = float(enter1.get()) num2 = float(enter2.get()) result = num1 / num2 label3.config(text=str(result)) except valueerror: label3.config(text='enter numeric values!', fg="white") def calculate3(): try: num1 = float(enter1.get()) num2 = float(enter2.get()) result = num1 + num2 label3.config(text=s

c - input from fgets not stored using sscanf properly -

so have small part of code (basically input whole program). it has take form of string @ 20 characters, , 2 integers separated space. eg master 1 1 int main(void) { int i, x, y; char input[28]; char* name = null; fgets(input, 28, stdin); sscanf(input, "%s %i %i", name, &x, &y); printf("%s %i %i\n", name, x, y); return 0; } basically i'm trying print out see if program storing input correctly, has stored in linked list later on. everything worked fine, no matter type, prints out (null) 0 4196064. seg faults if put , ampersand infront of name in sscanf() function well. any ideas on how fix appreciated! sscanf not allocate storage string. char name[28]; will work. &name causes seg.fault, because differs in levels of indirection. pass char * * , interpreted char * inside sscanf. name variable on stack, &name points stack, sscanf overwrite stack content. can result in seg.fault.

php - I'm getting a syntax error...Any help, i would greatly appreciate it -

<?php require_once 'cn.php'; include_once("../php_includes/check_login_status.php"); $fiveminutesago = time() - 600; $sql = 'select username, message_content, message_time messages message_time > ' . $fiveminutesago . ' order message_time'; $query = mysqli_query($db_connections, $sql) or die(mysql_error($db_connections)); while ($row = mysql_fetch_assoc($result)) { $hoursandminutes = date('g:ia', $row['message_time']);{ echo '<p><strong>' . $row['username'] . '</strong>: <em>(' . $hoursandminutes . ')</em> ' . $row['message_content'] . '</p>'; } ?> replace $hoursandminutes = date('g:ia', $row['message_time']);{ with $hoursandminutes = date('g:ia', $row['message_time']); have opening brace in middle of nowhere. also replace while