Posts

Showing posts from August, 2015

datetime - R Dataframe : Date range Operations - Subset those rows which falls under a certain date range -

if see profile, questions on dataframes , here another! i have dataframe result of merge between debit , credit transactions >head(alltxns) cust_no creditdate credit debitdate debit 1 12345 2014-10-01 200 2014-10-03 400 2 12345 2014-10-01 200 2014-10-04 150 3 12345 2014-10-01 200 2014-10-15 800 4 33344 2014-10-03 500 2014-10-04 50 5 33344 2014-10-03 500 2014-10-05 504 6 33344 2014-10-03 500 2014-10-06 332 7 33344 2014-10-03 500 2014-10-08 56 8 66554 2014-10-10 660 2014-10-04 150 9 66554 2014-10-10 660 2014-10-05 800 10 66554 2014-10-10 660 2014-10-11 400 11 66554 2014-10-10 660 2014-10-12 150 12 66554 2014-10-10 660 2014-10-13 800 my aim rows, debitdate lies between 5 days of creditdate , hence tried subset data, put date range using : operator five

java - How to Solve the error "package org.springframework.web.bind.annotation does not exist" -

jagadeesh-gs-macbook:contact jagadeeshgundlapalle$ gradle :help welcome gradle 2.2.1. run build, run gradle <task> ... see list of available tasks, run gradle tasks see list of command-line options, run gradle --help build successful total time: 16.4 secs jagadeesh-gs-macbook:contact jagadeeshgundlapalle$ gradle jar :compilejava /users/jagadeeshgundlapalle/documents/workspace3/contact/src/main/java/gurukul/contactlistcontroller.java:4: package org.springframework.web.bind.annotation not exist import org.springframework.web.bind.annotation.requestmapping; ^ /users/jagadeeshgundlapalle/documents/workspace3/contact/src/main/java/gurukul/contactlistcontroller.java:5: package org.springframework.web.bind.annotation not exist import org.springframework.web.bind.annotation.requestparam; ^ /users/jagadeeshgundlapalle/documents/workspace3/contact/src/main/java/gurukul/contactlistcontrolle

conventions - Is there an good reason to prefix all JavaScript modules with '$'? -

in project landed on plate, client code enclosed in revealing modules. good. of module names prefixed '$' character, e.g. $.acme.global.dataaccess = function () { var dataaccess = {}; none of these modules seems intended jquery plugin, can imagine no reason @ all, yet of code architected , written, might missing fundamental. imo no. it's convenient, sure, because it's easy type. for project, continue using maintain consistency. but... the problem feel there association between '$' , jquery, confusion -- such -- bound arise. , when jquery in use, you're slapping of "acme" stuff onto "jquery" object; there's no reason unless has jquery. you'd fine creating new namespace. why not acme.global.dataaccess ? it's shorter, , there no immediate confusion of whether module deals jquery or not. tldr no, no particularly reason use it it can confusing it tack code onto "jquery" object yes, can use

django - What did I do wrong with my URL? -

simple question. reading docs, i'm having trouble understanding syntax in urls. (r'^accounts/(?p<username>)/(listview)/$') what did wrong here? note, username variable whereas listview not. should setup enduser can go /accounts/ben/listview/ , view profile in list view. perhaps should (r'^accounts/(?p<username>)/listview/$') , see no need parenthesize listview bit if not variable.

how to make Intent.ACTION_CALL in Array adapter android facing activity not found exception -

i using array adapter load data in listview. in list view have phone number , if user clicks number , calling function should hapen. my array adapter class follows public class pendingdeliveryadapter extends arrayadapter<pendingdeliverypojoclass>{ private layoutinflater inflater; private context context; public pendingdeliveryadapter(context context,list<pendingdeliverypojoclass> data) { super(context,r.layout.listview_pending_delivery,data); this.context = context; inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); } and view method on... code call calling functions in button click @override public void onclick(view view) { intent phoneintent = new intent(intent.action_call); phoneintent.setdata(uri.parse(holder.delivery_phone_number.gettext().tostring())); try { context.startactivity(phoneintent); } catch (android.c

powerpivot - Minute | Hour | Day | Week | Month | Year | filter for Power View charts in Power BI - Disconnected Slicer -

Image
i want create power view chart in power bi minute/hour/day/week/month/year filters: workbook can downloaded at: https://www.dropbox.com/s/r00btg5zb8snohz/disconnected%20slicer%20demo.xlsx?dl=0 when minute selected chart should display: total number of msgs vs. x-axis showing last 60 seconds (from current time) 5 or 10 seconds interval. when hour selected chart should display: total number of msgs vs. x-axis showing last 60 minutes (from current time) 5 minutes interval. ex: 10:00am 10:05am 10:10am ...................................11:00am when day selected chart should display: total number of msgs vs. x-axis showing last 24 hours (12am 11:59pm 1 hour interval) when week selected chart should display: total number of msgs vs. x-axis showing last 7 days current datetime stamp 1 day interval. when month selected chart should display: total number of msgs vs. x-axis showing 30 days current datetime stamp 1 day interval when year selected c

angular ui router - How to access state params (ui-sref) without including them in URL propery of state in angularjs -

this question might similar different requirements . not able make comment (required 50 points) replicating question. i want access parameters sent ui-sref in template inside controller without mentioning them in state url . something using link below transitioning state home foo , bar parameters: <a ui-sref="home({foo: 'fooval', bar: 'barval'})">go home state foo , bar parameters </a> receiving foo , bar values in controller: state('home', { url: '/:foo', views: { '***whatisthis***': { templateurl: 'home.html', controller: 'mainrootctrl' }, app.controller('somecontroller', function($scope, $stateparam) { //.. var foo = $stateparam.foo; //getting fooval var bar = $stateparam.bar; //getting barval //.. }); i undefined $stateparam in controller. could me understand how done? want bar without addin

xml - XSL substring with in another string -

my xml <?xml version="1.0" encoding="utf-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="results.xsl"?> <testcase> <details> <platform>windows 7-firefox\prod</platform> </details> </testcase> i need retrieve windows 7 firefox prod individual strings im able retrieve strings except "firefox", please to retrieve it my xsl <?xml version="1.0" encoding="iso-8859-1"?> <!-- edited xmlspy® --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <html> <body> <os><xsl:value-of select="substring-before(testcase/details/platform, '-')"/></os> <inst><xsl:value-of select="substring-after(testcase/details/platform, '\')"/></inst> &

vb.net - Why will thread run faster with thread.Join in Visual Basic .Net -

i have 2 windows form test performance of using threat i looping of 500 for integer = 1 500 'form 1 scenario dim thread1 new system.threading.thread(addressof insertrecord1) thread1.start(runningid) dim thread2 new system.threading.thread(addressof insertrecord1) thread2.start(runningid) dim thread3 new system.threading.thread(addressof insertrecord1) thread3.start(runningid) dim thread4 new system.threading.thread(addressof insertrecord1) thread4.start(runningid) next form 2 scenario for integer = 1 500 'form 2 scenario dim thread1 new system.threading.thread(addressof insertrecord1) thread1.start(runningid) dim thread2 new system.threading.thread(addressof insertrecord1) thread2.start(runningid) dim thread3 new system.threading.thread(addressof insertrecord1) thread3.start(runningid) dim thread4 new system.threading.thread(addressof insertrecord1) thread4.start(runningid) thread1.join()

php - How to assign a span to a certain username -

a solution has been found! thank @northkildonan , @doug leary. solution code; if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<li class='list-group-item'>" . $row["user_name"]; if ($row["user_name"] == "tacolover22") { echo "<span class='badge'>dev</span>"; } echo "</li>"; } ## i have list of usernames , have code checks if username exists, if exist, want div appended it. here's image explaining this however, code have works, doesn't assign div selected username. here's php code; <?php if ( $row["user_name"] === "tacolover22");{ echo "<span class='badge'>dev</span>"; } ?> here's other php code grabs usernames; <?php $servername = "####"; $username = "####"; $password = "#######

lucene - Best way to find script in solr documents -

what'd best way search script in loose way in solr for example q:"this script i'm looking" possible retrieved docs: "...this script...." "...script looking" "...this our script..." in short not terms may appear more terms-> higher doc score some proximity allowed this basic solr capabilities , introduced in tutorial in subject. use edismax query parser , , first question, use mm parameter , while second solved default - or if want, use phrase fields or, depending on need, other phrase parameters.

objective c - Long press gesture get called twice when Alert view is shown -

i'm having troubles long press gesture here. i've around , found post related issues, no luck until now. i have long press gesture view, , want show alert view when gesture trigger, somehow trigger got called twice when alert view shown, i've check state of gesture recognizer still no luck. here code: initial code: uilongpressgesturerecognizer *longtap = [[uilongpressgesturerecognizer alloc] initwithtarget:self action:@selector(handletapgesture:)]; [longtap setminimumpressduration:1]; [self addgesturerecognizer:longtap]; - (ibaction)handletapgesture:(uipangesturerecognizer*)sender { if (sender.state == uigesturerecognizerstatechanged) { nslog(@"change"); } else if (sender.state == uigesturerecognizerstateended) { nslog(@"ended"); } else { nslog(@"begin"); uialertview *alert = [[uialertview alloc] initwithtitle:@"long pressed" message:nil delegate:nil cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show];

Matlab - Exporting cell arrays within cell arrays -

i have 1x6 cell array. each of cells arrays contains 5000x1 cell array comprising either strings or numbers. export fprintf in 6 columns separated e.g. backslash. use or, alternatively, on how combine data single 5000x6 cell array (i can manage export simple loop). thanks in advance. how [ my6cell{:} ] it should return single cell array of size 5000x6

javascript - Force refresh/reload when user navigates Back and forward again -

i want know how can ensure page reload/refresh when user presses button , presses forward again.? please help! you can use cookie set "back button pressed" flag. eg. jquery + jquery cookie plugin $(document).ready(function($) { if ($.cookie("reload") === *your-page-id*) { $.removecookie("reload"); location.reload(); } else if (window.history && window.history.pushstate) { window.history.pushstate("forward", null, "./#forward"); $(window).on("popstate", function() { $.cookie("reload", *your-page-id*); // set cookie page id }); } }); since popstate not supported older browsers should use history.js

SQL Server: How to order by nested -

i use sql server 2012 , trying sort results of following query names subquery sql execution error. can tell me doing wrong or missing here ? my query: select a.empid, (select b.empid, b.lastname + ', ' + b.firstname tm dbo.emptable b b.supempid = a.empid) dbo.emptable a.ntid = 'someid' order b.lastname + ', ' + b.firstname many in advance this, tim. you returning more 1 column in correlated subquery in columnlist. should give error only 1 expression can specified in select list when subquery not introduced exists. how using join instead of subquery? select a.empid, b.lastname + ', ' + b.firstname tm dbo.emptable inner join dbo.emptable b on b.supempid = a.empid a.ntid = 'someid' order b.lastname + ', ' + b.firstname

ibm mobilefirst - Calling wlCommonInit() callback from remote page -

i've been loading remote page in worklight 6.2 using android environment: <mainfile>http://example.com/worklight.html</mainfile> of course internal main.js wlcommoninit() callback not called because worklight can't find path of main.js javascript file. moved wlcommoninit() callback inline remote html source in way (the following remote page worklight.html ): <!doctype html> <html> <head> <meta charset="utf-8"> <title>asdapp</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <!-- <link rel="shortcut icon" href="images/favicon.png"> <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> --> <link rel="stylesheet"

javascript - Allow only one draw feature in Openlayer3 -

i'm using ol.interaction.draw draw points on map. enable user draw 1 unique point each time he/she clicks on "draw" icon. idea on how that? here code interaction: function addinteraction() { draw = new ol.interaction.draw({ source: sourcecomments, type: "point" }); draw.on('drawend', function(evt) { // unset sketch sketch = null; var allfeatures = comments.getsource().getfeatures(); var format = new ol.format.geojson(); document.getelementbyid('geometry').value = json.stringify(format.writefeatures(allfeatures), null, 4); }, this); map.addinteraction(draw); } thanks! you possibly remove interaction map on drawend event. var draw; function addinteraction() { draw = new ol.interaction.draw({ source: sourcecomments, type: "point" }); draw.on('drawend', function(evt) { //... unset sketch map.removeinteraction(draw); }, this);

extjs4 - paging in extjs 4 grid is not working -

items per page has been set 10 , have created paging toolbar xtype in docked items in front end. there's no start , limit parameters in oracle query. how go fetching records oracle database please help! here code: ext.loader.setconfig({enabled: true}); ext.loader.setpath('ext.ux', 'ux/'); ext.require(['*']); ext.onready(function() { var itemsperpage = 10; var store=ext.create('ext.data.store', { autoload: true, autosync: true, pagesize: itemsperpage, data: [], fields: [ {name: 'firstname', id:'firstname'}, {name: 'email', id:'email'}, {name: 'mobileno', id:'mobileno'} ] }); var panel = ext.create('ext.grid.panel', { layout: 'fit', store:store,

java - Why doesnt awaitTermination reliably return when all tasks on ExecutorService completed or cancelled -

i'm code submit tasks executorservice , wait them complete using shutdown() , awaittermination(). if 1 tasks takes longer period complete want cancelled without affecting other tasks. use code amended code executorservice interrupts tasks after timeout follows: package com.jthink.jaikoz.memory; import com.jthink.jaikoz.mainwindow; import java.util.list; import java.util.concurrent.*; public class timeoutthreadpoolexecutor extends threadpoolexecutor { private final long timeout; private final timeunit timeoutunit; private boolean isshutdown = false; private final scheduledexecutorservice timeoutexecutor = executors.newsinglethreadscheduledexecutor(); //map task timeout task used interrupt private final concurrentmap<runnable, scheduledfuture> runningtasks = new concurrenthashmap<runnable, scheduledfuture>(); public long gettimeout() { return timeout; } public timeunit gettimeoutunit() { return tim

c - difference between reading proc files via shell (cat) or via program (fread) -

i have kernel module creating entry in proc-fs , userspace-program reads file. proc read-function looks like: typedef struct { int integer; unsigned long ulong; char string[100]; float floatt; bool booll; u16 crc; } struktur; static int round = 0, len = 0, temp = 0, err; struktur *pde_data_p; int proc_read(struct file *filp, char *buf, size_t count, loff_t *offp) { int i; unsigned char *crcbuf; struktur struct_buf; pde_data_p = pde_data(file_inode(filp)); crcbuf = (unsigned char*)pde_data_p; memcpy(&struct_buf, pde_data_p, sizeof(struktur)); if (pde_data_p == null) { printk(kern_err "pde->data == null\n"); round = 0; return 0; } if (round == 0) temp = sizeof(struktur); if (count > temp) count = temp; struct_buf.crc = crc16(struct_buf.crc, crcbuf, sizeof(struktur)-sizeof(unsigned short)); err = copy_to_user(buf, pde_data_p, count); //if (err == 0) { // copy_to_user finished round = 0

VBA Delete all cells in each row except the last used cell -

trying write script delete cells in row except last used cell, move remaining data first column. see below: |--| empty cell |xx| cell unneeded data |data| cell data require. before: |--|--|--|xx|xx|xx|xx|data| |--|--|xx|xx|xx|data| after |data| |data| assuming meant in excel: process: loop on sheet set tempval variable value of lastcolumn loop through columns last column row, clearing each cell set value of column tempval tested: sub getlastcolumnvalue() dim lastrow long dim lastcol long dim sheet string dim tempval string sheet = "sheet1" lastrow = sheets(sheet).range("a" & rows.count).end(xlup).row 'using range() lrow = 2 lastrow lastcol = sheets(sheet).cells(lrow, columns.count).end(xltoleft).column tempval = sheets(sheet).cells(lrow, lastcol).text lcol = 1 lastcol sheets(sheet).cells(lrow, lcol).clearcontents next lcol sheets(sheet).cells(lrow, 1) = tempval

javascript - Htmlunit : How to get page updated after ajax dom manipulation -

using htmlunit 2.15, trying scrape third party website. therein textbox, onblur calls javascript function, adds option select box on same page. with htmlunit, able fire onblur event, how handle "changed" page, has newly added option element? code snippet: final htmlpage page = webclient.getpage(myurl); htmlselect selectdropdown = (htmlselect)page.getelementbyname(selectname); list<htmloption> options = clickthis.getoptions(); // returns 4 options htmltextinput mytextbox = page.getelementbyname(textboxname); mytextbox.setvalueattribute("mytext"); mytextbox.fireevent(event.type_blur); // how "updated" page? should have 5 options you need wait until javascript has changed page. experience may take while. if calling of server part of it. so far attempt poll page until changed way expect to. here method waits given text appear on page; private static final int ajax_max_tries_seconds = 30; /** * waits until given &#

graphics - Creating OFF SCREEN surface using Open GL ES 2.0 -

i want draw scenario using opengl es 2.0 creating user defined surface during egl initialization. can use drawn surface further processing. i think have use eglcreatepixmapsurface(), not sure usage. kindly help? most platforms have no support pixmaps whatsoever. may able create 1 egl, if os not know is, useless. on android, off-screen surfaces must created explained here . fbos best solution on platforms, fbos further processing opengl es. reading image typically requires using glreadpixels() slow on platforms. i have collection of articles here show how use fbos on platforms.

What happens with the element-value of top_node after pop-function, C++ -

i create pop()-function: void stack::pop(){ assert(!empty()); element* p=top_node; top_node = top_node -> next; delete p; } the top_node , p pointer pointing uppermost element in stack. after top_node-pointer points next element, p deleted. p pointer, happens whole element(int i, element* e). have clear separately? or more precisely, every pop , push function belongs clean function? thank you! this happens if pointer p points user-defined type class x{ x() {}; ~x(){}; }; x* p = new x; // calls default constructor delete p; // calls destructor

api - Auto sending Email -

Image
i need automatically run request api @ specified time, retrieve list of email address , sent email @ specified time. ideas how done? many thanks. you can of cron jobs. follow following steps set cron jobs. go control panel search cron jobs in new window set cron timing , path of cron file. now server run file automatically @ set time. if have query feel free ask.

javascript - How to Show/ hide part of canvas? -

here js fiddle i have requirement when user clicks on center circle, should toggle outer circle , when user clicks on outer small circles should change center circle value. here not getting how show/ hide part of canvas when user clicks on center circle? any on how this? generatecanvas(); function generatecanvas() { try { var flagcirclecentercoordinates = new array(); var flagcircles = []; var centerx = document.getelementbyid('canvasflag').width / 2; var centery = document.getelementbyid('canvasflag').height / 2; var outertrackradius = 98; var innertrackradius = 70; var innercircleradius = 20; var flagelement = document.getelementbyid("canvasflag"); var objcontext = flagelement.getcontext("2d"); // outer track objcontext.fillstyle = "#fff"; objcontext.beginpath(); objcontext.arc(center

How to initialize a function within an HTML file in a JavaScript file? (Chrome Apps) -

i working scoring board chrome app. (i new chrome apps) index.html - (just part of code) user inputs number of players scoring board, submits , opens html file table , number of rows displayed based on user input. <form class="pure-form"> <fieldset> <legend>enter number of players:</legend> <input type="text" id="users" placeholder="input number"> <button type="submit" id="btn1" class="pure-button pure-button-primary">submit</button> </fieldset> </form> <script> function(){ //localstorage.setitem('value', document.getelementbyid("users").value); localstorage.value = document.getelementbyid("users").value; } </script> <script type="text/javascript" src="js/main-sheet.js"></script> <script type="text/javascript" src="js/alert.js">&

r - How should I use ezANOVA() if I already collapsed the data to cell means? -

i want repeated measures anova using ezanova() ez pacakge. experimental designs two-way repeated measures design: soa (which has 4 levels) x congruency (which has 3 levels), , data bellow organized according above order (i.e., soa x congruency), "subject" being id column. question how should use ezanova() if collapsed data cell means (the data bellow after collapsed dependent variables each subject according soa x congruency)? subject mrt1 mrt2 mrt3 mrt4 mrt5 mrt6 mrt7 mrt8 mrt9 mrt10 mrt11 mrt12 99 1039.3 1078.1176 997.5323 873.4615 1024 916.2 1061.0909 1008.7778 919.7879 1053 1052.9615 953.619 5203 1020.4545 1098.6667 911.2642 941.25 944.2857 976.1053 949 992.4167 870.4308 783.9091 852.1176 927.8852 5205 1373.7273 1074.2143 986.7397 1193.4615 1031.9545 1108.4789 1041.2727 1036.0625 989.0714 1180.5 908.9688 944.2024 5306 1012.375 1038.8421 949.4938

java - Allowed Special Character in Transformer -

i trying send xml file server after processing has special character "佥佬佧佼a£". currently code looks like public class utils { public static string transformtostring(document activedocument) throws transformerexception{ transformerfactory tf = transformerfactory.newinstance(); transformer transformer = tf.newtransformer(); transformer.setoutputproperty(outputkeys.omit_xml_declaration, "yes"); transformer.setoutputproperty(outputkeys.indent, "true"); transformer.setoutputproperty(outputkeys.encoding, "utf-8"); stringwriter writer = new stringwriter(); transformer.transform(new domsource(document), new streamresult(writer)); writer.tostring(); } test class public class test { public static void main(string[] args){ document doc = documentbuilderfactory.newinstance().newdocumentbuilder().parse(xmlpath); //doing process on doc , changing other values string xmlstring = utils.

c# - How to use RouteConfig to append a page URL -

i struggling code work, think i've read enough suggest correct way approach this. on intranet, i'd user type in single word search textbox, , check checkbox . when new page loads, i'd url rewritting services of asp.net mvc kick in , change value from mysite.com/?id=blah&ischecked=true to mysite.com/home/index/blah/true my code isn't working in sense of gives no error, doesn't explaining. so, i've removed check box focus on textbox. my route is routes.maproute( name: "default", url: "{controller}/{action}/{mytype}", defaults: new { controller = "home", action = "index", mytype = urlparameter.optional } ); my controller public actionresult index() { viewbag.message = "modify this"; return view(); } [httpget] public actionresult index(string mytype) { viewbag.message = "..." + mytype;

javascript - Check if the variable is a SVG.js element instance -

i'm using svg.js library. how can check if variable x instance of svg class? i tried: new svg(document.createdocumentfragment()) instanceof svg // false new svg(document.createdocumentfragment()).contructor === svg // false checking value svg function returns find new element created , returned. instance of svg.doc : > svg svg.js:12 function (element) { if (svg.supported) { element = new svg.doc(element) if (!svg.parser) svg.prepare(element) return element } } so, solution is: new svg(document.createdocumentfragment()) instanceof svg.doc // true // or using x variable var x = new svg(document.createdocumentfragment()); x instanceof svg.doc // true

symfony - Sylius how to override the CoreBundle Checkout process -

i'm working on project , i'd ask clean/best way override steps in the sylius\bundle\corebundle\checkout\checkoutprocessscenario i'd preserve custom mechanics of whole process add custom step @ end , remove finalize step. $builder ->add('security', 'sylius_checkout_security') ->add('addressing', 'sylius_checkout_addressing') ->add('shipping', 'sylius_checkout_shipping') ->add('finalize', 'sylius_checkout_finalize') ->add('payment', 'sylius_checkout_payment') ->add('purchase', 'sylius_checkout_purchase') ; what's best form of doing so? if it's extending bundle , overwriting i'd of @ least information point me in right direction - i'm not getting results on own. i've read docs on bundle doesn't explain how override built in process. i've read symfony cookbook on exte

c# - listbox with 2 different Datatemplates -

need view 2 different controls need add listbox. controls of type icontrol so did following: controls.cs interface icontrol { double x { get; set; } double y { get; set; } } class mybutton : button, icontrol, inotifypropertychanged { public mybutton(string buttontext, double x, double y) { this.content = buttontext; this.x = x; this.y = y; } private double x = 0; private double y = 0; public mybutton() { } public double x { { return x;} set { x = value; onpropertychanged("x"); } } public double y { { return y;} set { y = value; onpropertychanged("y"); } } } class mylabel : label, icontrol, inotifypropertychanged { public mylabel(int number, double x, double y) { this.content = number.tostring(cultureinfo.invariantculture);

php - Magento multiple database transactions in single commit -

i know how in zend framework $db->begintransaction(); try { $db->query(...); $db->query(...); $db->query(...); . . . $db->commit(); } catch (exception $e) { $db->rollback(); } but want using magento model, like $db->begintransaction(); try { $modelone = mage::getmodel('modulename/table1'); $modeltwo = mage::getmodel('modulename/table2'); $modelthree = mage::getmodel('modulename/table3'); $db->query($modelone); $db->query($modeltwo); $db->query($modelthree); . . . $db->commit(); } catch (exception $e) { $db->rollback(); } if of them failed save should rolled back thanks look @ app/code/core/mage/core/model/resource/transaction.php this model allow add models objects in transaction. during save call $object->save() each added object. if fails, call $object->getresource()->rollback() each object. can add commit callbacks via ad

install - py launcher does not find my Python 2.7 -

i'm on windows 7. have python 2.7 installed years. installed python 3.4. i'm trying use new py launcher. when open cmd terminal , type py -2 , error message: requested python version (2) not installed . how can make py aware of python 2.7 installation? note: python 2.7 installed in non-standard directory (not in c:\python27), in case problem. i found solution. registry had wrong entries. have 32 bit version installed went hkey_local_machine|hkey_current_user\software\wow6432node\python\pythoncore\2.7\installpath , value set c:\python27 while installation in d:\python27 . changed registry values match correct location , works fine. it's been quite while installed python 2.7, assume had python 2.7 installed first. deleted , installed pythonxy in new location. didn't uninstall previous version correctly.

How to keep track of slightly differing codebases in a single git repository -

we run multiple webshops multiple languages, , want version them git. differ slighly - lines of css, different php file, additional image. alltogether 98% same among languages, single repository great. how can achieve this? here ideas: in css, body tag gets class "lang-en" or "lang-fr", selectors can language specific. for language files, .gitignore on target system can great job. for configuration, main , .gitignored file can contain language. but how slight changes in 3rd-party-php-code? there way tell git part of file check out? like aaaaa ---git checkout if lang=en--- bbb ---git endif--- ccc sorry incorrect naming, buti don´t know how call want. regards edit: idea: language-neutral version main repository, , differences git submodules. work?

bash - dmesg convert timestamps to human format -

i have following sample of dmesg: throttled log output. 57458] bar 3: test 2 on bar 8 available [ 19.696163] bar 1403: test on bar 1405 available [ 19.696167] foo: [ 19.696168] bar 3: test 5 on bar 1405 available [ 19.696178] foo: [ 19.696179] bar 1403: test 5 on bar 1405 available [ 20.928730] foo: [ 20.928733] bar 1403: test on bar 1408 available [ 20.928742] foo: [ 20.928745] bar 3: test on bar 1408 available [ 24.878861] foo: [ 25.878861] foo: [ 25.878863] bar 1403: bar 802 present i convert all timestamps in line human format ( "%d/%m/%y %h:%m:%s" ) notes: system not have dmesg -t nor has perl installed. prefer solution w/ sed or awk, python option. i've found few solutions problem, none quite answers need. nor know how modify needs. awk -f"]" '{"cat /proc/uptime | cut -d \" \" -f 1" | getline st;a=substr( $1,2, length($1) - 1);print strftime("%d/%m/%y %h:%m:%s",systime()-st+a)"

php - ZipArchive not opening file - Error Code: 19 -

im having issues code being able open zip file have uploaded , moved folder, zip file uploads fine , can open in zip program however, when attempt open ziparchive extract data errors. $path = "../"; // upload directory $count = 0; foreach ($_files['files']['name'] $f => $name) { if(move_uploaded_file($_files["files"]["tmp_name"][$f], $path . $name)) $count++; // number of uploaded file } $kioskfile = $_files['files']['name'][0]; $kioskfile = explode(".", $kioskfile); $kioskfile = $kioskfile[0]; $zipfile = "../" . $kioskfile . ".zip"; $zip = new ziparchive; $res = $zip->open($zipfile); if ($res === true) { $zip->extractto("./"); $zip->close(); } else { echo "error cannot open zip file - error code: "; } when run code shows me error code 19 zi