Posts

Showing posts from May, 2013

php - MYSQL INNER JOINS -

Image
i have 2 tables in database. 1 used booking selection of dates , times available , other used returning selection of dates , times available. need link these 2 on 1 page. <?php { mysql_connect("localhost" , "" , "") or die (mysql_error()); mysql_select_db("") or die(mysql_error()); $pid=intval($_session["user_id"]); $query = "select t1.*, t2.return_time, t2.return_date returnout t1 inner join return t2 on t1.book_time=t2.book_time"; //executes query on database $result = mysql_query ($query) or die ("didn't query"); //this selects results rows $num = mysql_num_rows ($result); $dates_and_times = array(); while($row=mysql_fetch_assoc($result)) { $dates_and_times[] = $row['book_date'].' '.$row['book_time']; $dates_and_times[] = $row['return_date'].' '.$row['retun_time']; } } ?>

php - Russian encoding not consistent on mail.ru with phpmailer -

im sending automated emails russian users, used utf-8 encoding , when open in gmail shows perfect, in outlook shows incorrect in mail.ru popular email account russian users shows gobblygook. so sent email outlook in accryllic mail.ru , showed same content without problem, changed encoding windows-1251, again shows fine in gmail in mail.ru (who dont have option find switch encoding , dont support utf-8) shows different type of gooblygook. code here: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=koi8-r" /> <title>untitled document</title> </head> //error_reporting(e_all); error_reporting(e_strict); date_default_timezone_set('america/toronto'); require_once('phpmailer_5.2.2/class.phpmaile

sql server - Convert varchar 2007-12-19-11.57.17.366731 to datetime datatype -

i have data shown below 2007-12-19-11.57.17.366731 and datatype varchar(26) i want change datatype datetime . i tried syntax no use , getting the conversion of varchar data type datetime data type resulted in out-of-range value. here sample trying select convert(datetime, '2007-12-19-11.57.17.366731', 120) thanks well, first of all, you'll need add string magic transform data accepeted format datetime . , need use less miliseconds (for datetime have 3 digits it), in sql server 2008 can use datetime2 this. try following: declare @value varchar(26) set @value = '2007-12-19-11.57.17.366731' select convert(datetime,left(@value,10) + ' ' + replace(substring(@value,12,8),'.',':') + '.' + substring(@value,21,3), 120) valueasdatetime, convert(datetime2,left(@value,10) + ' ' + replace(substring(@value,12,8),'

uitableview - NSFetchedResultsController with custom cells -

i'm using nsfetchedresultscontroller , have no idea how fix current problem. headers in table view cells rather real headers, because don't want headers stick @ top while scrolling. the message pretty clear it: coredata: error: serious application error. exception caught delegate of nsfetchedresultscontroller during call -controllerdidchangecontent:. invalid update: invalid number of rows in section 1. number of rows contained in existing section after update (2) must equal number of rows contained in section before update (0), plus or minus number of rows inserted or deleted section (1 inserted, 0 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out). userinfo (null) but number of rows in section after insertion of 1 row needs 2! how can let table view know this? i'm doing stuff this: indexpath = [nsindexpath indexpathforrow:indexpath.row + 1 insection:section]; newindexpath = [nsindexpath i

javascript - HighCharts - JQuery - Simple example not working -

this simple example highcharts website not working me ( http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-basic/ ). here code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://www.highcharts.com/js/highcharts.js"></script> <script type="text/javascript"> $(function () { $('#container').highcharts({ chart: { plotbackgroundcolor:

c++ - Macro concatenation using compiler define -

this should simple, i'm struggling figure out. have project_name compiler ( g++ ) -d define, , want concatenate other text form namespace name. current approach this: #define version_namespace project_name ## versioning for current project, expect version_namespace syren_dllversioning . instead compiler error: error: 'project_nameversioning' has not been declared but according g++ call, project_name being defined properly: ccache g++ ... -dproject_name=syren_dll ... why project_name not being replaced before concatenation takes place? a macro name not expanded when appears next ## operator, need more layers of indirection: #define p_version2(foo) foo ## versioning #define p_version(foo) p_version2(foo) #define version_namespace p_version(project_name) so project_name expanded argument of p_version , concatenated in p_version2 . in section 16.3.3 [cpp.concat], paragraph 3, specified for both object-like , function-like mac

Null when update Date field - MySQL PHP -

i'm trying update date field in db. query this: $q = "update news set data = str_to_date('2011-03-05','%y-%m-%d'), title = '".$title."', content='".$content."',...."; works great, but: $q = "update news set data = str_to_date('".$data."','%y-%m-%d'), title = '".$title."', content='"..."; it not working :( i got date: $data = $_post["data"]; and has value "2013-04-13". trimmed date , show in popup window , value correct; plz :) update strange me, if i'm using: $q = "insert news set data = cast('".$data."' date), title = '".$title."', content='".$content."'..."; it works fine. in insert not in update script table: create table if not exists `news` (`id` int(11) not null auto_increment, `data` date not null, `title` text not null, `content` text n

file upload - Wordpress TinyMCD download -

anyone know of place can download tinymce , image uploader wordpress uses or @ least similar? you can download pluginusing url. http://wordpress.org/extend/plugins/tinymce-advanced/

android - Applying a BitmapShader using relative coordinates when using canvas.drawBitmap -

i'm trying use bitmapshader draw on canvas. have 2 images of same dimensions (one alfa channel , 1 rgb), want draw on canvas created same size. problem seem though canvas.drawbitmap users absolute coordinates paint. there way draw relative coordinates. public class maskedimagedrawable extends drawable { private final bitmap mmask; private final paint mpaint = new paint(); public maskedimagedrawable(bitmap mask, bitmap image) { mmask = mask; shader targetshader = new bitmapshader(image, shader.tilemode.clamp, shader.tilemode.clamp); mpaint.setshader(targetshader); } @override public void draw(canvas canvas) { canvas.drawbitmap(mmask, 0.0f, 0.0f, mpaint); } @override public int getopacity() { return pixelformat.translucent; } @override public void setalpha(int alpha) { mpaint.setalpha(alpha); } @override public void setcolorfilter(colorfilter cf) {

Java: Using TreeSet with a Class type -

i having problems using treeset sort hashmap. following code have: private static hashmap<oddmove, integer> sorthashmap( hashmap<oddmove, integer> hm) { map<oddmove, integer> tempmap = new hashmap<oddmove, integer>(); (oddmove wsstate : hm.keyset()) { tempmap.put(wsstate, hm.get(wsstate)); } list<oddmove> mapkeys = new arraylist<oddmove>(tempmap.keyset()); list<integer> mapvalues = new arraylist<integer>(tempmap.values()); hashmap<oddmove, integer> sortedmap = new linkedhashmap<oddmove, integer>(); treeset<oddmove> sortedset = new treeset<oddmove>(mapkeys); object[] sortedarray = sortedset.toarray(); int size = sortedarray.length; (int = 0; < size; i++) { sortedmap.put(mapkeys.get(mapvalues.indexof(sortedarray[i])), (integer) sortedarray[i]); } return sortedmap; } following error getting: aborting: exception in odd

.net - No IConnectionFactory implementation found for connection URI: activemq:tcp: -

i still "no iconnectionfactory implementation found connection uri: activemq:tcp://localhost:61616" error. i've paste , include in compile project archive "nmsprovider-activemq.config" i'm working .net 4.0 , references apache.nms-1.5.1-bin.zip\net-4.0\release the code estandar , simple can't throw connection error using system; using system.collections.generic; using system.linq; using system.text; using apache.nms; using apache.nms.util; using system.collections; using system.reflection; using system.io; namespace conexionactivemq { class program { private static string[] getconfigsearchpaths() { arraylist pathlist = new arraylist(); // check current folder first. pathlist.add(""); appdomain currentdomain = appdomain.currentdomain; // check folder assembly located in. pathlist.add(path.getdirectoryname(assembly.getexecutingassembly().

Git Submodule: Which commit (hash) do I need? -

when roll git working directory particular commit, submodule shows "modified." submodule checked in , has no modified files, it's @ different commit needs be. how can find out name/hash of correct commit? if you're looking submodules rollback appropriate commits, try: git submodule update --recursive this update of submodules commit should sitting @ (referencing meta data parent repo has stored each commit commits submodules should at).

android - App force closing when turning screen off -

i can't figure out why app forceclosing when turn off screen, logcat app has scrolling text, displays widgets, gets user location, has pager, gets current time, gets battery level, code pretty long i'll post logcat, maybe can figure out if need pieces of code let me know 04-09 02:57:56.498: d/evolution launcher(16574): stopping 04-09 02:57:56.623: w/iinputconnectionwrapper(16574): getextractedtext on inactive inputconnection 04-09 02:57:56.639: w/iinputconnectionwrapper(16574): gettextbeforecursor on inactive inputconnection 04-09 02:57:56.655: w/iinputconnectionwrapper(16574): getselectedtext on inactive inputconnection 04-09 02:57:56.662: w/iinputconnectionwrapper(16574): gettextaftercursor on inactive inputconnection 04-09 02:57:56.670: w/iinputconnectionwrapper(16574): getextractedtext on inactive inputconnection 04-09 02:57:56.670: w/iinputconnectionwrapper(16574): gettextbeforecursor on inactive inputconnection 04-09 02:57:56.850: d/dalvikvm(16574): gc_explicit free

objective c - forwardInvocation vs class_addMethod -

in implementation, have choice of using class_addmethod create new methods in runtime, or can rely on forwardinvocation/nsproxy. when both approaches available solutions, way prefer , how determine? i prefer class_addmethod . because much faster forwardinvocation (search method list, try forwardtarget, create nsinvocation , last attempt resolve selector) it more clear add new method rather handle dynamical method call in 1 place.

mongodb - Records with comma seperator are not exported correctly in mongo DB -

i using below command export contacts collection's fields f1 , f2 contacts.csv mongoexport --db users --collection contacts --csv --out /opt/backups/contacts.csv --fields f1,f2 its working fine , data exported csv. the problem f2 field's records export. f2 field stored in db comma seperated values 1,samuel,it. i think mongo exporting in csv , considering comma seperator. so, 1 , samuel , ane exported 3 different cells in csv file below, field1 field2 ==== ==== ====== == 1 1 samuel instead want follows field1 field2 ==== ==== 1 1,samuel,it btw using mongo 1.6.5 mongodb 1.6.5 released in december, 2010 , lot has changed since then. worth upgrading @ least mongodb 2.2 if not 2.4. if full upgrade of mongodb not option, try running mongoexport mongodb 2.4 against current database. command line tools should backward compatible. it looks mongoexport csv formatting made more compliant r

excel - How to line up numbers in columns where last row numbers have percent sign -

all columns numbers right-aligned. row secondary totals should have percent sign (%), digits should still line up. tried single-character indent numbers except row, no variation of font produces digits lining up. i tried adding thin column house percent sign on row, but, alas, there seems built-in column margin or padding looks 26 % instead of 26%. know workaround? thanks. using custom number format _-* #,##0_% the trailing _% means include space width of % character

switching column data in mysql? -

this question has answer here: swapping column values in mysql 15 answers i wanting try , run query update table ptb_messages , switch data of 2 columns around, instance heres table: id | to_user_id | from_user_id | 1 4 5 2 5 6 3 7 9 so want try , switch value of from_user_id on to_user_id , vice versa. i going use before realised once copied value 1 table other the original data other column have been overwritten, $sql = mysql_query("update ptb_messages set ptb_messages.from_user_id=ptb_messages.to_user_id"); what need swap function, im not sure how might im imagining this: $sql = mysql_query("update ptb_messages set to_user_id=from_user_id, from_user_id=to_user_id"); hope can me please. well, mysql has concept called user variable . can take adva

javascript - Using jQuery, how do I pass arg to function and then display a message from predefined variable -

i want call function, pass type of error arg, , display message. function msgdialog(msg) { // define messages var errormsg = "there has been error. sorry that."; var loginmsg = "something went awry login. please try again."; var uploadmsg = "your upload failed. please try again."; var networkmsg = "you not connected internet. please connect , try again."; alert(msg); } how call function msgdialog(loginmsg) , have var can assign correct message, that? here alerting it, display differently. know need create new var value of arg value, not sure how. thank you. that pure javascript, no jquery. try this: var msgdialog = (function() { var errors = { errormsg : "there has been error. sorry that.", loginmsg : "something went awry login. please try again.", uploadmsg : "your upload failed. please try again.", networkmsg : "you not c

android - How to keep maps following my-location (moving the camera) and don't have OnCameraChange triggered -

how can keep my-location blue icon centered without having call movecamera or without having trigger oncamerachangelistener? the simple answer is: cannot. you may want post feature request api track user location: googlemap.setfollowinguserlocation or on gmaps-api-issues .

php - Splitting an IP Address Range, IP addresses stop after 210937 records -

i have database of ip ranges , using code below split range in individual ip addresses. works fine until 210937 records code stops spilitting ip range , starts inserting 0.0.0.0. i have tried removing ip addresses still stops @ same point though ip address different. ($ip = ip2long($ip1); $ip<=ip2long($ip2); $ip++) { $lip = long2ip($ip); any suggestions appreciated. ok here full code minus db connection. $query1 = "select * masteriplist"; $result = mysql_query($query1); while($row = mysql_fetch_array($result)) { $ipe = $row['ip_end_range']; $ips = $row['ip_start_range']; $ip1 = "$ips"; $ip2 = "$ipe"; ($ip = ip2long($ip1); $ip<=ip2long($ip2); $ip++) { $lip = long2ip($ip); mysql_query("insert ip_master (ip) values ('$lip')") or die(mysql_error()); } } ok debugging code returned following array(24) { ["id"]=> string(2) "

Python json dictionary to array -

i having trouble understanding json dictionary , array. have script scraping information website. models.txt list of model numbers such as 30373 30374 30375 and json_descriptions.txt list of keys want sku price listprice issoldout the code is: import urllib import re import json modelslist = open("models.txt").read() modelslist = modelslist.split("\n") descriptionlist = open("json_descriptions.txt").read() descriptionlist = descriptionlist.split("\n") model in modelslist: htmltext = urllib.urlopen("http://dx.com/p/getproductinforealtime?skus="+model) htmltext = json.load(htmltext) if htmltext['success'] == true: def get_data(dict_index, key): return htmltext[u"data"][dict_index][key] description in descriptionlist: info = description, (get_data(0,description)) print info else: print "product not exist" if print out in

php - SQL JOIN Statement - Generate data before export -

i try generate data before export csv format im failed right data. table : products products_id | products_image 2 | a.jpg 1786 | b.jpg table : product_description products_id | products_description | language_id 2 | bm description | 6 1786 | bm description | 6 1786 | cn description | 4 1786 | en description | 1 i try output : products_id | products_image | p_description_6 | p_description_4 | p_description_1 | 2 | a.jpg | bm description | | | 1786 | b.jpg | bm description | cn description | en description | my current query below query failed generate product_description in same row: $select = "select p.*, pd.* products p left join product_description pd on p.products_id=pd.products_id group p.products_id"; try like, select p.products_id, p.products_image, max(case wh

aggregate functions - Mysql COUNT sub query -

i have complex query myself across few tables have finished. final aspect involves aggregating how many bids item has received, doing items in particular section though. query works fine except returns 1 row when try , add in aggregation (/* */) query. reading around seem need sub query, except i'm not entirely sure how go this. query date: select s.id section_id, s.name section, i.id item_id, i.title item_title, item.location_id item_location_id, i.slug item_slug, i.description item_description, i.price item_price, unix_timestamp(i.date_added) item_date_added, c.id, c.city, c.particular_id, p.id, p.particular /*,count(o.i_id) interest*/ section s inner join item on s.id = i.section_id inner join city c on i.location_id = c.id inner join particular p on c.particular_id = p.id /*left join offer o on o.job_id = i.id*/ s.id = 2 the code works in returns rows expected until introduction of /* */ code, returns 1 row. any give me appreciated thanks jonny it s

eclipse - NoSuchMethodError: LocalSessionFactoryBuilder.addAnnotatedClass(Ljava/lang/Class;)Lorg/hibernate/cfg/Configuration; -

Image
i using spring 3.2 , hibernate4. included jars required. using jboss as. deploying eclipse. getting error. org.springframework.beans.factory.beancreationexception: error creating bean name 'personcontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.springmvcsample.service.personservice com.springmvcsample.controller.personcontroller.personservice; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'personservice': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.springmvcsample.dao.persondao com.springmvcsample.service.personserviceimpl.persondao; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'persondao': injection of autowired dependencies

Django model with manytomany field, not getting saved. Is data population designed properly? -

i think i'm not populating data, model has manytomany field. wanted create model days of week, people can select days want receive mail notifications. resulting generated html, looks correct. i.e. can select checkboxes days, when click submit bottom, other fields saved in database, not days of week selection. i'm sure i'm making simple mistake, regarding how data model. can't see it. should following work? here's model days of week: days_of_week = ( ('1', 'monday'), ('2', 'tuesday'), ('3', 'wednesday'), ('4', 'thursday'), ('5', 'friday'), ('6', 'saturday'), ('7', 'sunday'), ) class days(models.model): days = models.charfield(max_length=1, choices=days_of_week) the part of mail notification model references days: class preferences(models.model): user = models.foreignkey(user) mail_days = models.manytomanyfield(days) the part o

javascript - Canvas Kineticjs - position mouse is wrong -

i have text line @ first after have canvas position mouse on canvas it's wrong (zero of y position = height of text line) http://jsfiddle.net/dsc26/ <div id="output">output</div> <div id="container"></div> yoda.on('mousemove', function(e) { $('#output').html('position mouse on canvas: '+'x: ' + e.clientx + ', y: ' + e.clienty); }); how can fix that, thanks!. you can use event.offsetx/y or event.layerx/y properties. have here -> http://jsfiddle.net/dsc26/2/ yoda.on('mousemove', function(e) { var offsetx = e.offsetx || e.layerx, offsety = e.offsety || e.layery; $('#output').html('position mouse on canvas: '+'x: ' + offsetx + ', y: ' + offsety); });

geolocation - get distance between Current location and Selected Place in android -

i new android developing, want make application give me distance on mapview between current location , selected place. please give me suggestion this. get distance between current location , selected place using android. public static double distfrom( double lat1, double lng1, double lat2, double lng2) { double earthradius = 3958.75; double dlat = math.toradians(lat2-lat1); double dlng = math.toradians(lng2-lng1); double = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.toradians(lat1)) * math.cos(math.toradians(lat2)) * math.sin(dlng/2) * math.sin(dlng/2); double c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a)); double dist = earthradius * c; return dist; }

c++ - Where should be parameters used for output located in the function parameters list -

i trying decide on policy regarding usage of function parameters output in our c/c++ code. it clear me policy should indicate parameters used output should grouped either @ end or start of function parameter list, not sure there reason prefer either of these locations. do know of reason prefer grouping them @ start or @ end? just personal opinion, if reflects copy or assignment semantics, prefer put them beginning, string , stdio functions in c standard library do: strcpy(dest, src); looks like dest = src; and fgets(buf, sizeof(buf), file); looks like buf = contents_of(file); if , however, reason this not case, organize things input comes first, output, put output arguments end of argument list.

primary key - SAS Data step Merge/Modify 2 datasets but still keep the integrity constrants (pk) on master dataset -

i have code below data master; input id name $ status $; datalines; 1 b b 2 c c 3 ;;;; run; proc sql; alter table master add primary key (id); quit; data transaction; input name $ status $; datalines; f f f e e d d b z c x ;;;; run; proc sort data = master; name; run; proc sort data = transaction; name; run; i merge transaction dataset master dataset, , update value master value transaction dataset. achieve this, use code below data have; retain _maxid; merge have addon; name; if id = . id = _maxid + 1; _maxid = max(id, _maxid); run; the result this id name status 3 f 1 b z 2 c x 4 d d 5 e e 6 f f however, master dataset reset, , lost primary key constraint on id column of master dataset. as far know, merge, set , update command create new dataset, not update current dataset. the modify statement 1 update current dataset, replacing merge statement above code modify not work.

php - Flot pie chart get data from database -

hi trying retrieve data mysql database create flot pie, i've data looks this data in array $array = array(); $array[0] = array(); $array[1] = array(); $array[2] = array(); $array[0]['label'] = 'grade a'; $array[1]['label'] = 'grade b'; $array[2]['label'] = 'grade c'; $array[0]['color'] = '#89a54e'; $array[1]['color'] = '#aa4643'; $array[2]['color'] = '#4572a7'; $array[0]['data'][0] = array(1,700); $array[1]['data'][0] = array(1,500); $array[2]['data'][0] = array(1,600); echo json_encode($array); and mysql $server = "localhost"; $user="root"; $password=""; $database = "db_test"; $connection = mysql_connect($server,$user,$password); $db = mysql_select_db($database,$connection); $query = "select * pie"; $result = mysql_query($query

asp.net - Is the security attack through query string is a CSRF attack? How to prevent attack from query string? -

someone trying access our server page invalid query string throws exception. query string =./../../../../../../../../../windows/system32md.exe exception : could not find file 'c:\windows\system32md.ex'. how prevent these types of attack. this not csrf attack. may or may not have 1 of - can't say. it's directory traversal attack . we creating path guid : server.mappath("~\folder\" + guid) then path can end outside ~\folder root including 'go-up-a-directory' strings ( .. ) in guid variable. may able access file on server's filesystem - not thing. before using user input in filename, need check in limited format expect. directory traversal attacks, there other odd things can windows filenames (like reserved names, invalid names, accidental unc paths, unsupported unicode characters etc), should use strict whitelist validation ensure names expect. for real guid, you'd want validation against regex: [0-9a-fa-

php - How to send data in array to database -

i getting value input box in array. want post database single insert query relevent data inserted in mysql here code foreach ($_post['stop'] $stopindex => $stopvalue) { echo $stopname=$stopvalue; } foreach ($_post['timing'] $timingindex => $timingvalue) { } foreach ($_post['ampm'] $ampmindex => $ampmvalue) { } can me correct code write insert query this example if use codeigniter's way of fetching data. just prepare 1 array appropriate keys (relevant database keys defined) , import update_batch ci db method. this method 1 can use in model. function save_something() { $post_data = $this->input->post(); foreach ($post_data $key => $value) { $settings[] = array( 'key' => $key, 'value' => $value); } } $this->db->update_batch('settings',$settings,'key'); return true; }

php - Is it possible to use $_REQUEST for inserting data in a mysql database? -

i have code figured out, entries user submits submit button aren't going anywhere. there way fix this, or should use $_post method? php code: <?php include ("dbroutine.php"); function register() { $connect = db_connect; if (!$connect) { die(mysql_error()); } $select_db = mysql_select_db(securitzed, $connect); if (!$select_db) { die(mysql_error()); } //collecting info $fname = $_request ['fname']; $lname = $_request ['lname']; $username = $_request['username']; $password = $_request['password']; $email = $_request['email']; //here check have inputs filled if(empty($_request['username'])){ die("please enter username!<br>"); } if(empty($_request['password'])){ die("please enter password!<br>"); } if(empty($_request['email'])){ die("please enter email!"); } //let's check if username in use $user_check = mysql_query("select username members us

python job queue library for desktop -

i want develop pyqt contacts list desktop application , wanted jobs performed time time when event happens.for instance,i want when hit contact button,a job of sending emial added queue , done after 5 minutes. i have seen job queuing solutions , require redis or other kind of broker.i want app simple , bundling servers such redis not like. is there simple job queue can use perform simple jobs plan on having in app without requiring huge service brokers?. the first thing comes mind quartz framework - it's scheduler, originates in java (i think). looked , found question here @ stackoverflow: an enterprise scheduler python (like quartz) , , looks match.

php - Finding Win CMD columns (gives result+error) -

i have problem following script: $ exec('mode con /status', $tmp); print_r($tmp); it runs command , gives me result, every time error message too: the system cannot find path specified. i want terminal window size $cols x $rows used system: php 5.4 + win7 test results here: c:\@home\devel>c:\php\php.exe -v php 5.4.13 (cli) (built: mar 15 2013 02:05:59) copyright (c) 1997-2013 php group zend engine v2.4.0, copyright (c) 1998-2013 zend technologies xdebug v2.2.2, copyright (c) 2002-2013, derick rethans c:\@home\devel>c:\php\php.exe -r "exec('mode con /status', $tmp); print_r($tmp);" the system cannot find path specified. array ( [0] => [1] => status device con: [2] => ---------------------- [3] => lines: 1200 [4] => columns: 160 [5] => keyboard rate: 31 [6] => keyboard delay: 0 [7] => code page: 775 [8] => ) how can rid of err

meteor - MongoDB updating field contained in subdocument throws an error -

my collection schema looks this: products :{ _id: "s2of6hitskzwy5toz", user_id: "lkahkhk5svtr6r8sk", shop: "ebay.com", items: { item: "hp laptop" item_total: 101.67 notes: "note hp laptop" price: 101.67 quantity: 1 shop: "ebay.com" url: "ebay.com/hp" }, expenses: { bank_fee: 0 cod_fee: 0 expense_total: 0 inbound_fee: 0 pcs_fee: 0 pjp_fee: 0 }, service_fee: 15.25, total: 116.92 } i want update bank_fee field in expenses subdocument using update query using syntax: insertfee : function(user_id, id, fee_amount){

php - Using Indexes in mysql correctly -

i know how can make proper indexed table, understand concept using movies example: i have these 5 tables multiple fields list here these tables primary indexes fields only: movies movie_id = primary index actors actor_id = primary index geners gener_id = primary index reviews review_id = primary index and have these tables relation 2 columns each, unsure type of indexes should have these relational tables: movie_actor movie_id,actor_id movie_gener movie_id,gener_id movie_review movie_id,review_id i have join on these fields if wants 1 movie details use such query: select * movies m left join movie_actor ma on ma.movie_id = m.movie_id left join actors on a.ator_id = ma.actor_id left join movie_gener mg on mg.movie_id = m.movie_id left join geners g on g.gener_id = mg.gener_id left join movie_review mr on mr.movie_id = m.movie_id left join reviews r on r.review_id = mr.review_id m.movie_id = 1234 so kind of index should

javascript - Recreating Doodles Accordion Table -

Image
in current webproject have implement table containing days of month, resulting in ~30-31 table columns. since such huge table isn't pretty, wanted implement similar tables of doodle polls. doodle folds table, replaces hidden columns pic , if click on picture unfolds columns -> displays hidden columns. but how achieve such behaviour? i'm new javascript , not familiar fancy css3 techniques. especially, how replace hidden columns picture? tutorials i've found allow hide specific columns , not replace them. ps: tagged ror, since project i'm working on built ror , maybe there rails solution problem? pps: you hide columns want hide first , have column image displayed in table. when image (folding) clicked can hide column containing picture , make other columns visible again. not fancy css3 stuff need basic knowledge of how interact dom elements through javascript (hide / show) elements. should trick. see this tutorial @ w3schools. need elements n

asp.net - iTextSharp to print GridView - output header width -

i'm using itextsharp print gridview, facing problem when trying determine appropriate width of columns. in gridview don't set it, rather let asp.net engine resize widths (it dynamically based on text's style). by default, columns of same size bad in cases. how can configure header's pdfpcell object width suitable text in it? column widths calculated @ pdfptable level you'll need address there. depending on parser using there's couple of ways start end result need parse html itextsharp objects , manually apply own logic before committing them pdf. code below based on using (preferred) xmlworker , itextsharp 5.4.0 following sample html: <html> <head> <title>this test</title> </head> <body> <table> <thead> <tr> <td>first name</td> <td>last name</td> </tr>

ios - Cropping of the image in a particular frame in iphone? -

i have application in need crop image particular frame.ie cgrectmake(20,40, 280,200).then taking image , in pickerdidfinish i doing ` uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage]; //code crop cgrect rect=cgrectmake(20,40,280,180); cgimageref imageref = cgimagecreatewithimageinrect([image cgimage], rect); uiimage *newimg = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); cgsize size = [newimg size]; uibutton *btn=[[uibutton alloc]initwithframe:cgrectmake(0, 0, size.width, size.height)]; nslog(@"frame = %@\n", nsstringfromcgrect(btn.frame)); imagedata =[[utility getcompresseddata:newimg]retain]; [[uiapplication sharedapplication] setnetworkactivityindicatorvisible:no]; [self dismissmodalviewcontrolleranimated:yes]; `and uploading image .but when got image uploaded server still 360*480.why so.i need have overlay view enables part of camera view user.so user can ta

Apply style and template controls in c# WPF XAML -

i apply custom style(template) button, textbox, textblock ect.. can learn in visual studio 2010 (i use c# wpf)? give me examples? does this tutorial answers question ? it simple shows use of window.resources wpf styles.

html - Query strings with HTTP URL -

i trying http of url multiple query strings using browser. following observation http://192.168.0.1:80/mycontent/?key1=value1 //works. http://192.168.0.1:80/mycontent/?key1=value1&key2=value2 //doesen't work. the question here : i finding hard time figure out what's right format append query string should use &amp when put in browser? is there way can find validity (availability in server) of query string enter in url. you should use &amp; when writing link html, example: <a href="http://192.168.0.1:80/mycontent/?key1=value1&amp;key2=value2">example</a> but not when entering url address bar, or using directly in javascript (for example). your format correct, should able pick both key1 , key2 in request collection. depending on language using on server, technique differs.

coffeescript - What is the correct syntax for concatenating strings within jquery replaceWith -

i have following html markup <body> <div class="old-wrapper"> ...lots of stuff </div> </body> i need replace coffeescript function give following markup <body> <div class="new-wrapper"> <input type="text" class="date-picker"> </div> </body> i need use .old-wrapper target my coffeescript function looks this jquery -> $(".old-wrapper").repacewith( $("<div class='new-wrapper'>") + $("<input type='text' class='date-picker'>").datepicker + $("</div>") ) what correct way concatenate these strings within replacewith function? (sorry basic javascript syntax question, javascript knowledge limited) you have syntax error start with: $("<div class="wrapper>") ^ ^ ^ open close ??? the rest of code kind of inva

math - How to change elements in sparse matrix in Python's SciPy? -

Image
i have built small code want use solving eigenvalue problems involving large sparse matrices. it's working fine, want set elements in sparse matrix zero, i.e. ones in top row (which corresponds implementing boundary conditions). can adjust column vectors (c0, c1, , c2) below achieve that. however, wondered if there more direct way. evidently, numpy indexing not work scipy's sparse package. import scipy.sparse sp import scipy.sparse.linalg la import numpy np import matplotlib.pyplot plt #discretize x-axis n = 11 x = np.linspace(-5,5,n) print(x) v = x * x / 2 h = len(x)/(n) hi2 = 1./(h**2) #discretize schroedinger equation, i.e. build #banded matrix difference equation c0 = np.ones(n)*30. + v c1 = np.ones(n) * -16. c2 = np.ones(n) * 1. diagonals = np.array([-2,-1,0,1,2]) h = sp.spdiags([c2, c1, c0,c1,c2],[-2,-1,0,1,2], n, n) h *= hi2 * (- 1./12.) * (- 1. / 2.) #solve eigenvalues ev = la.eigsh(h,return_eigenvectors = false) #check structure of h plt.figure() plt.spy(h) p

oracle - sql select with does not contain -

this select: select my_id, job_id my_table job_id != 'bra%' , job_id != 'wes%' , sts_dttm < trunc (sysdate) -12 it still selects fields values contain "bra" , "wes" thank & regards, should be: select my_id, job_id my_table job_id not 'bra%' , job_id not 'wes%' , sts_dttm < trunc (sysdate) - 12; and column name should job_name or job_code, not job_id. job_id sounds number :)