Posts

Showing posts from July, 2013

gitlab - git submodule in stage - how to remove? -

Image
i have items "archive" label in gitlab web interface: problem local repo have real files in directory: i can't push changes directory remote server. tried remove yii2-rbac remote server: git rm --cached path/to/yii2-rbac but didn't work, after next push, mysterious file same name 'yii2-rbac' appears again... how can fix it? update: have taken account comments , realized deal submodules: git ls-files --stage | grep $160000 160000 3fc4af92c20ca2bf97bf01a50819565b5a6fe621 0 path/to/yii2-migration-utility 160000 c6d315a3c9652b3b1ced19fe105f65e6e09f375b 0 path/to/yii2-rbac one question: how can delete these submodules , start using path/to/yii2-rbac usual directory? i found solution works me. in main git repo: rm -rf path/to/child/.git will remove "submodule" status directory (but files still remains). in gitlab interface directory looks common folder:

java - TibcoRV Daemon rvd or rvdaemon -

i new tibcorv. on windows tibcorv installation, can find 2 executable files in bin folder under installation directory. rvd.exe rvdaemon.exe it looks both of these 2 tibcorv daemon executable. running either of them launches tibcorv process. tibrv 8.4.2 onward, can find rvd.exe . can please let me know difference between these 2 executables? i checked 7.4.7 installation , there's no rvdaemon.exe . processes byte byte identical? thin it's likely, copied 1 other.

shell - Is there a way to run a program and kill every 20 seconds in linux? -

i have program need collect 300 pieces of data from, manually collecting have run program on ubuntu virtual machine , record data on excel. takes long time whole process. wondering if there command in linux use call commands make , kill me program. search watch , tried doesnt work me: watch -n 20 make play where make play runs program yet doesnt fo want do. want every 20 seconds have enough time write data excel file 1. make play (run program prints need record) 2. kill program is there command this? i think should rethink doing - can't think of setting running , killing program every 20 seconds makes sense. that being said, standard way run programs periodically in linux cron job. cron has 1 minute minimum though, have write script starts 3 instances of program 20 second delay, , run script cron every minute. can combine timeout utility, kill program if still running after given time. quick google search should provide further details.

php - How i can put my node.js app in an existing page? -

i have php page, website important logic , want put node.js chat there without changing php logic, maybe youtube's embed player or that. it's possible? or maybe should think in changing chat app php chat service? i'm new node.js, love socket.io idea, it's faster other chat services, didn't find in google, don't know how proceed. can me? thanks! my app code (if can help) var app = require('http').createserver(resposta); // criando o servidor var fs = require('fs'); // sistema de arquivos var io = require('socket.io')(app); // socket.io var usuarios = []; // lista de usuários var ultimas_mensagens = []; // lista com ultimas mensagens enviadas no chat app.listen(3000); console.log("aplicação está em execução..."); // função principal de resposta requisições servidor function resposta (req, res) { var arquivo = ""; if(req.url == "/"){ arquivo = __dirname + '/index2.html'

vba - Using Excel's Rounddown in a UDF rounds 1 to 0 -

to make long story short, place work measures time quadrants of clock. instance, 1.1 hour , 0-15 minutes, 1.2 hour , 15-30 minutes, , 1.3 hour , 30-45 minutes. there no 1.4 because 1.4 of course equal 2. i wanted make excel sheet automatically add time under system, wrote udf convert times separating decimal values , multiplying 2.5 normal decimal value (.1 = .25, .2 = .5, .3 = .75) , dividing 2.5 @ end convert employer's format. i'm aware can done using excel's existing formulas, is kind of messy , honest i'm stubborn let go now. if @ screenshot below you'll see function works of columns except final weekly total column reason displays 39.4 instead of 40 (again 2 values technically equivalent, program not converting .4 1 reason). http://i.imgur.com/yxovlkp.png here code in it's entirety. problem seems occur when remainder becomes equal 1 (for simplicity imagine 2 values ending .2 entered) , rounded 0 somehow @ end. function newmath(week range) do

Is there a way to use a loop to set choices in a list item in google forms scripts? -

i have program i'm trying make takes data in spreadsheet , makes google form , im trying make 11 cells each populate 1 drop down list. there setchoices method , inside of createchoices cant have other kind of code inside make 11 choices loop each 1 being next string in array. if can think of other methods please let me know... this code currently: function onopen() { var sheet = spreadsheetapp.getactivesheet(); var names = sheet.getrange(1, 1, 200); var values = names.getvalues(); var number = 0 var count = 0; var array = "'" + values[0] + "'"; while (values[count] != "") { number++; count++; if (values[count] != "") { array = array + ", " + "'" + values[count] + "'"; } } logger.log(number); logger.log(array); (var = 0; < number; i++) { logger.log(values[i]); } var form = formapp.create("cleaners"); var formid = f

php - Failed to move existing Opencart project to a new local server -

i can't run existing opencart project in new workstation. here's says when try open project. way included database , using wampserver. here's errors: warning: fopen(c:\wamp\www\myshops/system/logs/) [function.fopen]: failed open stream: no such file or directory in c:\wamp\www\myshops\system\library\log.php on line 6 ( ! ) fatal error: call member function get() on non-object in c:\wamp\www\myshops\index.php on line 101 call stack # time memory function location 1 0.0023 485984 {main}( ) ..\index.php:0 2 0.1002 2039896 front->dispatch( ) ..\index.php:272 3 0.1028 2122968 front->execute( ) ..\front.php:29 4 0.1028 2122968 action->execute( ) ..\front.php:34 5 0.1042 2171896 call_user_func ( ) ..\vq2-system_engine_action.php:65 6 0.1042 2171912 controllercommonhome->index( ) ..\vq2-system_engine_action.php:65 7 0.1043 2172472 loader->controller( ) ..\home.php:12 8 0.1046 2173216 action->execute( ) ..\vq2-s

asp.net mvc 5 - SignalR C# MVC Mapping Anonymous User to Client ID -

question: how manage anonymous users multiple tabs in single browser updated when hub sends out response? the scenario follows: i integrate signalr project anonymous users can live chat operators. user's have authenticated iidentity mapped via client.user(username) command. anonymous user browsing site.com/tools , site.com/nottools can not send messages tabs connectionid. 1 tab gathers response. i have tried using iwc patch tool doesn't account saving chat information database , think passing variables via ajax isn't secure way read/write database. i have looked in following: managing signalr connections anonymous user however creating base such , using sessions seems less secure owin. i had idea use client.user() creating false account each time user connects , delete when disconnect. rather not fill aspnetusers db context garbage accounts seems unnecessary. is possible use userhandler.connectedids.add(context.connectionid); map fake username? im @ loss

database - Sorting list of names in Perl -

i trying learn perl , quite new less week. i want sort list of names(in case fruits) , give them id. script gives them id want sort them well. current code: use strict; use warnings; %unique; open(my $infile, $argv[0]) || die "could not open file '$argv[0]' $!"; open(my $outfile, ">$argv[1]") || die "could not find file '>$argv[1]' $!"; while (<$infile>) { @fields = split; $fruit = $fields[0]; $quantity = $fields[1]; @parts = split(/[_.]/, $fruit); $counter = ++$unique{$parts[1]}{$parts[2]}; print $outfile join("\t", $fruit, $quantity, "$fruit.$counter"), "\n"; } input: apple 3 apple 50 apple 1 orange 51 orange 21 current output: apple 3 apple.1 apple 50 apple.2 apple 1 apple.3 orange 51 orange.1 orange 21 orange.2 wanted output: apple 1 apple.1 apple 3 apple.2 apple 50 apple.3 orange 21

localization - Using ".stringsdict" file with 'localizedStringWithFormat' --> Are NUMERALS localized for you? -

i trying produce following localized string: "in ___ day(s)" --> (ex: in 5 days) to accomplish this, i've gone down .stringsdict route: <key>in %d days</key> <dict> <key>nsstringlocalizedformatkey</key> <string>%#@days@</string> <key>days</key> <dict> <key>nsstringformatspectypekey</key> <string>nsstringpluralruletype</string> <key>nsstringformatvaluetypekey</key> <string>d</string> <key>zero</key> <string>today</string> <key>one</key> <string>in %d day</string> <key>other</key> <string>in %d days</string> </dict> </dict> i use following, obtain localized string: nsinteger days = ...; localizeddued

javascript - Is it necessary to convert a bytearray of PNG data to base64 before rendering it on a page? -

i have file contains multiple png images (along other types of data). think of zip file or other archive format. upon receiving response server, receive bytearray containing of data need. i proceed parse it, extracting png data in process. after parsing finished, have collection of bytearrays hold png data, , draw them webpage. many examples i've looked @ each byte array must converted base64, , use src image, can used draw on canvas. is standard way display images manually? is browser when renders img tag , sees src attribute references uri?

angularjs - Is it possible to bind the sorting of a column to a different property than its display property with Angular UI Grid? -

Image
i wondering if knew of way sort column in same order column using angular ui grid. i'm guessing mean if (for example) have "first name" , "last name" columns display first name , last name respectively, want click sort on "last name" , sorts table in order of "first name"? if so, can accomplish using cell template. assume have following table: and when sort "last name" column sort table in order of data in "first name" column. assuming following data: $scope.gridoptions.data = [{ "firstname": "david", "lastname": "carney", }, { "firstname": "bob", "lastname": "wise", }, { "firstname": "peter", "lastname": "thompson", }]; define columndefs follows: $scope.gridoptions.columndefs = [{ name: 'firstname', field: 'firstname' }, {

java - Understanding Eclipse Memory Analyzer Report -

Image
i've been having tough time trying figure out source of oom errors. the memory analyzer report says instance of bitmapdrawable occupies ~16 mb thought i'd start there. however, i'm not sure how memory can accumulated in instance of "byte[]". advice how interpret report or might going wrong appreciated.

javascript - setting canvas with image dimetions -

i trying set canvas picture background. want make image variable that's different discussion. here code. var canvas = document.getelementsbytagname('canvas')[0]; var img = document.createelement('img'); img.onload = function () { alert(img.width + ' x ' + img.height); }; img.src='images/maps/de_dust2.jpg'; canvas.width = img.width; canvas.height = img.height; when page loads alert correct pixel height , width canvas not shown. any appreciated. var canvas = document.getelementsbytagname('canvas')[0]; var img = document.createelement('img'); img.onload = function () { // need have thes in onload, have img width, height > 0 canvas.width = img.width; canvas.height = img.height; alert(img.width + ' x ' + img.height); }; img.src='images/maps/de_dust2.jpg';

Bdbquit raised when debugging python -

recently when adding debugger python 2.7.10 code, message: traceback (most recent call last): file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/queues/connectors/amqplib_connector.py", line 191, in acking_callback callback(message.body) file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/queues/consumable_message_queue.py", line 32, in deserialized_callback self._callback_method(msg) file "/users/isaachess/programming/vivint/platform/businesslogic/businesslogic/util/statsd_util.py", line 95, in _time_func retval = f(*args, **kwargs) file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/net/router.py", line 226, in handle try: file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/net/router.py", line 226, in handle try: file "/system/library/frameworks/python.framework/versions/2

arrays - AI/Opponent Algorithm in Tic Tac Toe using Javascript -

i'm beginning programming student. i'm having little difficulty thinking through how ai functioning tic tac toe. know have far tackling problem, i'm having total code block! far, i've made player goes first, , cannot change cell chose during turn. i've started function determines computer during turn, long random number function. i've commented think have in code, , here's section i'm struggling with: function computerturn () { var blanksquares = []; (var row = 0; row < maxrows; row++) { (var col = 0; col < maxcols; col++) { // if cell blank... add blanksquares [row,col] } } if (blanksquares.length != 0) { // pick random [row,cell] pair blanksquares // change pattern row,cell "o" } else { alert("game over"); } } } // generic random number function returns random integer between "zmin" , "zmax" function

css - transition with -webkit- transform in shorthand rule -

i have grunt postcss running autoprefixer, , code: transition: transform .3s, color .3s; ... outputting: transition: color .3s, -webkit-transform .3s; transition: transform .3s, color .3s; transition: transform .3s, color .3s, -webkit-transform .3s; but shouldn't outputting this? -webkit-transition: -webkit-transform .3s, color .3s; transition: transform .3s, color .3s; my postcss settings are: postcss: { options: { map: { inline: false, // save sourcemaps separate files... annotation: '../css/' // ...to specified directory }, processors: [ require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes ] }, dist: { src: '../css/*.css' } } i have no idea if i'm doing wrong, if it's outputting incorrectly, or if it's correct. thanks you have write correct css, not fault, can check css on official page ,

javascript - Display legend items in two columns highcharts -

in highcharts possible display legend in 2 columns, stacked vertically? i'm trying work out best way of displaying legend items, @ moment have legend items stacked on top of each other. there maximum of 4 series on chart. i'm not sure how approach this, see option of usehtml can't seem find examples of html. http://jsbin.com/oyicuc/9/edit any advice helpful, thanks. have tried use itemwidth parameter? please take @ http://jsfiddle.net/b9l2b/1266/ legend: { width: 200, itemwidth: 100 }, http://api.highcharts.com/highcharts#legend.itemwidth edit: http://jsbin.com/oyicuc/31/ width:600, itemwidth:300, itemstyle: { width:280 } http://api.highcharts.com/highstock#legend.itemstyle

Wait until user completes typing using ngChange - AngularJS -

my <input> tag associated ajax call via ngchange. can make sure every change not make ajax request? ngchange function executes once user completes typing , waits sometime, 700ms. i tried ng-model-options="{debounce: 700}" ngchange executing every keystroke. depending on you're definition completes typing, use ng-blur . ng-blur fires when user leaves input field

jquery - Javascript how to convert epoch into local date -

i'm converting epoch date local date: $("time").each(function() { var date = $(this).text(); // gives me "1325419200000" newdate = new date(date); // gives me invalid date }); html: <td class="date"> <time datetime="{{date}}">{{date}}</time> </td> how can convert epoch date local date in format: 'mmm dd, yyyy h:mm:ss a'. how can achieve this? date object won't accept string epoch. need convert integer. check out var epoch = "1325419200000" var date = new date(epoch); // return invalid date date = new date(parseint(epoch)); //return sun jan 01 2012 21:00:00 gmt+0900

bash - I am trying to send mail in python using shell command . But variable does not get substituted in script -

import subprocess ='xxxx@fmr.com' subject= 'hostname' cmd= "cat /var/log | mailx -s 'swap full on'+subject" +to subprocess.popen(cmd,shell=true) if place double quote before subject mailx takes first character subject , treat other recipient , try send mail them . --------------------out put of cmd= "cat /var/log | mailx -s 'swap full on'"+subject +to can try this: import subprocess ='xxxx@fmr.com' cmd= "cat /var/log | mailx -s 'test' " + subprocess.popen(cmd,shell=true)

angularjs - What is "[ ]" sign in angular.js? -

i trying find answer nothing found... in simple below codes: var app = angular.module('myapp', [] ); i have never seen example using "[ ]" sign. for? that dependencies array want module depend on. so if need routing system so: angular.module("app.module", ["ui.router"]); this says app.module depends on ui.router routing. your example above declaring angular module no dependencies , assign variable app .

node.js - Cannot Connection to Port at Simple Node Js server -

i stumped. i have node js server running on subdomain. every time try access browser err_connection_refused error. here server code const http = require('http'); http.createserver( function (request, response){ response.writehead(200, {'content-type': 'text/plain'}); response.end('hello world\n'); }).listen(8124, "my-server-ip"); console.log('server running @ http://127.0.0.1:8124/'); additional information: running vps hostgator. subdomain shares ip main domain; 412.x.xx.xxx . insert console log inside create server function. can identify error this. can use error response. const http = require('http'); http.createserver( function (request, response){ response.writehead(200, {'content-type': 'text/plain'}); response.end('hello world\n'); console.log('server running @ http://127.0.0.1:8124/'); }).listen(8124, "my-server-ip");

How can connect Eclipse Android SDK manager in Android Studio? -

i studying android , having little problem. mistake used eclipse install/download of android sdk. , want move android studio how can use downloaded android sdk in eclipse? you can set downloaded sdk folder path here: file->settings->android sdk(in left side of window)-> android sdk location(in top of window)

javascript - Getting "Maximum call stack size exceeded error" using protractor -

Image
im getting "maximum call stack size exceeded error" intermittently. i saw few posts says possible reason due recursion i have 3 files 1) conf.js 2) mainspec.js 3) page1.js calling "mainspec.js" "conf.js" suites: { spec1 : '../specs/mainspec.js' }, global.url = 'http://angular.github.io/protractor/#/'; "mainspec.js" page1= require('../pages/page1.js'); describe('samplespec', function () { beforeeach(function () { browser.ignoresynchronization = true; console.log('+++++++++before each++++++++'); }); aftereach(function () { console.log('+++++++++after each++++++++'); }); it('mysampcode', function () { //login page1.getloginpage(url); . . . }); }); "page1.js" module.exports = { getloginpa

Perl RegEx conversion to 'Basic' -

i'm using grep in freebsd appears freebsd not support perl regex. i'm wondering version following have work in freebsd using 'basic' expression: grep -po "(?<=addr.)[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" why not use perl - installed default. perl -ne 'print $1 if m/(?<=addr.)([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)/' of course @ point don't need behind more either. perl -ne 'print join ("\n", m/addr.(\d+\.\d+\.\d+\.\d+)/)'

c# - report viewer using stored procedure -

i have written 2 stored procedures in sql server 2008. 1 procedure returns 1 field value 1 table , procedure returns many field values tables. need values displayed in report viwer .rdlc(asp.net,c#) . how use both 2 stored procedures @ time.

sql - Query for each element -

i given following database schema donuts (name: string, price: integer) grocery (no: string, gname: string, mincredit: integer) distributor (dname: string, gno: string, purchaseyear: integer) for each year (distributor.purchaseyear), grocery "vons" purchased atleast 1 donut, find number of donuts purchased. output set of tuples, indicates year , number of donuts purchased "vons" i not sure how approach this. tried select (d.purchaseyear, count(dd.name)) distributor d, donut dd, grocery g g.name = "vons" this seems give me incorrect output. assuming have schema below donuts (gname: string, price: integer, purchaseyear: integer) // record every donut purchased grocery gname in year grocery (gno: string, gname: string, mincredit: integer) // grocery details distributor (dname: string, gno: string, purchaseyear: integer) // distributor details you can data below query select g.name , d.purchaseyear , cou

ruby on rails 4 - Wrong number of arguments while seeding the db -

i have model generated following method $ rails generate model user first_name last_name age:integer then trying populate db using following in seeds.rb. user.destroy_all user.create![ {first_name: "vamsi", last_name: "pavan", age: 21}, {first_name: "vani", last_name: "pavani", age: 20} ] when rake db:seed done, getting following error. rake aborted! argumenterror: wrong number of arguments (2 1) /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/attribute_methods.rb:358:in `[]' /home/gvpmahesh/code/rails/coursera/advanced_ar/db/seeds.rb:10:in `<top (required)>' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/depend

What is Xlets and a simple example program and how to run -

can 1 tell me xlets , simple program (with xlets , java) , softwares required run. xlets java me platform embedded devices. link may help netbeans allows run application pc . a copy , paste link : package helloxlet; import javax.microedition.xlet.*; import java.awt.borderlayout; import java.awt.component; import java.awt.container; import java.awt.color; import java.awt.dimension; import java.awt.graphics; import java.awt.font; // create main class. public class main extends component implements xlet { private container rootcontainer; private font font; // initialize xlet. public void initxlet(xletcontext context) { log("initxlet called"); // setup default container // similar standard jdk programming, // except need container first. // xletcontext.getcontainer gets parent // container xlet put awt components in. // , location arbitrary, needs set. // calling setvisible(t

Creating Recurly BillingInfo using only a token_id -

i have recurly token , trying start subscription using it. following example code snippets, such the 1 in right panel here . subscription = recurly.subscription( plan_code = 'bazooka_monthly', account = recurly.account( account_code = 'john_rambo', billing_info = recurly.billinginfo(token_id = 'token_id') ) ) subscription.save however whenever try pass token_id billinginfo, complains "subscription.account.billing_info.number required". how can create billinginfo token_id without getting validationerror? to solve problem, upgraded latest version of recurly client library python. my billing code ended looking , works long card number valid: account_code = "%s_%s" % (int(time.time()), random.randint(0,10**9)) account = recurly.account( account_code = account_code, first_name = form.first_name, last_name = form.last_name, email = form.email, billing_info = recurly.billinginfo( to

python - Google AppEngine Blobstore Video Streaming in Html Template -

i managed code following link work. https://developers.google.com/appengine/docs/python/blobstore/overview#complete_sample_app when upload video managed video stream on browser question how place video in html template? in order display uploaded video can either use html video tag or 1 of media player solutions available out there , give apart delicate player, cross browser compatibility along flash fallback. here great list of media players can use. have used personal projects mediaelementjs , satisfied ease of use , stability of performance.

html - How to make Chrome and IE display block hyperlinks correctly -

i have used following code make < > links fill content of container. both chrome , ie display < > link size of content. i have tried explicit pixel height , important tags chrome still insist on making link size of content. link has no content , displays 0px height , width. this how make block hyperlink? html <div class="mydiv"> <a href="#"></a> </div> css .mydiv { height: 50px; width: 50px; display: block; } .mydiv { height: 100%; width: 100%; display: block; } here go - tested in chrome , ie , works in both: here html: <div class="abc"> <a href="http://www.google.com"></a> </div> and css: div.abc { display:block ; width:200px ; height:50px ; background:blue ; } .abc { display:block ; width:100% ; height:100% ; } you can edit height , width in div.abc , hypertext link adjust accordingly. demo here:

mysql - PHP Login with another server database? -

how login sever database , list content database ? what required settings that? with pdo, can connect 2 different databases/servers in same script. <?php $db1 = new pdo('mysql:host='.db_host.';dbname='.db_database.';charset=utf8', db_user, db_pass); $db2 = new pdo('mysql:host='.db_host2.';dbname='.db_database2.';charset=utf8', db_user2, db_pass2); //select database 1 $results = $db1->query("select * table"); //select database 2 $results2 = $db2->query("select * another_table"); if want connect server outside of localhost - remember open firewall , add server's ip access hosts.

ruby on rails - Displaying has_many through association as column in Active Admin index -

how display list of has_many_through associations association column headings , through: value entry in table row? i have 3 models: class jobs attr_accesor :title has_many :scores has_many :factors, through: :scores end class scores attr_accesor :score belongs_to :job belongs_to :factor end class factor attr_accesor :name has_many :scores has_many :jobs, through: :scores end i want able show, in jobs index, row each job, title of each factor column heading, , scores of each job value in cell. i expect have in app/admin/jobs.rb file: index |jobs| column :title jobs.scores.each |score| column(score.factor.name) { |score| score.score } end end and output this: job | education | experience | leadership | ... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ceo | 600 | 720 | 580 | ... | admin assistant | 210 | 200 | 150

node.js - Webstorm Unexpected Token export -

i having "unexpected token export" issue in webstorm has not been solved other stackoverflow posts. trying use import/export module functionality package.json , bar.js code below. using node.js 5x, babel 6, , have file watcher setup babel transforms on fly. the code should speak itself, , appreciate thoughts on how resolve it. again, have tried other stackoverflow suggestions no luck @ point. //bar.js 'use strict'; export class bar{ constructor(){ this.tempish = 'allo'; } } //bar-compiled.js 'use strict'; object.defineproperty(exports, "__esmodule", { value: true }); function _classcallcheck(instance, constructor) { if (!(instance instanceof constructor)) { throw new typeerror("cannot call class function"); } } var bar = exports.bar = function bar() { _classcallcheck(this, bar); this.tempish = 'allo'; }; //# sourcemappingurl=bar-compiled.js.map //index.js 'use strict'

sql - Count DateTime Stamp For Results -

i have table containing list of userids , datetime stamp when transaction carried out. looks following: userid | stamp john11| 01/01/2013 01:15:27 i return query shows period of time how many transactions each user has done. i have tried count due time part of stamp counts each individual millisecond rather overall. thanks in advance use time_to_sec function actual value. select count(userid), userid table time_to_sec(stamp) between fromtime , totime -- fromtime , totime interval period

php - Getting the recent row by JOIN & GROUP BY? -

Image
this table album , it's structure , data is, this table photos , it's structure , data is, i list album name, total photos corresponding album, last uploaded image join , group by. this codeigniter query i'm using right now. works except fetches first row of image column value instead of latest one. $query = $this->db->select('albums.name, photos.image, albums.created, albums.id, count(photos.id) total') ->from('photos') ->join('albums', 'albums.id = photos.album_id') ->order_by('photos.id', 'desc') ->group_by('photos.album_id') ->limit($limit, $offset) ->get(); the generated sql query above is, select `albums`.`name`, `photos`.`image`, `albums`.`created`, `albums`.`id`, count(photos.id) total `photos` join `albums` on `albums`.`id` = `photos`.`album_id` group `photos`.`album_id` order `photos`.`id` desc limit 10 for both

ios - React Native ListView with fixed section header that can be updated -

i made section header in listview responds state changes realised need fixed. upon changing renderheader rendersectionheader fixed no longer responds state changes. <listview datasource={this.state.datasource} renderheader={this.renderheader} renderrow={this._renderrow} /> renderheader: function() { return ( <view> <text>{this.state.header}</text> </view> in way if state changed, text (or whatever is) update accordingly. when scrolling list header not fixed. <listview datasource={this.state.datasource} rendersectionheader={this.rendersectionheader} renderrow={this._renderrow} /> rendersectionheader: function() { return ( <view> <text>{this.state.header}</text> </view> with code above however, section header fixed in place when scrolling when making alterations state strangely not update in section header ordinary header. if use rendersec

sql server - php script enters duplicate data in database -

i have php script runs stored procedure sql server , enters data in table present in database. when run php script enters duplicate date same data present in database. need rid of these duplicate data. stored procedure gives me correct output php script troubling me while ($obj = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc )) { if($obj['bank_name']!= $obj['bank_name_old']) { $obj['company_code']; $obj['account_code']; $obj['bank_name']; $obj['bank_name_old']; $obj['field_name']='bank name'; if($obj['field_name']='bank name') { $old=$obj['bank_name_old']; $new=$obj['bank_name']; } $query="insert vns_db.dbo.client_details_log (company_code,client_id,field_name,original_value,new_value) values

javascript - add unlimited input fields with prototype -

i adding unlimited input field. below code working fine 1 problem adding after first <tr> . not adding field after additional <tr> . if click on add option adding <before> or after first <tr> . ignoring others <tr> . my html <table width="100%" cellspacing="0" id="orderchecklist_item_grid_servicecenters" class="data border"> <colgroup><col width="120"> <col> <col width="100"> <col width="70"> </colgroup><thead> <tr class="headings"> <th width="80%">item</th> <td width="10%" class="last"><button style="" onclick="addfield();" class="scalable add" type="button" title="add option" id="add_new_option_button"><span><span>&l

java - When I generated release APK with proguard I am getting errors -

how resolve error? warning:com.parse.parseokhttpclient: can't find referenced class com.squareup.okhttp.headers warning:com.ocpsoft.pretty.time.web.jsf.prettytimeconverter: can't find referenced class javax.faces.context.facescontext warning:exception while processing task java.io.ioexception: please correct above warnings first. error:execution failed task ':project1:transformclassesandresourceswithproguardforrelease'.<br> java.io.ioexception: please correct above warnings first. add proguard-rules.pro file in project: -keep class com.squareup.** {*;} -dontwarn com.squareup.** -keep class com.ocpsoft.** {*;} -dontwarn com.ocpsoft.**

java - PDF parser text contains -

i want verify pdf document using testng , pdfbox. i ask, pdf able check contains text this: pdfparser parser = new pdfparser(stream); parser.getdocument().conntains("abc") try below code:- public void readpdf() throws exception { url testurl = new url("http://www.axmag.com/download/pdfurl-guide.pdf"); bufferedinputstream testfile = new bufferedinputstream(testurl.openstream()); pdfparser testpdf = new pdfparser(testfile); testpdf.parse(); string testtext = new pdftextstripper().gettext(testpdf.getpddocument()); assert.asserttrue(testtext.contains("open setting.xml, can see this")); } download libraries :- https://pdfbox.apache.org/index.html

dependency injection - How to resolve and create Generic Classes in AngularJS Injector -

have class below, export class siteeventservicetype<t> { } how need create instance above class using angularjs 2 injector. tried not working: injector.resolveandcreate([siteeventservicetype<string>]).get(siteeventservicetype<string>); this example posted quite while @ https://github.com/angular/angular/pull/1779 @component( selector: 'my-component', // providers: injectables: const [ const binding( const typeliteral<stream<string>>, tofactory: mycomponent.streamfactory) ] ) @view( directives: const [mychildcomponent], template: '<my-child-component></my-child-component>' ) class mycomponent { static stream<string> streamfactory() => new stream.fromiterable(['hello']); } @component( selector: 'my-child-component' ) @view( template: '{{lastvalue}}' ) class mychildcomponent { string lastvalue; mychildcomponent(stream<stri

ASP.NET Can't access user control's property in code-behind file -

visual studio 2008, c#, asp.net need make multiple copies (or instances) of web user control programmatically. i have usercontrolfile.ascx contains asp:label id=" vhlabel " in it. in file set label's text property through public string vhtext variable, usual: public string vhtext { set { vhlabel.text = value; } } there divs , other html data in file cannot created in c# programmatically, have use ascx file. now, in code-behind file need to: clone user control many times; set unique value label's property "text" of each clone through "vhtext" variable. please, share suggestions on these issues. if need, can show code here. i've been looking answer long, still unsuccessful. you can find walkthrough of how programmatically add user controls page here: http://msdn.microsoft.com/en-us/library/c0az2h86(v=vs.100).aspx in case, need in usercontrolfile.ascx control (the classname attribute importa

python - I have installed pil with conda but when I try to import it, it says no module exists -

Image
i have installed pil conda when try import it, says no module exists. have tried import module in uppercase? in [3]: import pil --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-3-2fdcc9532329> in <module>() ----> 1 import pil importerror: no module named pil in [4]: import pil in [5]: pil out[5]: <module 'pil' '/usr/lib/python2.7/site-packages/pil/__init__.pyc'>

java - How to use text-search in mongo-spring aggregate -

how translate simple mongo shell $match phrase, it's equivelent in mongo-spring in java - using aggregation? $match: { $text: { $search: "read" } } spring-data has inbuilt support text search. i have used following dependency : <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-mongodb</artifactid> <version>1.8.2.release</version> </dependency> try following syntax : textcriteria criteria = textcriteria.fordefaultlanguage().matchingany("read"); query query = textquery.querytext(criteria); list<klass> list = mongotemplate.find(query, klass, "collection_name"); for more detail refer this . to same in aggregation use following syntax : basicdbobject match = new basicdbobject("$match", new basicdbobject("$text", new basicdbobject("$search", "cost"))); list<dbobject&g

How to connect Parse.com database to Amazon Redshift / other data warehousing tools -

i'm trying setup data warehouse combine our parse data events/analytics data , make easy analytics atop our data. @ moment, we're trying set amazon redshift. with databases, jdbc or odbc connector work given parse doesn't allow direct database access, i'm not aware if/how use these connectors. how can connect parse redshift instance? or alternatively, there other tools data warehousing/doing analytics atop parse + events data work better redshift?

c++ - why cannot find std::pair in netbeans on ubuntu -

i have configured c/c++ in netbeans on ubuntu , when try use std::pair seems compiler cannot find strange default version of c++ c++11 slice of code int n, k; cin >> n>>k; vector<pair<int,int> > x(n); thanks in advance you need include right header files beginning of source files compiler know different types/objects: #include <iostream> // std::cin #include <vector> // std::vector #include <utility> // std::pair and use std namespace default if want (before main() typically): using namespace std;

c# - Filtering on multiple DataTables with First DataTable -

i trying export database tables details multiple worksheets inside single excel file , got export working correct, issue multiple datatable filtering first datatable email id. below c# code: protected void button1_click(object sender, eventargs e) { dataset ds = new dataset(); datatable dt = new datatable("registration details"); datatable dt1 = new datatable("education details"); dt = bl.get_registrationdetailsbydate1(bo); dt1 = bl.get_registrationdetailsbydate2(bo); ds.tables.add(dt); ds.tables.add(dt1); excelhelper.toexcel(ds, "users.xls", page.response); } i have 2 tables registration_table , education_table , have 2 datatable registration details , education details. i need result base on email id's of first datatable(dt) first datatable emails id's users should come second datatable means education details based on email ids. suppose below first datatable details. sno email

django - Deleted migration files- how to makemigrations without losing data -

i changed field on model class (which has no classes point to it, 1 foreign key pointing out of it). somehow, stuffed migrations , keeps saying "django.db.migrations.graph.nodenotfounderror:" looking migration files not exist. i accidentally deleted several files in 'migrations' folder. my database contains lot of data, , not want break it. will lose data if i: remove table caused problem in first place (psql, \d, drop table tablename) delete migration files re run migration start? ./manage.py makemigrations ./manage.py migrate can recommend way of fixing this? here traceback: http://dpaste.com/0y1ydxs aren't using git can migration files back? if not, install , use it, starting now i suggest: make backup/dump of database first , in case goes wrong delete migrations empty migration table in psql call makemigrations call migrate --fake-initial

Get Geopoints from parse.com javascript -

i have succesfuly stored geopoints in parse.com , in page want console log them can place them variables , put 1 marker in google map. i'm trying code them sure miss thing , need advice. parse.initialize("appid", "jskey"); var photoobject = parse.object.extend('magazia'); var photoobject = new photoobject(); var query = new parse.query(photoobject); query.select('latlon'); query.find({ success: function(locationlist) { alert("successfully retrieved " + locationlist.length + " locations."); (var = 0; < locationlist.length; i++) { var locationsblock = {}; locationsblock = json.parse(json.stringify(locationlist[i])); var location = {}; location = json.parse(json.stringify(locationsblock.geolocation)); alert(location.latitude); }; }, error: function(error) {

javascript - textfield is hiding once we click on update button, again visible after refresh the page -

Image
we using magento marketplace multi-vendor site, means sellers can sell products through site. we displaying price in frontend using following code : phtml <input onfocus="showpricecancel('<?php echo $products->getid(); ?>');" class="ama1" type = "text" id = "price_<?php echo $products->getid(); ?>" onkeydown="validatenumbers(event)" name= "price[]" value = "<?php echo $products->getprice(); ?>" style = ""/> <input type="hidden" name="curr_<?php echo $products->getid(); ?>" id="curr_<?php echo $products->getid(); ?>" value="<?php echo $products->getprice(); ?>" /> <p id="updatedprice_<?php echo $products->getid(); ?>" style = "display:none;color:red; position:relative; top:16px;">updated</p> <br/> <button style="display:none;&q