Posts

Showing posts from July, 2014

javascript - multiple .on events AND detecting keypress -

i run function this: $(document).on('change, focusout', '.something', function(){ ... } i handler execute when keypress == 13. what's best approach? do if statement $(document).on('change focusout keypress', '.something', function(e){ if(e.keycode == 13 ) { //code here } });

php - Obtaining categories and subcategories joined from Mysql tables -

i have 3 tables. 1 table called places , table holds different places (such businesses, restaurants, etc...) each "place" linked table called categories , categories have subcategories in hierarchical structure (i.e. thai food subcategory of restaurants). system lets admin create places , matches them corresponding category or subcategory. what know best way obtain these relations? using joins , group_concat still not getting result set. these tables: places: +----+----------------+ | id | name | +----+----------------+ | 1 | mings place | +----+----------------+ | 2 | halsey library | +----+----------------+ | 3 | stellas uso | +----+----------------+ places_categories_rel : +----------+-------------+ | place_id | category_id | +----------+-------------+ | 1 | 2 | +----------+-------------+ | 2 | 4 | +----------+-------------+ | 3 | 3 | +----------+-------------+ | 3 | 4 |

algorithm - Given an array of ranges find the total distance covered? -

here interview question heard about. have range of arrays elements length 2 arrays starting point , end point on number line. there can overlaps. need return total distance covered. how solve this? example: input: [[3,5], [1,3], [2,4]] output: 4 my thoughts: you'd need keep track of ranges covered , if value in particular range. not sure how though? here implementation. since every range has min value , max value (|min|------|max|) if have sorted list , can find distance wasn't covered subtracting current min last max. if value negative, know no difference found between 2 ranges. don't have include range, store new maximum. import java.util.arraylist; import java.util.hashmap; public class main { public static void main(string[] args) { //given sorted array index @ 0 // (equal array[0] sorted array[1]. //if array isn't sorted sort here arraylist<int[]> ranges = new arraylist<>(); ranges.a

c++ - String pointer manipulation -

i have assignment @ school. string pointer passed function , returns 2 const strings different functions. 2 new strings divide original string 2 parts based on space. example: input str = 05/12 hello desired output key = 05/12 satdata = hello this code wrote giving me errors. please help void rbapp::processinsert(string &str) { string *key = new string(); string *satdata = new string(); int = 0, j =0; while(str[i]!=" ") { key[j] = str[i]; i++; j++; } j = 0; while(str[i]!='\0') { satdata[j] = str[i]; i++; j++; } myrbt.rbinsert(key, satdata); } using stringstream void rbapp::processinsert(const std::string &str) { std::stringstream ss(str); std::string key; std::string satdata; ss >> key; ss >> satdata; myrbt.rbinsert(key, satdata); }

javascript - Error in Rails with JS code -

Image
rails not let me run js code, have these errors 1) 2) whenever add js code, errors appear. idea why happening? just because you're getting error highlights in ide, doesn't mean code wrong. try running server, navigate site browser, , check developer console. still see javascript errors?

c# - ToArray doesn't seem to be working Moq's Verify method -

i'm trying verify method call using moq following code. var _payload= new list<keyvaluepair<string, object>> { new keyvaluepair<string, object>("test", testnum), new keyvaluepair<string, object>("firstruntime", datetime.parse("19-apr-2001 09:30:00")) }; the above list definition common both following pieces of code. i'd tried this:: mockmessageprocessor.verify(service => service.queuemessage( datetime.parse("19-apr-2016 10:05:00"), "testjobkey", _payload.toarray()), times.once); this fails saying there no invocation of above method parameters. putting same thing in variable works. var payloadarray = _payload.toarray(); mockmessageprocessor.verify(service => service.queuemessage( datetime.parse("19-apr-2016 10:05:00"), "testjobkey", payloadarray), times.once); the above verify works. wanted know why happening. quoting aro

ios - No method declared with Objective c selector 'scale' -

i'm following stanford lecture on ios development. want create pinch gesture can enlarge or reduce size of smiley face. here original code: faceview.addgesturerecognizer(uipinchgesturerecognizer(target: faceview, action: "scale:")) however, xcode complained " no method declared objective c selector 'scale' ". i followed suggestion replace "scale:" selector("scale:") still display same error message. i did bit of research online , found out swift 2.2, syntax selector has changed #selector(myclass.methodname) , changed line of code faceview.addgesturerecognizer(uipinchgesturerecognizer(target: faceview, action: #selector(faceview.scale))) this time, no error message displayed, when run project , tried enlarge or reduce smiley face in simulator, not change size @ all. seems changed since last release. you have been suggested use #selector(myclass.methodname) documentation correct syntax in case of stanford

jsp - Request.getParameter() method not working -

i creating website , having trouble in retrieving value textbox. having login page in user inputs username. have take value textbox , send login.jsp request.getparameter() method takes value of textbox. guess request.getparameter() not working.please me in pointing mistake. here code <!doctype html> <html> <head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="login.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style> .center{ margin: auto;

After creating file using java, there were no values in it -

i have created file using java, following code string filecontent= "hei"; creating file printwriter writer=new printwriter("d://balanworkspace//coretest//corejavatest//src//intvquestest//mydet3_8.txt","utf-8"); printing string system.out.println(filecontent); writing file writer.println(filecontent); when opened file, there no values. why so? you need close printwriter doing this: writer.close();

html - Hover moving other elements to the right -

whenever mouse hovers 1 of long <li> elements other elements move right. here's fiddle link : .footer_links{ margin-top:60px; } footer .ourservices{ display: inline-block; float:left; margin: 0px -10px 0px 77px; } footer .ourservices ul li,a,h3{ text-decoration: none; color:white; list-style: none; } footer .ourservices .columns_title{ text-transform: uppercase } footer .ourservices .columns_title{ margin-bottom:17px; font-size:23px; font-family:raleway-regular; font-weight:lighter; } footer .ourservices ul li, h3{ margin-bottom:8px; font-size:12px; } footer .ourservices ul li{ margin-top: 10px; } footer ul li:hover{ font-family: 'open sans'; font-weight:bold; } <div class="footer_links"> <div class="ourservices"> <h3 class

Can I take solar panel's output as an input to Arduino -

for project of mine want build smart street lamp. wanted use solar panel in order reduce usage of electrical energy, i'm using arduino uno r3 there way can turn on whole system when don't output solar panel? , vice versa. thank you. you can surely use solar panel input arduino, can use solar module(safe use) or directly connect arduino input (a0,a1,a2.....etc) , program using arduino. and use solar intensity raw material turning system on hope helps.

c++ - Android native libc signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr -

i've been experiencing crash after adding following code: class audiopolicyservice : public binderservice<audiopolicyservice>, public bnaudiopolicyservice, public ibinder::deathrecipient { friend class binderservice<audiopolicyservice>; //[....] class testingclz : public virtual refbase { public: testingclz (string8 name, const wp<audiopolicyservice>& service){} virtual testingclz() {} }; sp<testingclz> mtestingclz; } // end of class audiopolicyservice //[....] void audiopolicyservice::onfirstref() { ... testingclz = new testingclz(string8("test"), this); } i got following crash: 02-03 22:21:17.971 367 367 f debug : revision: '0' 02-03 22:21:17.971 367 367 f debug : abi: 'arm' 02-03 22:21:17.971 367 367 f debug : pid: 981, tid: 981, name: mediaserver >>> /system/bin/mediaserver <<< 02-03 22:21:17.

Alter retention.ms property for kafka topic deletes the old data -

i trying change retention.ms property existing topic, per analysis deletes existing data inside topic. scenarios:- topic name "topic1" retention 5 mins , contains data. use case 1 - change retention higher period change retention.ms value 8 mins using below command:- bin/kafka-topics.sh --alter --zookeeper localhost:2181 --topic topic1 --config retention.ms=8 but deletes old data topic. after pushed more data topic. use case 2 - change retention lower period change retention.ms value 3 mins using below command:- bin/kafka-topics.sh --alter --zookeeper localhost:2181 --topic topic1 --config retention.ms=3 it deletes previous data topic. could please tell me exact behavior same. any tips appreciated! retention.ms property in kafka takes milliseconds. changing retention period 8 , 3 milliseconds respectively. have give 480000 if want set 8 mins retention period.

multithreading - Oval collision method never called - Java Swing -

i need calculate 2 ovals collision in java swing mini game. i have jpanel draws arraylist of balls thread 's , player ball. in run() method of non player balls check collision between player ball , balls thread arraylist . the problem collision method never executed. it's not getting collision if statement. never calls method. ball.java : public class ball extends thread { int x; int y; int velocity = 1; public int radius = 20; public boolean directionx = true; // true - right, false - left public boolean directiony = false; // true - up, false - down public static final int y_starting_position = 0; public static final int x_starting_position = 0; public ball() { switch (this.getstartingside()) { case 0: // left { this.directionx = true; this.directiony = true; this.x = this.getrandomheight(); this.y = this.getr

white background and black text color on android wear app -

in android wear app need change default black background white , text color black. in order not set colors each time create new layout file, created theme defines background , text color , applied main layoutfile the layout file: <?xml version="1.0" encoding="utf-8"?> <android.support.wearable.view.watchviewstub xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/watch_view_stub" android:layout_width="match_parent" android:layout_height="match_parent" app:roundlayout="@layout/round_activity_wear" app:rectlayout="@layout/rect_activity_wear" tools:context="com.example.wear.wearactivity" tools:deviceids="wear" style="@style/apptheme"> </android.support.wearable.view.watchvie

java multithreading : traffic intersection system -

i trying use multithreading in java having 2 threads, 1 of threads represents car travelling 1 way through intersection, other represents car waiting travel through intersection. problem car2 prints out "car2 waiting cross" more times should(it should print 6 times). have tried using syncronization doesnt work. pretty simple programme im trying make myself understand multithreading, shown below. public class drive { public static thread car1; public static thread car2; public static void main(string[]args){ cars cars = new cars(); car1 = new thread(cars, "car 1"); car2 = new thread(cars, "car 2"); car1.start(); car2.start(); } } public class cars implements runnable{ int distance = 0; public void increasedistance(){ distance ++; } public void race(){ while(distance <= 5){ if(thread.currentthread().getname().equals("car 1")){

.net - Format Numeric Strings -

i want format integer appears 1000's separator (,) my attempts far have been: string.format("{0:#,###.##}", 1234.0); // 1,234 string.format("{0:#,###.##}", 1234.05); // 1,234.05 string.format("{0:#,###.##}", 1234); // 1,234 i struggling display values output 1,234.0.. please suggest me how output string 1,234.0 ?? the way understand question: you want thousand separator every 3 digits on integer side you want 1 digit on fractional side additionally, guess that you want @ least 1 digit on integer side the problem format strings you're using you're using # specify digit positions. according documentation , character means: replaces "#" symbol corresponding digit if 1 present; otherwise, no digit appears in result string. (my emphasis) on other hand, 0 character: replaces 0 corresponding digit if 1 present; otherwise, 0 appears in result string. (again,

security - Using aircrack on Windows to Crack my WPA -

i'm new hacking , security in general. wanted learn few things i'm trying break wifi using wpa security. i've been googling , trying find way windows. found has been helpful tutorial: https://www.youtube.com/watch?v=tabs_-uqhjq i've downloaded older aircrack version (aircrack-ng-1.0-rc3-win) , comm wifi in video. ran comm wifi , have packets have handshake protocol this: eapol-key(4-way handshake me... when insert packet log aircrack gui along wordlist. error saying there no handshakes when in log there several handshakes. used .pcap file aircrack website (along same password list) , aircrack works fine .pcap file. i've compared .pcap file mine , don't see difference between them besides obvious essid's , bssid's , other small details looks same type of handshake packets there. i'm new , understand windows not best os hacking feel i'm pretty close. have suggestions next? there way fix problem? i prefer use kali 2

string - Java - store current date WITHOUT TIME into a Text file -

this question has answer here: how convert current date string in java? 9 answers i need help. have searched , tried every example use, none have worked. i need store current date in yyyy-mm-dd format in text file..the string date has string.. string datef = "yyyy-mm-dd"; date dateonly = new date(); simpledateformat dateformat = new simpledateformat(datef); string date = dateformat.format(dateonly); when tried code above.. output got please|work|2016-04-110|11 please me...this assignment due friday ): need date , 2 other things done.. :) format being used incorrect. yyyy-mm- dd : capital dd return day in year. so, 11 april corresponds 110th day in year. yyyy-mm- dd : small dd return day in month. refer: https://docs.oracle.com/javase/7/docs/api/java/text/simpledateformat.html

Recursive XAML binding data templates on the Universal Windows Platform -

so have class task has couple of properties , can have list task objects ( child tasks ) inside it. recursively display each tasks , sub-tasks on 'uwp'. apparently 'wpf' had special 'usercontrols' purpose according post: are recursive datatemplates possible? but don't seem available on 'uwp'. you can use treeview control. here links project: nuget:winrtxamltoolkit , github:winrtxamltoolkit . install in project using package manager console: install-package winrtxamltoolkit.uwp i've made basic demo requirement. see codes below: mainpage.xaml: <page x:class="treeviewsample.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:treeviewsample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006&q

symfony - Twig: Unknown "localizednumber" filter -

when applying twig filter "localizednumber", following error thrown: unknown "localizednumber" filter in mybundle:home:home.html.twig @ line 558. i have installed twig extensions php intl. what issue here? did declare intl extension in services? if not, add this: <service id="twig.extension.intl" class="twig_extensions_extension_intl"> <tag name="twig.extension" /> </service> in app/config/services.xml .

backbone.js - Dynamic sort in backbone collection not working -

so have basic backbone collection , model. not have view i'm rendering collection through custom template. i'd sort collection through event (clicking on column header). event sets new comparator, , fires .sort() method on collection. however, when dump collection data after .sort(), collect in same order. i'm new backbone , collections, perhaps i'm missing something. here's code: var ticketcollection = backbone.collection.extend({ model : ticketmodel, initialize : function() { }, fetch : function(options) { options = options ? options : {}; var self = this; $.ajax({ url : "/gettickets", data : {}, method : "post", cache : false, datatype : "json", success : function(json) { self.reset(json); }, complete : options.complete }); }, render : function()

java - ProcessBuilder delete and rename -

i having processbuilder should delete file.txt , rename newfile.txt . problem both files deleted. idea why , how fix? public class myprocessbuilder { public static void main(string[] args){ final arraylist<string> command = new arraylist<string>(); // create files file file = new file("file.txt"); file newfile = new file("newfile.txt"); try{ if(!file.exists()) file.createnewfile(); if(!newfile.exists()) newfile.createnewfile(); } catch(exception e){} // force remove file.txt command.add("rm"); command.add("-f"); command.add("file.txt"); // rename newfile.txt file.txt command.add("mv"); command.add("newfile.txt"); command.add("file.txt"); final processbuilder builder = new processbuilder(command);

is it possible to install a module from a theme to a different theme in prestashop? -

i have 2 themes in prestashop , install module theme1 theme2? possible? want pointing start..i installed module doesn't appear in front of website. your module might hooked column or container not displayed on theme. you should check module code , find hooked , checked hook exist in theme. (for example left , right columns).

c# - Xamarin Forms device orientation -

im working on forms app , im wondering if me device orientation , rotation. basically @ moment have 3 rows of image buttons. want when device rotated landscape, of buttons displayed on 1 horizontal line instead of 3 vertical rows. what best approach this? know in android create xml layout file , reference that, there similar way in xamarin forms , xaml? i provide mainpage.xaml below: <?xml version="1.0" encoding="utf-8" ?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:class="myapp_crossplatform.views.mainpage" title="app" backgroundcolor="white"> <contentpage.content> <stacklayout padding="10" verticaloptions="fillandexpand" horizontaloptions="fillandexpand" orientation="vertical"> <!--main container layout--> &l

java - How can i get the value from a textclock -

in app have textclock displaying current hour , want when click button value textclock , put in string variable. have this: textclock time = (textclock) findviewbyid(r.id.horas); horas = time.gettext().tostring(); and in layout textclock this: <textclock android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/horas" android:textsize="30dp" android:layout_below="@+id/space2" android:layout_centerhorizontal="true" /> but returns empty value. this should do: time.getformat12hour(); or: time.getformat24hour(); you have working clock this: image shows working digital clock matches system time

php - Laravel 5. Query from a existing model instance? -

now model properties filled except one. so want make search in database , see if there registry matches properties values, in case, last property value , keep it. now im doing query wit query builder, giving this: $query->model::select()->where(field, $instance->field); $query->where(field2, $instance->field2); ... $query->get(); but want know if there way make shortcut like... $instance->get(); yes can defining method in model this class yourmodel extends model { public function getfiltered() { return model::where('field1',$this->field1)->where('field2',$this->field2)->get(); } } and can access this: $instance->getfiltered(); you cannot keep function name 'get' because it's being used in model being extended. can change getfiltered not used. if model user , function getfiltered gives user's comments can comments.

shell - How to get directory path to a batch file when right click in inside folder background? -

file.reg windows registry editor version 5.00 [hkey_classes_root\directory\shell\xfiles] @="文件命名操作(&a)" "noworkingdirectory"="" [hkey_classes_root\directory\shell\xfiles\command] @="cmd.exe /c c:\\bat\\file.bat %1 \"%v\"" [hkey_classes_root\directory\background\shell] [hkey_classes_root\directory\background\shell\xfiles] @="文件命名操作(&a)" [hkey_classes_root\directory\background\shell\xfiles\command] @="cmd.exe /c c:\\bat\\file-bg.bat %cd% \"%v\"" file.bat @echo off set handledir=%1 if "%handledir%"=="" exit /b echo %handledir% rem ... file-bg.bat @echo off set handledir=%cd% if "%handledir%"=="" exit /b echo %handledir% rem ... %1 , directory\shell , directory path on directory icon, %cd% , directory\background, directory path @ inside folder background.

c# - Twitter feeds against hashtag -

i fetching twitter feeds against hashtag fetching 1 feed. is true feeds of 7 days fetched only? below code: public string getsearch(string search, int count) { string resourceurl = string.format("https://api.twitter.com/1.1/search/tweets.json"); var requestparameters = new sorteddictionary<string, string>(); requestparameters.add("count", count.tostring()); requestparameters.add("q", search); var response = getresponse(resourceurl, method.get, requestparameters); return response; } twitter ensuring tweets returned if less 7 days old. if older 7~14 days returned. beyond 14 days can consider never receive of them. this reason why people tend use long running filter stream. filter stream send tweets matching specific criteria (for example hashtags) in live. have store in own database , index them access application. please aware if criteria attempt match represents more 1% of totals tweets sent on twitte

ios - hide a button on checking a condition while the app enters foreground -

i have hide button checking 2 particular viewcontroller's view descendant of present view.this being done when app comes foreground. code: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(applicationwillenterforeground) name:uiapplicationwillenterforegroundnotification object:nil] ; (void)applicationwillenterforeground { if(!([hrviewcontroller.view isdescendantofview:self.view] || [reportviewcontroller.view isdescendantofview:self.view])) { [self.thefavouritebutton sethidden:yes]; } } and problem ,eventhough view presented while coming foreground hrviewcontroller.view or reportviewcontroller.view,the control reaching inside if condition , hiding button.why so?

swing - My Menu in Java can't be Called Twice? -

i'm new java , programming in general, , writing program has menu in it. (it jframe in java) when hit jbutton, shows applet on screen. when applet done, goes screen can choose run applet again or go main menu when hit button. problem when hit button go menu, doesn't. make neither button clickable. method use draw menu: public static void drawmenu() { f.add(boption1); f.add(boption2); } the 2 jbuttons declared , such in constructor, , work fine first time run menu. then, when hit 1 of buttons, removes both buttons screen f.remove(...). know why won't work when call method second time? edit: sorry, meant canvas, not applet. edit edit: found solution problem, anyway. here code main class, frame: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class frame extends jframe { static oneplayer oneplayer; static twoplayer twoplayer; static frame f; static jbutton boneplayer = new jbutton("single player"

eclipse plugin - PyDev Jython - Install and import Python library -

i'm using jython script in runtime in plugin based on java in eclipse. when want use python libraries (py_expression_eval, example) on scripts, i'm doing is: 1) install library using easy_install in jython standalone (it installed in: c:\jython2.7.0\lib\site-packages\py_expression_eval-0.3-py2.7.egg) 2) copy folder py_expression_eval c:\eclipse\plugins\org.python.pydev.jython_4.5.5.201603221110\lib\site-packages 3) in script, before importing library, add folder above classpath using sys.path.append() is there way can install python library directly folder in classpath, import library? have in mind jython standalone has bin folder easy_install , pip, pydev.jython not.

sql server - database first change primary key from int to uniqueidentifier -

i trying change primary key in 1 of tables int uniqueidentifier. pointed out in title, taking database first approach using entity framework. the process took remove primary key table in sql designer , renamed column "itemid" "item". i created column named "itemid" , set uniqueidentifier type default newsequentialid(). then deleted column renamed "item" , set "itemid" primary key. i moved visual studio , did update model database gave me error error 1 error 2019: member mapping specified not valid. type 'edm.int32[nullable=false,defaultvalue=]' of member 'itemid' in type 'shoppingmodel.dbfruits' not compatible 'sqlserver.uniqueidentifier[nullable=false,defaultvalue=,storegeneratedpattern=identity]' of member 'itemid' in type 'shoppingmodel.store.dbfruits'. and here model under .tt directory public partial class dbfruits { public dbfruits() { thi

php - What does slug mean here? -

function your_function_name() { wp_enqueue_style('my-script-slug', get_stylesheet_directory_uri() . '/your_style.css'); } i saw on forum "my-script-slug", should write here ? don't understand... thanks ! the script slug name can pick yourself. used refer script in other situations, instance when declaring dependency.

java - Not able to compile Maven project due to dependencies.dependency.version is missing -

why error when try clean , compile maven project root folder? use top level pom defining dependencies in dependencymanagement element. want use in library projects. i have following maven project structure: pom library1 pom module1 pom module2 pom library2 module1 pom module2 pom from top level pom: <dependencymanagement> <dependencies> <dependency> <groupid>org.jboss.spec</groupid> <artifactid>jboss-javaee-6.0</artifactid> <version>1.0.0.final</version> <type>pom</type> <scope>provided</scope> </dependency> </dependencymanagement> library pom: <dependencies> <dependency> <groupid>org.jboss.spec</groupid> <artifactid>jboss-javaee-6.0</artifactid> </dependency>

javascript - jQuery focus not working in Chrome -

please see fiddle: http://jsfiddle.net/yg49k/ the following code works fine in firefox doesn't work in latest version of chrome. html: <input type="text" id="one" placeholder="type 2 chars" /> <input type="text" id="two" placeholder="it should focus here" /> jquery: $("#one").on("input", function() { if($("#one").val().length == 2) { $("#two").focus(); } }); does know how can around this? seems bug in chrome. fast execute events properly;) found workaround http://jsfiddle.net/rd2rz/ $("#one").on("input", function() { if($("#one").val().length == 2) { settimeout(function(){ $("#two").focus(); }, 1); } }); use settimeout minimal delay. slow down chrome , make work.

php - javascript phone validataion -

<?php //include db connection include("includes/config.php"); //include header include("includes/header.php"); ?> <?php //checks if form submitted if(isset($_post['submit'])) { //get form values when submitted $name=$_post['name']; $email=$_post['email']; $phone=$_post['phone']; $password=$_post['password']; $subject=$_post['subject']; $target_dir = "uploads/"; $target_file = $target_dir . time() . basename($_files["file"]["name"]); if (move_uploaded_file($_files["file"]["tmp_name"], $target_file)) { mysql_query("insert `login`(`name`,`email`,`phone`,`password`,`file`,`subject`)values('$name','$email','$phone','$password', '$target_file','$subject')"); echo "the file ". basename( $_files["file"]["name&quo

javascript - d3 updates new elements transition in -

i have barchart updating fine this: var bar=chart.selectall(".bar") .data(data); bar.enter().append("rect") .attr("class", "bar") .attr("x", function(d) { if(scale(d.values.total)<0){return width/2+widthdatelabel;}else{return width/2-scale(d.values.total)-widthdatelabel;}}) .attr("width", function(d) { return math.abs(scale(d.values.total)); }) .attr("height", barheight - 1) .attr("fill", function(d) { if(scale(d.values.total)<0){ return "deeppink"}else{return "mediumseagreen"}}) .attr("transform", function(d, i) { return "translate(0," + * barheight + ")"; }); bar.exit() .transition().duration(750) .attr("transform", function(d, i) { return "translate(0," + (i + 1) * barheight + ")"; }) .style("opacity", 0) .remove();

backbone.js - Backbone collection empty issue -

fetch: function() { var self = this; self.each(function(track) { if(track) { track.destroy(); } }); backbone.sync('fetch', this, { method: 'get', success: function(response) { if (response) { if(response.clips.length > 0) { spinneron(); (i = 0; < response.clips.length; i++) { self.loadcount++; self.loadfile(response.clips[i]); } } } } }); } on fetch above trying empty collection not emptying first record in collection ,the above sync operation loading saved datas database. from @try-catch-finally users comment writing , 100% work out. fetch: function() { var self = this; while(self.length) { self.at(0).destroy() } backb

Rails - ActiveAdmin - Filter another model -

i use rails 4.2.4, , activeadmin gem. i have 2 models. user model: email:string, password: string . user model has_one user detail. userdetail belongs_to user, have name:string . but, filter name in activeadmin.register user filter :name end i don't see name field. thanks. you have use appropriate filter associated model. can like: activeadmin.register user filter :user_detail_name end where name attribute of userdetail model. update: forgot mention activeadmin utilizes ransack search under hood. based on can use ransack 's syntax setup filters. here couple of resources prove helpful: https://www.viget.com/articles/activeadmin-filters-unlocking-the-power-of-ransack https://github.com/activerecord-hackery/ransack#associations

amazon ec2 - What's the difference between EC2 Community AMIs and Marketplace AMIs -

ubuntu certify cloud image ami-f95ef58a, , it's available community ami in region eu-west-1. see ubuntu documentation here centos on other hand publish official ami in aws marketplace cost of zero. see centos documentation here . in both cases there no charge. so left confused difference amazon intend care between community , marketplace? community amis: whenever create ami, can add permissions make public. in case, goes "community amis". these amis comes aws users, , not verified aws makerplace: whole service @ aws, , amis here verified aws. used software vendors sell products through aws. customers billed aws only, aws pay ami owner in return. centos bit particular, free distribution. been in marketplace conforts users ami safe

node.js - How do i avoid variable from getting printed on nodejs service console? -

how avoid local variable getting printed on nodejs service console? validation.js function gethash(){ var hash = []; hash = //some logic create hash return hash; } var hashtable= gethash(); exports.validaterequest= function(request, path, httpmethod){ var status= validate(hashtable,request); //some logic validate request using hashtable return status; } every time api call triggered, code invokes validaterequest method hashtable remains unchanged time. intend calculate hashtable once , re-use it. hence i'm using local variable gethash() called once during initialisation. this works fine far implementation concerned. problem when start node.js service, hashtable printed on service console below. how can rid of this? nodejs service console //code create hashtable function createhashtable() { var apis= require('../config/api.js'), apitable = []; (key in apis) { //some simple array split , value comparison operations apitable.pu

c# - mvc4 and display validation errors like tooltips -

i'm struggling find solutions should display mvc4 app validation errors inside razor view tooltip messages instead inline using span class. i rather not change validation logic keep existing mvc4 validation logic using model , it's dataannotations attributes. i've found this solution again requires adding additional script code inside razor page validation should done. if has advice or need further clarification of problem please address it. thank you update: i've found solution works nice although need 1 more adjustment, validation errors presented inside tooltip on mouse on control, how display on validation error (not on mouse hover)? please use validation engine js, works mvc validation, have add script line on page. https://github.com/posabsolute/jquery-validation-engine

Info.plist at wrong position building an Eclipse RCP MacOS bundle via tycho -

we have eclipse rcp product migrated use eclipse tycho/maven build distributions. have read tycho since 0.24 able include whole product distribution inside standard macos application bundle wanted use too. however, turns out info.plist @ wrong position inside created macos bundle. structure created is: ourapp.app contents eclipse the whole eclipse distribution eclipse.app contents info.plist macos the native launcher as understand discussions around feature should be: ourapp.app contents info.plist eclipse the whole eclipse distribution macos the native laucher so info.plist somehow put bogus "eclipse.app/contents" folder structure, , have no idea why. the tycho config inside our pom.xml: <plugin> <groupid>org.eclipse.tycho</groupid> <artifactid>tycho-p2-director-plugin</artifactid> <version>${tycho.version}</version> <execu

excel vba - XLS VBA VlookUp using RC from static to dynamic -

i trying create macro vlook-up. i have 2 sheets. managed make work vlookup hardcoded. can make dynamic? here code : option explicit sub vlookup4() dim nrcolsold, nrcolsnew integer 'numarul de celule in primul rand, incepand cu a1 sheet "old" si "new" dim foundold, foundnew range dim lrold, lrnew long dim cauta variant 'cauta = inputbox("filtru dupa ce coloana?") sheets("old").select activesheet nrcolsold = .cells(1, .columns.count).end(xltoleft).column ' calculeaza care e ultima coloana din sheet end 'set found = rows(1).find(what:=cauta, lookin:=xlvalues, lookat:=xlwhole) set foundold = rows(1).find(what:="numar", lookin:=xlvalues, lookat:=xlwhole) if foundold nothing exit sub lrold = cells(rows.count, foundold.column).end(xlup).row activesheet.range(cells(1, 1), cells(lrold, foundold.column + nrcolsold)).autofilter worksheets("o