Posts

Showing posts from September, 2014

php - AJAX chat without periodic refresh? -

i'm write ajax based chat. best way refresh chat box? know there few possibilitys best suited chat? additional: possible reload unread text? if writes text isn't nessecarry refresh whole content.the new message enough. can done ajax , php? have no idea how done. thankfull tipp ... thanks! the frequency of refresh , scope of content refresh independent. ajax, can ask server if new message arrived (based on timestamp), , append displayed content, don't have reload whole page. as 'periodic refresh' thing: can go either short polling or long polling. think 'periodic refresh' may refer short polling. timer, e.g. in every second server polled javascript there new data displayed. if yes, sends it, otherwise replies message indicating there no new content. whilst in long polling, server polled, , gives new content if has it. however, if there no new content, instead of giving immediate answer of 'no new content', keeps connection open, ,

javascript - slickgrid - How to loop through rows which are outside canvas? -

i having markers on map , same number of rows in slickgrid? what want when marker clicked id of marker matched rows , corresponding row should selected. here code: var $canvas = $(grid.getcanvasnode()); var $allrows = $canvas.find('.slick-row'); $($allrows).each(function() { if ($(this).rowid == selectedmarker) { $(this).addclass("active-row"); grid.scrollrowintoview($(this).index()); } }); it works fine when row want present in grid grid dom contains 8 rows @ time (the grid has 30 rows). how can loop through data? you shouldn't modifying slickgrid's dom @ all. slickgrid overwrite changes it's rendering rows in view (with buffer). when scroll past buffer changes made dom lost. you have change row's data , allow slickgrid add appropriate classes dom when it's rendering. edit : slickgrid setup: dataview.getitemmetadata = metadata(dataview.getitemmetadata); function meta

LLDB Error with Exponents on C++ -

i have updated calculator code, , adding exponent function. however, when try answer equation, error: (lldb) appreciated, first day c++! yep, that's all! here's code! #include <math.h> #include <iostream> int int1, int2, answer; bool bvalue(true); std::string oper; std::string cont; using namespace std; std::string typeofmath; int a; int b; int answerexponent; int main(int argc, const char * argv[]){ // taking user input, first number of calculator, operator, , second number. addition, substraction, multiplication, division cout<<"______________________________________________\n"; cout<<"|welcome expcalc! want |\n"; cout<<"|exponent math, or basic math(+, -, x, %) |\n"; cout<<"|type in 'b' basic math, and'e' |\n"; cout<<"|exponential math! enjoy! (c) john l. carveth|\n"; cout<<"|________________________________________

xaml - Custom WPF ComboBox doesn't show grouping -

i have created custom combobox in wpf <!-- combobox template --> <controltemplate x:key="customcomboboxtogglebutton" targettype="togglebutton"> <grid> <grid.columndefinitions> <columndefinition/> <columndefinition width="20"/> </grid.columndefinitions> <border x:name="border" grid.columnspan="2" cornerradius="3" background="{staticresource customdarkblue}" borderbrush="{staticresource customwhite}" borderthickness="2"/> <border x:name="border2" grid.column="0" cornerradius="3,0,0,3" margin="1" background="{staticresource custombackground}" borderbrush="{staticresource customwhite}" borderthickness="1,1,2,1"/> <path x:name="arrow" grid.column="1"

preg match - PHP preg_match using 'or' delimiter -

i'm trying match string of url using preg_match need match either 1 or other string , can't find correct syntax. what i'm using is: $is_url_en = preg_match ("/\b95\b/i", $iframeurl); this searches number "95" in url. want match "en" don't know how use 'or' delimiter. i've seen somewhere following: $is_url_en = preg_match ("/\b95\b/i|/\ben\b/i", $iframeurl); ...but doesn't work. hints please? don't repeat / , /i . delimit regex should there once. $is_url_en = preg_match ("/\b95\b|\ben\b/i", $iframeurl); you simplify to: $is_url_en = preg_match ("/\b(95|en)\b/i", $iframeurl);

c++ - Compare pointers by type? -

Image
how compare 2 pointers see if of same type? say have... int * a; char * b; i want know whether or not these 2 pointers differ in type. details: i'm working on lookup table (implemented 2d void pointer array) store pointers structs of various types. want use 1 insert function compares pointer type given types stored in first row of table. if match want add pointer table in column. basically want able store each incoming type own column. alternative methods of accomplishing welcomed. in case, since know types before hand, doesn't make sense check. can proceed knowing different types. however, assuming perhaps types may dependent on compile-time properties template arguments, use std::is_same : std::is_same<decltype(a), decltype(b)>::value this true if same type , false otherwise.

class - Cake PHP custom validation rule -

i got problem custom validation rule in cake 2.x i want check if entered zipcode valid , therefore function in class zipcode called class post. but validation returns false time. appmodel in class post (rule-3 it): 'deliveryarea' => array( 'rule-1' => array( 'rule' => array('between', 5, 5), 'message' => 'bitte eine fünfstellige postleitzahl eingeben' ), 'rule-2' => array( 'rule' => 'numeric', 'message' => 'bitte nur zahlen eingeben' ), 'rule-3' => array( 'exists' => array( 'rule' => 'zipexists', 'message' => 'postleitzahl existiert nicht!' ) ) ), appmodel in class zipcode: class zipcode extends appmodel { var $name = 'zipcode'; var $vali

php - Change array key without changing order -

you can "change" key of array element setting new key , removing old: $array[$newkey] = $array[$oldkey]; unset($array[$oldkey]); but move key end of array. is there elegant way change key without changing order? (ps: question out of conceptual interest, not because need anywhere.) tested , works :) $array = array( "a" => "1", "b" => "2", "c" => "3" ); function replace_key($array, $old_key, $new_key) { $keys = array_keys($array); if (false === $index = array_search($old_key, $keys)) { throw new exception(sprintf('key "%s" not exit', $old_key)); } $keys[$index] = $new_key; return array_combine($keys, array_values($array)); } $new_array = replace_key($array, "b", "e");

swing - Replacing user input keystrokes in real time (Java) -

Image
i trying write java program turn user input in real time asterisks (in order hide information, if user typing in password), have no clue how , i'm not sure terminology exactly. can me out? use jpasswordfield this.

scripting - Python is not opening .py files -

i'm trying open .py script on computer unfortunately keeps opening in notepad. i've tried changing associations on computer when browse python.exe , click it, won't show usable program (interestingly, pythonw.exe can associated nothing opens when click on file that's associated pythonw). there way can fix issue? if not, how can run script python interpreter hand? also, i've tried reinstalling python, , didn't help. the standard way of executing python script on windows calling python interpreter script name parameter on (dos) command line. necessary though path python.exe included in path system variable. python myprogram.py

sql server - Updating SQL database with classic ASP -

i have modify old asp page allow users update listed phone numbers, stored in sql 2005 database. code page looks incredibly heavy, apologise density. users enter name form , directed following result page: <h1>phone directory results detail</h1> <div class="subcontentstyles"> <br /> <% mm_telephone_string = "dsn=telephone;uid=sa;pwd=sapw;" %> <% dim telephone__varname telephone__varname = "%" if (request("fullname") <> "") telephone__varname = request("fullname") %> <% dim telephone__varjob telephone__varjob = "%" if (request("jobtitle") <> "") telephone__varjob = request("jobtitle") %> <% set telephone = server.createobject("adodb.recordset") telephone.activeconnection = mm_telephone_string telephone.source = "select ext, fullname, jobtitle, emailaddress, photo, extras, k

c - Finding unknown word in string -

i'm building simple menu , came doubt: user gonna have defined commands, example, entry "compact image < filename >.jpeg". how can filename , extension middle of string? if actual example of string need file name can: split string defining separator space take last position of split , take fileextension or period

java - Adding a cycle numbre to the name of an object -

i have code in java for (int j = 0; j < 8; j++) { boton[1][j].seticon(peonn); peon peonnegro = new peon('n'); boton[6][j].seticon(peonb); } this chess, want each new object have number of loop use independently without creating array, have like for (int j = 0; j < 8; j++) { boton[1][j].seticon(peonn); peon peonnegro+i = new peon('n'); boton[6][j].seticon(peonb); } so i'll have peonnegro0, peonnegro1 , on... you aren't going able without array or collection . (in java, quite difficult use dynamic variable name). you'll have declare array or arraylist outside of loop, shown below. peon[] peons = new peon[8]; (int j = 0; j < 8; j++) { boton[1][j].seticon(peonn); peons[j] = new peon('n'); boton[6][j].seticon(peonb); } // can access single peon peon p3 = peons[3]; // or iterate on peo

matlab - sorting cell array based on column (double not char) values -

i have 3x1 cell array includes: 10.2 15.2 7.2 and 3x1 cell array b includes: m l s i join these new 3x2 cell array c including: 10.2 m 15.2 l 7.2 v then want sort c according values of first column supposed be 7.2 v 10.2 m 15.2 l what did far follows: c=a; c(:,2)=b; c=sortrows(c,1); however result is: 10.2 m 15.2 l 7.2 v i think reason considers numbers in first column characters , way sorts them looking @ digits of each number 1 one left.. 10.2 less 7.2. looking way assign numbers numbers c when sort them considers them numbers not characters. tried use cell2mat when assigning , b c did not work. have searched web not find looking for. thank you! this need: >> c = cell(numel(a),2); [sorted_a, index_a] = sort(cell2mat(a)); c(:,1) = num2cell(sorted_a); c(:,2) = b(index_a); for example, input follows: >> = {10.2; 15.2; 7.2}; b = {'m'; 'l'; 'v'}; the result be: >> c c = [ 7.2000

c++ - Constructor Not Working -

i writing program show conway's game of life in c++. professor has given main function , class describing "universe", must implement functions prototyped in class. issue right getting constructor function. post class, followed have written constructor. using gdb when first line constructor used (universe(width, height, wrap);) following error: libc++abi.dylib: terminate called throwing exception program received signal sigabrt, aborted. 0x00007fff876fad46 in __kill () any appreciated! code below. // conways game of life class universe { private: int* array; // pointer [width]x[height] array of cells constitutes universe // game of life. value of 1 signifies live cell @ location. int width; // width of universe. int height; // height of universe int wrap; // wrap = 1 means universe wraps around on -- right hand // side connects left , top connects bottom. // wra

javascript - Uncaught Error: SecurityError: DOM Exception 18 Canvas -

function getbase64image(img) { var canvas = document.createelement("canvas"); canvas.width = img.width; canvas.height = img.height; document.body.appendchild(canvas); var ctx = canvas.getcontext("2d"); ctx.drawimage(img, 0, 0); var dataurl = canvas.todataurl("image/png"); return dataurl; } i seem violating something, can't seem find what. on how fix it? if image drew canvas id domain canvas tainted , cannot produce data uri ftom it. copy image on same domain script prevent this.

ios - iOS6 social framework bring up No Account Alert -

similar ios 6 social framework not going settings or no alert trying use slrequest: i trying bring alert "no facebook account" when user has not logged in facebook in settings. have found alert appear after present slcomposeviewcontroller, rather inside if statement. if([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { slcomposeviewcontroller *controller = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook]; //setup controller , callback code [self presentviewcontroller:controller animated:yes completion:nil]; } however, trying use slrequest , dont want present slcomposeviewcontroller, instead, after checking accounts, popup alert. code here: - (void)postimagefb { if([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { nslog(@"can post"); } else { nslog(@"cant post"); } acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccou

Android - Programmatically upload file to .NET server, with metadata -

i know question seems bit specific, have thought quite common scenario. goal here upload image (~8 mb) server. server runs .net (no php believe), not need upload file, need pass text information along it. how this? client , server code like? i used .net webservice upload database file. can use image upload. project link download demo. add these files in package. 1. outputstream.java package com.abhan.example; public class outputstream extends java.io.filteroutputstream { public final static int encode = 1; public final static int do_break_lines = 8; private final static int max_line_length = 76; private final static byte new_line = (byte)'\n'; private final static byte white_space_enc = -5; private boolean encode; private int position; private byte[] buffer; private int bufferlength; private int linelength; private boolean breaklines; private byte[] b4; private boolean suspendencoding;

IIS7.5 - Hosting ASP.NET MVC app and ColdFusion app under one domain -

we developing , deploying asp.net mvc app provide new functionality replace coldfusion app still need remain alive under same domain. how can set in iis? coldfusion app setup , functioning in iis already. need have few pages mvc app active well. have considered url rewrite there large number of urls consider. mentioned fiddling handlers. advice other rewriting rest of coldfusion app tonight welcome. thanks. after posting question on our team merged site code (coldfusion , asp.net mvc) , let iis handlers take care of running them both.

php - Sending mail from localhost when working on wifi connection -

what changes should in php.ini send mail localhost.i using college wifi. try , let me know error after tell changes need in php.ini <?php error_reporting(0); require_once "mail.php"; $from="from email"; //enter email of sender $to="recepient email"; //enter email $subject="subject"; $body="content"; $host="ssl://smtp.gmail.com"; $port="465"; $username="your gmail account user name"; $pwd="your gmail account password"; $headers = array ('from' => $from, 'to' => $to, 'subject' => $subject); $headers["content-type"] = 'text/html; charset=utf-8'; $smtp = mail::factory('smtp',

Limit order quantity by category or add additional shipping charge by category in Magento -

i have issue magento. i have category customers can buy 1 product category per order. have set settings such 1 item can added in product settings. however, if customer goes category, still able add product in category. selects product category a, can return category select product b. want @ times, order, can buy 1 product category a. if not possible, wish add additional shipping charge if more 1 product chosen category. does have solution this? see magento: limit 3 products category per order create observer event checkout_cart_product_add_after <events> <checkout_cart_product_add_after> <observers> <enableduplicateproductstatus> <type>singleton</type> <class>limitcartproductbycategory/observer</class> <method>cartlimit</method> </enableduplicateproductstatus> </obser

How to create adjacency matrix from grid coordinates in R? -

i'm new site. wondering if had experience turning list of grid coordinates (shown in example code below df). i've written function can handle job small data sets run time increases exponentially size of data set increases (i think 800 pixels take 25 hours). it's because of nested loops don't know how around it. ## dummy data x <- c(1,1,2,2,2,3,3) y <- c(3,4,2,3,4,1,2) df <- as.data.frame(cbind(x,y)) df ## here's looks image <- c(na,na,1,1) b <- c(na,1,1,1) c <- c(1,1,na,na) image <- cbind(a,b,c) f <- function(m) t(m)[,nrow(m):1] image(f(image)) ## here's adjacency matrix function that's slowwwwww adjacency.coordinates <- function(x,y) { df <- as.data.frame(cbind(x,y)) colnames(df) = c("v1","v2") df <- df[with(df,order(v1,v2)),] adj.mat <- diag(1,dim(df)[1]) (i in 1:dim(df)[1]) { (j in 1:dim(df)[1]) { if((df[i,1]-df[j,1]==0)&(abs(df[i,2]-df[j,2])==1) | (df[i,2]-df[j,2]==0)

serialization - C++ Serialize/Deserialize std::map<int,int> from/to file -

i have std::map. i know if can write file (and read file) in 1 line using fwrite, or if need write/read each value separately. i hoping since nothing special, might possible. use boost::serialization serialize in 1 line. header it: boost/serialization/map.hpp code example #include <map> #include <sstream> #include <boost/serialization/map.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> int main() { std::map<int, int> map = {{1,2}, {2,1}}; std::stringstream ss; boost::archive::text_oarchive oarch(ss); oarch << map; std::map<int, int> new_map; boost::archive::text_iarchive iarch(ss); iarch >> new_map; std::cout << (map == new_map) << std::endl; } output: g++ -o new new.cpp -std=c++0x -lboost_serialization ./new 1 for file use std::ifstream/std::ofstream instead of std::stringstream , may binary_archive , instead of text_ar

android - Dynamically change data of Custom PreferenceScreen -

Image
i working on custom preferencescreen , have created custom screen settings page using preferenceactivity . below preference screen. issue:- need change badge of download data dynamically. followed question achieve layout. tried answer of question not working single answer. is there other way find view inside preference? settings.xml <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android"> <preference android:title="@string/settings_user_profile" android:key="user_profile" android:summary="@string/settings_user_profile_desc" android:layout="@layout/setting_list"></preference> <preference android:title="@string/settings_download" android:key="download_data" android:summary="@string/settings_download_desc" android:layout="@layout/setting_list"></preference> </pref

java - How to automatically create a list for @SuiteClasses -

i need possibility run subset of junit tests cases during maven build process. i've decided use junit categories purposes. i've created 2 marker interfaces: unittest , integrationtest , assigned them bunch of junit test cases. need create test suite them: package ru.hive.parser; import org.junit.experimental.categories.categories; import org.junit.experimental.categories.categories.includecategory; import org.junit.runner.runwith; import org.junit.runners.suite.suiteclasses; import ru.hive.test.unittest; @runwith(categories.class) @includecategory(unittest.class) @suiteclasses({ someclass.class }) public class parsertestsuite { } the problem @suiteclasses annotation in need list classes want in test suite , have lot (more 100) of such classes , number growing. nice if have way build list of classes automatically. i've read question here on stackoverflow sort similar own, none of answers fit needs since need use @runwith(categories.class) instead of other tes

java - Double clicking on a file in FileTreeModel -

i comfortable java swing api. after googling sometime, have got below program working fine far. want is, on double clicking on file in tree, below function executed. can suggest me how can add listener understand double click event? example help. public boolean getsomedata(string filename){ //i make jdbc call here } my working program below, /*http://www.chka.de/swing/tree/filetreemodel.html */ import javax.swing.jframe; import javax.swing.jscrollpane; import javax.swing.jtree; import javax.swing.tree.treemodel; import javax.swing.tree.treepath; import javax.swing.event.treemodellistener; import javax.swing.event.treemodelevent; import javax.swing.event.eventlistenerlist; import java.awt.event.windowadapter; import java.awt.event.windowevent; import java.util.list; import java.util.arraylist; import java.util.map; import java.util.hashmap; import java.io.file; import java.io.serializable; import java.io.objectoutputstream; import java.io.objectinputstream; public c

wix - Add cancel header to the HyperlinkTheme.xml file -

is there way add cancel event header theme file, can configure user cancellation event , display appropriate message. far getting setup failed message if user cancelled installation or other failure occurred. you can control text on confirmation message box displayed when user clicks cancel button. so, provide custom .wxl file , change confirmcancelmessage string. default is: <string id="confirmcancelmessage">are sure want cancel?</string> (see src\ext\balextension\wixstdba\resources\*.wxl files examples). however, in wixstdba, when user clicks cancel button during apply(), wixstdba go failure page. or success page 2 options today. there has been discussion extending failure page more customizable no work has been done on idea.

c++ - Appying a binary threshold filter on a rgb image opencv -

i have binary mat obtained thresholding. need apply binary mat on rgb mat. there method in opencv apply binary mask on rgb image? just use bitwise_and function: mat dest; bitwise_and(rgbmat, binarymat, dest); it should work, if not, use cvtcolor function convert binarymat bgr: cvtcolor(binarymat, binarymat, cv_gray2bgr); //but before bitwise_and function

xml parsing - How to use special characters in XML -

i writing query in xml in ssrs report. can use "& lt;"(less than) without problem not able use "& le;" cdata doesn't work in query gets ifnored (less equal).any suggestions? what character(s) hoping &le; refer to? (perhaps "<="? or perhaps "≤"?) you can either define entity expands &le; required character(s), or can enter required characters in file directly, in place of entity reference.

To access a variable in a class in Java, is it better to return its value via a method, or just acces it via myClass.variable? -

i think title says all. maybe should ask: ever bad not use method return variable, or value? example 2-d point class x , y variable. is there wrong using mypoint.x x variable of mypoint opposed mypoint.xvalue() , returns mypoint.x ? you should make code, encapsulated, use setters , getters. set , methods in java?

python - Error importing middleware cms.middleware.page: "No module named middleware.page" -

im unable import module though path appears correct. >>> import cms.middleware.page traceback (most recent call last): file "<console>", line 1, in <module> importerror: no module named middleware.page heres shows path ok >>> x in sys.path: ... if x == "/usr/local/lib/python2.7/site-packages": ... print x ... /usr/local/lib/python2.7/site-packages heres module [root@monty codecrab]# ls -l /usr/local/lib/python2.7/site-packages/cms/middleware/page.py -rw-r--r-- 1 root root 1304 apr 17 19:49 /usr/local/lib/python2.7/site-packages/cms/middleware/page.py here files [root@monty cms]# pwd /usr/local/lib/python2.7/site-packages/cms [root@monty cms]# ls -l __init__.py middleware/__init__.py middleware/page.py -rw-r--r-- 1 root root 47 apr 17 19:49 __init__.py -rw-r--r-- 1 root root 0 apr 17 19:49 middleware/__init__.py -rw-r--r-- 1 root root 1304 apr 17 19:49 middleware/page.py any ideas ? this du

parameters - Android AsyncTask as method argument -

i'm working on app uses lot of asynctasks. when started participate @ coding of app targetsdkversion set 10 hadn't problems asynctasks because executed on parallel background threads. since have set targtsdkversion 17 we've got problems tasks because executed on single background thread. solve problem i've found following code use parallel tasks: if (build.version.sdk_int >= build.version_codes.honeycomb) { mytask.executeonexecutor(asynctask.thread_pool_executor); } else { mytask.execute(); } now, because have several tasks needing these lines of code, write method in our own utils class executes tasks in manner... can't achieve this, because can't pass different tasks method argument due 'param | progress | result' stuff differs 1 task another. there way achieve our goal? ideas? since asynctask parameterized class, need use generics. this: @suppresslint("newapi") static <p, t extends asynctask<p, ?, ?>&

bash - Ignore empty fields -

given file $ cat foo.txt ,,,,dog,,,,,111,,,,222,,,333,,,444,,, ,,,,cat,,,,,555,,,,666,,,777,,,888,,, ,,,,mouse,,,,,999,,,,122,,,133,,,144,,, i can print first field so $ awk -f, '{print $5}' foo.txt dog cat mouse however ignore empty fields can call this $ awk -f, '{print $1}' foo.txt you can use this: $ awk -f',+' '{print $2}' file dog cat mouse similarly, can use $3, $4 , $5 , on.. $1 cannot used in case because records begins delimiter.

Best way to bind a non-managed bean to an xPage? -

what best way bind non-managed bean xpage? use xpages controller classes in java, , limit classes specific xpage without using managed bean in faces-config. tried use datacontext , of methods work, not able document data source, using resolvevariable method. returns doc=null. same java class managed bean returns data source correct. are there better ways connect bean specific xpage? you can connect java controller xpage in beforepageload event: <xp:this.beforepageload><![cdata[#{javascript: viewscope.controller = new com.yourdomain.controller.mycontroller(); controller.beforepageload()}]]> </xp:this.beforepageload> then can call methods of controller using el this: #{controller.save} or can connect events controller: <xp:view xmlns:xp="http://www.ibm.com/xsp/core" afterpageload="#{controller.afterpageload}" your controller has access document data source. public void save() throws

html - (Drupal) Trying to set mouseover images, yet Drupal mangles it with garbage code. How can I resolve this? -

good morning, stackoverflow! simple question - i'm trying set mouseover images on drupal, , provide again, simple image tag: <img src="http://www.gameaether.com/images/stream_n3cril.png" onmouseover=""http://www.gameaether.com/images/stream_n3cril_hover.png" onmouseout="http://www.gameaether.com/images/stream_n3cril.png"> however, when submit changes, drupal mangles this: <img onmouseout="this.src=''http://www.gameaether.com/images/stream_nanakis.png" onmouseover="this.src=''http://www.gameaether.com/images/stream_nanakis_hover.png" src="http://www.gameaether.com/images/stream_n3cril.png" /> note: 'nanakis' image i'm trying same to. same results across board. any appreciated! you can create 2 function called on respective mouse events , change image on there!

jquery - Add a "loop mode" to my slideshow -

i got simple horizontal slideshow (i've been working on while now) left/right buttons navigate it. doesn't have "continuous" play - returning begining or end when clicking respective buttons. here's jquery code: var menuitem_place = 0; var menuitem_position = 0; var menuitem_limit = parseint($('.menuitem').length) - 1; $('.menuitem:first .content').css({margin: 0, height: '100%', lineheight: '99px'}) // rocks menu scroll left button mouse events $('#rocksmenu_btnleft').on('mouseenter', function(){ $(this).animate({'background-position-x':'-26px'}, 150); }); $('#rocksmenu_btnleft').on('mouseleave', function(){ $(this).stop(true).animate({'background-position-x':'-52px'}, 150); }); $('#rocksmenu_btnleft').on('click', function(){ $(this).animate({'background-position-x':'0px'}, 150, function(){ $(this).animate({'

mysql - Not showing data in database after insertion using python -

i using python 2.7 , mysql database. in python program have insert query this: cursor.execute("insert login(username,passw)values('"+i.username+"','"+i.password+"')") result=cursor.execute("select * login") print cursor.fetchall() when check in database, there no entry. after select in python code, when print results showing inserted data. not using transaction statement either. you need commit transaction database make insert permanent, , need use sql parameters prevent sql injection attacks , general quoting bugs: cursor.execute("insert login (username, passw) values (%s, %s)", (i.username, i.password)) connection.commit() until commit, data inserted visible python program; if not commit @ all, changes discarded again database. alternatively, switch on auto-commit mode: connection.autocommit() after switching on auto-commit, insertions committed instantly . careful this lead inconsistent d

Reaching backingbean method in datatable column JSF/PrimeFaces -

i unable reach backing beans method when calling in <p:commandlink> inside datatable column. my commandlink works fine when put outside datatable, cannot directly pass selected row variable. here code: <h:form id="reviewlists" prependid="false"> <p:messages /> <p:panel header="beoordelingen" style="margin-bottom:10px;"> <p:datatable value="#{reviewfinderbean.employees}" var="employee" > <p:column headertext="medewerker" > <h:commandlink value="#{employee.name}" action="#{reviewfinderbean.showreviewsforemployee(employee)}" /> </p:column> </p:datatable> </p:panel> </h:form> when checking http

c# - NopCommerce: How do I display extra information in the order details page? -

i developing payment gateway nopcommerce. have information (number of installments) need have appear on info tab in order details page - in admin area. basically, want add field somewhere show number of installments customer selected pay. does nop have way (adding custom values)? or need hack it? don't want change source code in main projects unless don't have choice. actually, have same requirement shopping cart page well. need show text like, "you can pay in [n] installments". there way can tell nop payment plugin? actually simplicity can use order notes or admin comment if want add simple information. go order notes in case. for second requirement, there's 'payment info' step during checkout, can display message want during step.

greasemonkey - On-the-fly modifications of the links according to a set of rules (Greasekit / Javascript) -

i have html page loads of entries this: <a href="https://www.example.co.uk/gp/wine/product?ie=utf8&amp;asin=123456789&amp;tab=uk_default" class="prmrybtnmed" i want replace links instead are: https://www.example.co.uk/gp/wine/order?ie=utf8&asin=1233456789 so, it's quite complicated search , replace. these instructions human: look @ url. make note of number after 'asin='. (forget before , after that) then, form new url, using asin. start this: https://www.example.co.uk/gp/wine/order?ie=utf8&asin= with number stuck on end form: https://www.example.co.uk/gp/wine/order?ie=utf8&asin=123456789 kindly note rather modifying existing buttons, acceptable add new button [or link] near original buttons both original , new links point same domain i'm using greasekit on ssb called fluidapp, can switch greasemonkey on firefox. i've watched 40 javascript tutorial videos - man language hard! seems extremely d

referencing (pure java) project in Android project (Could not find class) -

i trying reference pure java-project in android-project -> java-project has whole bunch of classes need use. oh, , first response pointed out: using eclipse, yes :) problem is: not find class 'xxx', referenced method com.example.helloworld.mainactivity.oncreate. seem have missed step or error...? did: the project added project java build path (logically nessecary) it marked in "order , export" in java build path , pushed top (this solved problem else here when dealing jar-files) ir marked in "project references" on project settings. i added folder relevant class under "libraries" in build path... not sure if should nessecary. the java-project reference has whole load of jars, if reason, should not different errormessage? i had same issue , after hours of frustration , search have found answer here: android, class not found imported jar file basically, issue referenced pure-java project or generated jar built java 1.7, ,

How get webview scale in Android 4 -

webview.getscale() deprecated (but still usable) the recommended way scale webview use webviewclient.onscalechanged() http://developer.android.com/reference/android/webkit/webviewclient.html#onscalechanged(android.webkit.webview , float, float) i've added corresponding handler in custom webview: public class customwebview extends webview { public customwebview(context context) { super(context); setwebviewclient(new webviewclient() { @override public void onscalechanged(webview view, float oldscale, float newscale) { super.onscalechanged(view, oldscale, newscale); currentscale = newscale } }); } and problem: method not invoked (at least on nexus 7) if i'm zoom in/zoom out using pinch, works if use zoom controls button. i'm developing api level 17 , ended using deprecated method getscale() same reason. webviewclient.onscalechanged() wasn't triggered when changed scale using pinch zoom in web

php - Form data not storing in database -

ok registration form data not getting stored in database. whereas if $name="bill"; storing $name='name'; not working. secondly when i click on register button shows php code of file connect.php. registration code <body> <div id="registration"> <h2><b><i>electronic montessori learning</i><b></h2> <form id="registeruserform" action="connect.php" method="post"> <fieldset> <p> <label for="name">name</label> <input id="name" name="name" type="text" class="text" value="" /> </p> <p> <label for="password">password</label> <input id="password" name="password" class="text" type="password" /> </p> <p&

jquery - Imagemapster: Cancel hover effect if area is selected? -

i using imagemapster add effects image map, awesome if cancel hover effect areas selected, possible? edit: referring http://www.outsharked.com/imagemapster/ okay, managed obtain effect talking about. first used in main .mapster() options: onmouseover: function(data) { if ( data['selected'] !== true ) { $('#bgartisti').mapster('highlight', data['key']); } }, and didn't work, because if set highlight : false disables them completely, opposed isselectable ( in comment added question ). commented hover manage manually. did commenting statement @ line 2725 in jquery.imagemapster.js

ruby on rails - Search form by start_time and end_time -

my models class house < activerecord::base has_many: bookings end class booking < activerecord::base belongs_to: house end the booking table has fields customer_name, start_time, end_time ect. i want make search form (start_time, end_time) on houses page index page visitor can check wich houses available given period. has ideas how start? thanks..remco in view, declare form non linked object <% form_tag :url => search_book_path, :method => :get %> <%= text_field_tag :start_time %> <%= text_field_tag :end_time %> <%= submit_tag %> <% end %> add route on books map.resource :books, :collection => { search => :get } in book_controller, declare function search: def search start_time = params[:start_time] || datetime.now end_time = params[:end_time] || datetime.now @books = book.search(start_time, end_time) end then declare search on book model def search(start_time_, end_time_) return