Posts

Showing posts from September, 2013

javascript - Losing the expression in debugger -

i trying regular expression remove junk on string getting service. string has phone data want remove. example string "en-us; droid4 build/9.8.2o-72_vzw-18" . first task drop "build/" end of string or end of word (not sure better in scenario). i ended with: var deviceregexpr = new regexp("\b(build\/\s*)"); first off, not sure if best way accomplish this. but, when looking @ chrome debugger tools regexp value showing "/(build/s*)/" . cant figure out happening \b ? thanks in advance help. this string#replace(regex, repacement) should work: var repl = "en-us; droid4 build/9.8.2o-72_vzw-18".replace(/\s*\bbuild\/.*$/, ""); //=> en-us; droid4

postgresql - pgsql select for update multiple tables -

i have following plpgsql function: create function user_delete( in id int4 ) returns void $body$ begin delete user_role user_id = id; delete user_permission user_id = id; delete permission_cache user_id = id; delete access user_id = id; delete "user" user_id = id; end; $body$ language plpgsql volatile; is possible lock rows related used_id in tables single select update query? you wouldn't need use explicit locks unless have race condition , heavy concurrent load in application. it's best streamline write access, processes access tables , rows in same order avoid deadlocks. delete commands collects locks fast select update does. i don't think possible single select update . lock rows in tables sequentially: perform 1 user_role x x.user_id = id update; perform 1 user_permission x x.user_id = id update; ... locks collected "as go" , released @ end of transaction. since function inside transaction a

using gsub in ruby strings correctly -

i have expression: channelname = rhash["channel"].gsub("'", " ") it works fine. however, can substitute 1 character it. want add few more characters substitue. tried following: channelname = rhash["channel"].gsub(/[':;] /, " ") this did not work, there no substitution done on strings , no error message. tried this: channelname = rhash["channel"].gsub!("'", " ") this lead string blank. absolutely not desired. i have gsub method substitute following characters space in string: ' ; : my questions: how can structure gsub method instances of above characters replaced space? what happening gsub! above returning blank. your second attempt close. problem left space after closing bracket, meaning looking 1 of symbols followed space . try this: channelname = rhash["channel"].gsub(/[':;]/, " ")

json - How to pass JSP array to Javascript of highchart to generate a column chart -

i novice in highcharts, jsp , javascript , need input , suggestion on issue, have been struggling since 4-5 days. please me. the issue able 2 output arrays jsp need pass in highchart js generate column graph. [99, 90, 87, 82, 80, 77, 70, 65, 65, 60] , ['orcl2','orcl2','orcl2','orcl2','orcl1','orcl1','orcl3','orcl2','orcl3','orcl1'] but not able pass value js generate column graph. following entire code using. please suggest me going wrong. <%@ page language="java" import="java.sql.*, java.io.*, java.util.date, java.util.*,javax.servlet.*, java.text.simpledateformat, java.util.calendar " %> <% class.forname("oracle.jdbc.driver.oracledriver"); %> <% connection connection=drivermanager.getconnection ("jdbc:oracle:thin:@rac1.dinu.com:1521:orcl2","cog","cog123"); statement statement12 = connection.createstatement()

ruby - Running Rake::Pipeline.build inside of Rakefile -

i'm trying kick off rake pipeline task inside rakefile. can tell process example here . however, isn't working. here gist reducing example barebones . it shows reduced test case works using rake-pipeline's assetfile, when trying include same exact code in rakefile doesn't work. why failing? what solution make work? (no cheating , running system call part of rakefile.) thanks help! works it looks 1 way handle execute file, so: project = rake::pipeline::project.new('assetfile') # project.clean # required rake-pipeline 0.7.0 project.invoke however, annoying have create file every single rake task. doesn't work looking @ code rake::pipeline should allow me pass in pipeline, such code works: pipeline = rake::pipeline.build output "js" puts dir.pwd input "js" match "*.js" # concatenate js files single file filter rake::pipeline::concatfilter, "application.js"

lua - how draw ring with transparent internal background (corona sdk) -

how draw ring transparent internal background (corona sdk). dipslay.newcircle draw circle not ring. try this local circle = display.newcircle (100,100,200) circle:setfillcolor(0,0,0,0) --this set fill color transparent circle.strokewidth = 3 --this width of outline of circle circle:setstrokecolor(255,0,0) --this color of outline

ruby on rails 3 - generating xls documents representing model objects keep being read as corrupt in excel 2010 -

i'm generating xls document each item of model weeklyreport. have basic structure of document working, i'm finding small changes keep making file read corrupt , unopenable excel 2010, , don't understand why. i've been using railscast here: http://railscasts.com/episodes/362-exporting-csv-and-excel figure out how this. in model controller, have following: def show @report=weeklyreport.find(params[:id]) @engagements=@report.engagements end def index @reports=weeklyreport.all respond_to |format| format.html format.xls end end and in show.xls file, have following: <?xml version="1.0"?> <workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/tr/rec-html40">

jquery - Foundation 3 post ajax drop down buttons -

i using foundation 3 website did while , uses dropdown buttons. everything's fine have load form , buttons via ajax. buttons came in via ajax not work (they won't open). far unable find solution. tried calling: $(document).foundationbuttons(); or $(myselector).foundationbuttons(); after ajax call completed both result in breaking dropdown buttons on entire page. please help. thanks. this code loading via ajax. <div href="#" class="button dropdown"> edit <ul> <li><a href="#" class="internal">internal data</a></li> <li><a href="#" class="external">external data</a></li> <li class="divider"></li> <li><a href="#" class="settings">settings</a></li> </ul> </div> the call going through regular jquery $.ajax(); ro

c# - How to execute a shell command in the current cmd.exe context? -

so, have .net utility. need use utility(ilasm , ildasm) sometimes in path variable , not. specific times when it's in path includes when using visual studio command line script.. , when it's not when launch regular cmd.exe instance. all of information i've seen executing shell command .net imply can create new instance of cmd.exe, in case, path variable different. other possible thing manually parsing path variable , execute directly processstartinfo when found, seems error prone , unnecessary is there tool or me situation? how should go executing these utilities? when start cmd.exe, can set environment path: var psi = new processstartinfo("cmd.exe"); psi.useshellexecute = false; psi.environmentvariables["path"] = "mypath"; process.start(psi); please prefer comment before downvote.

I cannot get the InputOutput direction to work for a stored procedure on Azure Sql -

i have created following stored procedure in azure sql. alter procedure [dbo].[composite_shop_getnextordreno] @orderprefix nvarchar(50) output, @istestmode int = 0 declare @nextordernumber int if not exists (select top 1 [orderprefix] [dbo].[composite_shop_ordernumber] [orderprefix] = @orderprefix) begin insert [dbo].[composite_shop_ordernumber] (orderprefix) values (@orderprefix) end update [dbo].[composite_shop_ordernumber] (readcommittedlock) set @nextordernumber = number = number + 1 [orderprefix] = @orderprefix select @orderprefix = @orderprefix + replicate('0', 6 - len(rtrim(convert(nvarchar(50), @nextordernumber)))) + convert(nvarchar(50), @nextordernumber) return no matter try c# have not succeeded in giving 1 parameter , getting out again modified. intutively assume should work don't. var param = new sqlparameter("@orderprefix",sqldbtype.n

javascript - Chat application polling -

i'm working on chat application, polls server @ timeout. timeout increases if, on time, there hasn't been recent activity. function loadnew() performs ajax call server, responds message data. polltimeouttime = 500; function poll() { polltimeout = settimeout(function(){ loadnew(); if (!new_messages_count) { //increasing delay between polls no messages incoming maximum of 1 minute/60 seconds if (polltimeouttime < 60000) polltimeouttime = polltimeouttime * 1.25; } else { //reset delay between poll default of 0.5 seconds polltimeouttime = 500; } poll(); },polltimeouttime); } the problem i'm having timeout function not wait function loadnew() complete, causes same poll sent twice or more if timeout lower time takes ajax call in function complete. server responds same data multiple times, leads duplicative display of messages in chat. is there way make timeout t

factory girl - How do I use factories from FactoryGirl in rails console -

i using rails console in development environment , want use factories. how can access them? i have tried require "factorygirl" returns 1.9.3p393 :301 > require "factorygirl" loaderror: cannot load such file -- factorygirl to solve problem ensure factory girl gem specifed in gemfile similar this group :development, :test gem 'factory_girl_rails' end then bundle install . this should make factorygirl class available in development console. hope helps.

Dynamically generate html table with php of mysql records -

the reason complicated (for me) each column of table loaded separate mysql table, , each mysql table have varying number of records. thought start generating html table top-left bottom-right column column , cell cell, won't work because each mysql table have different length of records, generate malformed html tables. have suggestions? my idea far: get list of tables in mysql, determine number of columns get count table records create table parameters (# of tables columns, max# rows update each cell corresponding record, not quite sure how as requested, code: $tables = mysql_query("show tables"); $output = "<table border=1><thead><tr>"; while($table = mysql_fetch_array($tables)) { $output .= "<td>"; $output .= $table[0]; $output .= "</td>"; $tablenames[] = $table[0]; } $output .= "</tr></thead>"; $output .= "<tbody>"; //get count of table records for($i

javascript - Angular: share asynchronous service data between controllers -

i "bind change" of asynchronous data between controllers. i know it's bit confusing hope possible. in following example, if write in input, works great: http://jsfiddle.net/victa/9nrs9/ html : <div ng-app="myapp"> <div ng-controller="controllera"> controllera.message = {{message.hello}}<br/> <input type="text" ng-model="message.hello"/> </div> <hr/> <div ng-controller="controllerb"> controllerb.message = {{message.hello}}<br/> <input type="text" ng-model="message.hello"/> </div> </div> js : angular.module('myapp', []) .factory('myservice', function($q, $timeout) { var message = { hello: 'hello world' }; return { getmessage : function(){ return message; } }

html - CSS horizontal menu with variable width from parent div -

i'm trying create horizontal menu width of parent div , links arranged in equal distances. target create navigation bar width of 900px. maybe possible realize on way? i'm newbie in css , don't know how fix problem , hope me! #nav { background:red; width:900px; } ul#nav-bar, ul#nav-bar ul{ margin:0; list-style:none; padding:0; background: white; border: 1px solid black; } ul#nav-bar ul{ display:none; position:absolute; left:0; } ul#nav-bar li:hover>*{ display:block; } ul#nav-bar li{ position:relative; display:block; white-space:nowrap; font-size:0; float:left; } ul#nav-bar li:hover{ z-index:1; } ul#nav-bar{ font-size:0; z-index:999; position:relative; display:inline-block; zoom:1; padding:0; *display:inline; } * html ul#nav-bar li a{ display:inline-block; } ul#nav-bar>li{ margin:0; } ul#nav-bar a:active, ul#nav-bar a:focus{ outline-style:none; } ul#nav-bar a{ display:block; vertical-align:middle; text-align:center; text-decoration:none; font: 12px arial

xslt - SharePoint XSL Counter -

so i've been banging head against wall while , looking help. i'm trying create new itemstyle in sharepoint designer checks each item in task list , tallies total number of completed, in progress, , not started statuses. problem knowledge, xsl doesn't have mutable variables. have far this: <xsl:variable name="schk"> <xsl:value-of select="@status"/> </xsl:variable> <xsl:for-each select="@status"> <xsl:if test="$schk = 'completed' "> <!-- add completed counter --> </xsl:if> <xsl:if test="$schk = 'in progress' "> <!-- add in progress counter --> </xsl:if> <xsl:if test="$schk = 'not started' "> <!-- add not started counter --> </xsl:if> <br/> </xsl:for-each> out of loop: total completed:

laravel 4 hybridauth on multiple routes -

i'm trying switch codeigniter laravel. i have implemented hybridouth method successful, seems working route it's specified on. i've tried searching tutorials , examples show auth working on 1 route. how can give function along every route check if user logged in? group auth needed. route::group(array('before' => 'auth'), function() { // routes auth needed }); this seems call normal auth , i'm using hybridauth route::get('social/{action?}', array("as" => "hybridauth", function($action = "") { if ($action == "auth") { try { hybrid_endpoint::process(); } catch (exception $e) { return redirect::route('hybridauth'); } return; } try { $socialauth = new hybrid_auth(app_path() . '/config/hybridauth.php'); $provider = $socialauth->authenticate("facebook"); $userprofile = $provider->getuserprofile(); } catc

Remove button on Rails page does not work -

i have 2 rails sites (bargain stock funds , doppler value investing) use ransack gem. in bargain stock funds search page ( http://www.bargainstockfunds.com/funds ), should able remove default criteria pressing "remove" buttons. unfortunately, remove button not work. however, remove button work in development environment. life of me, can't figure out why remove button works in local environment not in production environment. i'm using similar setup on doppler value investing search page ( http://www.dopplervalueinvesting.com/stocks ), remove button works in both local environment , production environment. my questions: 1. there way troubleshoot this? there log files need at? 2. postgresql database problem? thought of this, logging webfaction , looking around didn't uncover anything. (for know, irrelevant issue.) 3. how remove button work in search form? the source code bargain stock funds site @ https://github.com/jhsu802701/bsf . the sourc

jquery - Ajax request to PHP page and exec(ssh....) not working -

i posting php page using ajax (ignore data posted, thats not important) when run php page on linux server using command: php addhit.php correctly echoes out hostname of remote server. not happen in ajax, blank alert success function is. can see in action here: http://ec2-54-244-169-118.us-west-2.compute.amazonaws.com/bootstrap/jumbotron-narrow/index.php <script> $(function() { $("form[name=addhit]").submit(function() { alert("i alert box!"); var link = $("input[name=link]").val(); var comments = $("input[name=comments]").val(); var datastring = "link="+link+"&comments="+comments; alert(datastring); $.ajax({ type: "post", url: "/bootstrap/jumbotron-narrow/addhit.php", data: datastring,

Simulating ML-style pattern matching in C++ -

the title says pretty all, how go simulating ml-style pattern matching in c++, instance; statement *stm; match(typeof(stm)) { case ifthen: ... case ifthenelse: ... case while: ... ... } where 'ifthen', 'ifthenelse' , 'while' classes inherit 'statement' there paper in c++ committee describe library allow that: open , efficient type switch c++ stroustup, dos reis , solodkyy http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3449.pdf a link page source code : https://parasol.tamu.edu/~yuriys/pm/ disclaimer : didn't try compile or use library, seem fit question. here 1 of sample provided library : #include <utility> #include "match.hpp" // support match statement //------------------------------------------------------------------------------ typedef std::pair<double,double> loc; // algebraic data type implemented through inheritance struct shape { virtual ~sh

django - Sending iOS push notifications with python and PyAPNS -

i trying figure out how send push notifications python/django app. found code online works when run terminal prompts me enter in pem passphrase manually , don't know how set works on it's own. from apns import apns, payload apns = apns(use_sandbox=true, cert_file='/users/user/desktop/lunch-boxcert.pem',key_file='/users/user/desktop/lunch-boxkey.pem') token = '923...8b4' # send notification payload = payload(alert="hello world!", sound="default", badge=1) apns.gateway_server.send_notification(token, payload) when run calling python manage.py runserver blocks until type passphrase terminal. anyway know how solve this? i ended removing passkeys. openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem i kind of followed tutorial here: https://blog.serverdensity.com/how-to-build-an-apple-push-notification-provider-server-tutorial/

php - PDO connection object not passing to a class -

ok, 2 separate php files, 1 main script, other class. i'm trying connect sql database pdo. create pdo connection in main script, pass class in other script, queries made. however, getting following error : fatal error: call member function prepare() on non-object in /applications/xampp/xamppfiles/htdocs/test/class.php on line 16 my understanding php pass references objects across scripts, error says object not exist. below main php script, creates pdo object , passes class played with. <?php session_start(); unset($_session['reference']); require('class.php'); //connect database, know username , password not included $dsn = 'mysql:dbname=test;host=localhost'; try { $dbh = new pdo($dsn); $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) { die ( 'connection failed: ' . $e->getmessage() ); } $objreference = new reference($dbh); $reference = $objreference->getreference(); $_s

How to draw a sphere in OpenGL ES 2 correctly -

i wondering difference between gldrawarrays , gldrawelements is? use , when? question have how draw sphere android. have 360 points on perimeter circle, mean need 360 * 360 coordinates sphere? seems expensive, there has better way. way can think of far doing nested loops. that's going processor time. way can think of drawing , rotating 360 degrees in direction. it's not true sphere, rotated circle. "i wondering difference between gldrawarrays , gldrawelements is?" gldrawarrays used when deal directly stream of vertices, , gldrawelements used when use index buffer, adds layer of indirection , lets reference vertices index number. can check out article more info on gldrawelements (disclaimer: wrote article): http://www.learnopengles.com/android-lesson-eight-an-introduction-to-index-buffer-objects-ibos/ the opengl es manual has info these 2 functions: http://www.khronos.org/opengles/sdk/docs/man/xhtml/gldrawarrays.xml http://www.khronos.org/

sql server 2012 - TSQL Text Comparison or Update Top 4000 rows of a query -

i'm learning t-sql , familiar access trying move on sql due leads database size. i know how select top 40000 rows, don't know how update field in query based on that. tried use less in phone field, issue phone number text field , won't work in sql works in access. other ideas? update tblleadscamp set tblleadscamp.subcampaign = @newname ((tblleads.phone)>'81455152') , tblleads.resi = 1 tblleads inner join tblleadscamp on tblleads.phone = tblleadscamp.phone) to update top 4000 records can update top(4000) tblleadscamp set subcampaign = @newname or using method - update tblleadscamp set tblleadscamp.subcampaign = @newname tblleads inner join tblleadscamp on tblleads.phone = tblleadscamp.phone cast(cast(tblleads.phone varchar(10)) int) > 81455152 , tblleads.resi = 1

ios - Conditional Navigation Controller Root -

i have tab bar controller navigation controller. want change navigation controller's root view depending on whether or not user logged in. how do this? don't want put code in didfinishlaunchingwithoptions: or other appdelegate method because won't first thing users see. you're right, supposed be: - (void) gonext { nextviewcontroller* nextwindow = [[nextviewcontroller alloc] initwithnibname:@"nextview" bundle:nil]; [self.navigationcontroller setviewcontrollers:[nsarray arraywithobject:nextwindow] animated:yes]; } since can't pop root view controller, following method can used instead: - (void)setviewcontrollers:(nsarray *)viewcontrollers animated:(bool)animated here's link apple docs method.

javascript - Is this the optimal way to perform operations to MongoDB through a node.js? -

i've writen code start connection mongodb server , inside such connection perform web services code. is optimal or safe way? better ways implement this? var express = require("express"); var mongodb = require("mongodb"); var servidor = new express(); var bson = mongodb.bsonpure; servidor.use(express.static(__dirname+"/publico")); servidor.use(express.bodyparser()); var cliente_mongodb = mongodb.mongoclient; cliente_mongodb.connect("mongodb://localhost/db_escuela", function(err, db_escuela){ if(err){ console.log("error de conexion"+err); }else{ console.log("se ha conectado la base de datos"); var cl_alumnos = db_escuela.collection("cl_alumnos"); servidor.get("/alumnos",function(peticion, respuesta){ cl_alumnos.find().toarray(function(err,respuesta_db){ respuesta.send(respuesta_db); }); }); servid

Parsing Java source code to find classes, attributes and methods -

this question has answer here: java source code parsers/generators [closed] 4 answers i'm doing experiment , have map classes , attributes , methods respective code in java. i'd know what's best approach parse .java file , find classes there in files, attributes , methods. i've seen in other topics building own lexical analyser not idea, there're libraries hard work. found it's possible files included in project calling methods in java, not external .java files. can light me up? in advance you can use source code scan tool pmd , pmd checks source code against rules , produces report. this: something passes file name , ruleset pmd pmd hands inputstream file off javacc-generated parser pmd gets reference abstract syntax tree parser pmd hands ast off symbol table layer builds scopes, finds declarations, , find usages. if rules n

python - Django 1.5 - adding base class for models and views -

i trying add base class models defined in different apps. created package lib/base.py : from django.db import models import logging # instance of logger logger = logging.getlogger(__name__) class base(models.model): class meta: abstract = true now in different home apps directory, use base model: from django.db import models libs.base import base # create models here. class home(base): msg = models.charfield(max_length=100) @classmethod def create(cls, msg): home = cls(msg=msg) # book return home when run server, following error: file "/users/.../home/models.py", line 2, in <module> libs.base import base importerror: no module named libs.base i cannot find missing here? you should append libs module installed apps of project: settings.py: ... installed_apps = ( ... 'home', ... 'libs', # add this! ) ...

sql server 2008 - EF insert not follow db auto increment(DB First) -

Image
.edmx <property name="uid" type="int" nullable="false" storegeneratedpattern="identity" /> ef had set storegeneratedpattern = "identity", why still cannot save db? debug show value 0, guess quite correct server not return value web before inserting, model validate false , , had go through c#, entity framework, auto increment , autonumber entity framework no luck, doing wrong? idea? update 1: added model , meta data picture, forgot mention im using ef db first generate class asp.net mvc view <div class="editor-field"> @html.hiddenfor(model => model.uid) </div> asp.net mvc controller [httppost, validatejsonantiforgerytoken] public jsonresult create(basicuserinfo basicuserinfo) { if (modelstate.isvalid) { db.basicuserinfoes.add(basicuserinfo); db.savechanges(); } else {

python - Big Theta bound of 2 recursive calls -

given f(x, y) , g(n) : def f(x, y): if x < 1 or y < 1: return 1 return f(x - 1, y - 1) + f(x - 1, y - 1) def g(n): return f(n, n) what big theta bound of g(n) ? i reasoned since x == y, conditional in f(x, y) never true, 2 recursive calls determine complexity. considering f(x - 1, y - 1) : takes n recursive calls reach base case, each call branches f(x - 1, y - 1) . @ point don't know how proceed. (the answer Θ(2 n ).) one way solve problem write recurrence relation problem. if you'll notice, arguments f equal 1 (you can see because start same in call g(n), , @ point equal). therefore, can write recurrence relation t(n) determines runtime of f(n, n). so t(n) be? well, base case, t(0) 1, since function constant amount of work n drops 0. otherwise, function constant amount of work , makes 2 recursive calls problems of size n - 1. therefore, recurrence: t(0) = 1 t(n+1) = 2t(n) + 1 looking @ terms of recurrenc

python - pyqt: Memory Usage -

i have program , in it, creates tabs, , every time create 1 memory usage goes up, when close tab out memory doesn't go down. wondering, normal, , there can it? here code closing out tabs: def removetab(self, index): text[index].deletelater() del text[index] # text box # reorganize dict last = -1 key in sorted(text): if last+1 != key: text[key-1] = text[key] del text[key] last += 1 self.tab_widget.setcurrentindex(index) widget = self.tab_widget.currentwidget() self.tab_widget.removetab(index) # remove tab widget.deletelater() del widget to put crudely: the amount of memory available python application can grow during lifetime, can never fully shrink started. there no way force python release unused memory system. so best can try manage amount memory grows . 1 obvious way delete unneeded objects, newly created objects can re-use memory has been allocated. but if application seems unable re-use memory? either means

iphone - Obj-C: Incompatible pointer types assigning to 'UITextfield *_strong' from 'NSNumber *_strong -

ok ive looked @ other similar questions cant figure out why nsnumber not compatible uitext field. my .h @property (weak, nonatomic) iboutlet uitextfield *initialbudget; @property (weak, nonatomic) iboutlet uitextfield *expenses; @property (weak, nonatomic) iboutlet uitextfield *timespent; @property (weak, nonatomic) iboutlet uitextfield *incomeperhour; these calculations - (ibaction)calculateresults:(id)sender { double budget = [initialbudget.text doublevalue ]; double expense = [expenses.text doublevalue]; double time = [timespent.text doublevalue]; double hourlyincome = (budget - expense)/time; nsnumber *resultnumber = [[nsnumber alloc] initwithdouble:hourlyincome]; incomeperhour = resultnumber; } any great, thanks you want set uitextfield's text property. [incomeperhour settext:[resultnumber stringvalue]]; bye ! edit : can without nsnumber : [incomeperhour settext:[nsstring stringwithformat:@"%f", hourlyincome]];

.net - How to return custom datetime format in WCF REST Service? -

as know,we can define method called client in wcf rest service this: [webinvoke(uritemplate = "validatelogin", method = "post", responseformat = webmessageformat.json)] public validationclass validatelogin(requestobject obj){...} the object validationclass contains datetime type property. it return result below client. { "isvalid":true, "returnmessage":"string", "tokenid":"string", "zones":[{ "dayofweek":"string", "end_time":"\/date(928120800000+0800)\/", "id":2147483647, "phone_no":"string", "start_time":"\/date(928120800000+0800)\/" }], "zonesopen":[{ "id":2147483647, "position_end_time":"\/date(928120800000+0800)\/", "position_start_time":"\/date(928120800000+0800

android - Scanning local IP address socket programming -

im developing socket-base system between android , ios app. ios acts server (using bourjour publish service). android apps act clients, scan servers, display list of servers on list-view , connect server user-will. both run on emulators (real devices eventually). got specific port system, says 49300 example. problem that, there many local ip addresses scan (192.168.x.x), 255 * 255. develop queue task execute job. here flow: scan subnet for-loop x = 0 -> 255 scanner >= (queue = 5) wait(); new thread scan 192.168.x.y for-loop y = 0 -> 255 scanner++ scanning thread: scan 192.168.x.y for-loop y = 0 -> 255 if 192.168.x.y reachable add list end scanner--; notify(); but seems it's work app do, android simulator shutdown, helps appreciated.

shell - How can I share options parsing code within bash functions when using getopts? -

how can clean options parsing code in bash function? copy-pasted number of functions need have simple "-h" flag printing usage. rather have generic routine logical equivalent of local prefix_opt1 local prefix_opt2 .... __handle_opts "usage message" "additional getopts flags" "prefix" for example: local foo_k local foo_v __handle_opts "usage: ${funcname[0]}" [-k key -v version] widget\nbuild widget using key , version." "k:v:" "foo_" if [[ -z $foo_k ]] ; foo_k="default value" fi ..... the functions "sourced" in one's dot-bashrc file. here code looks (note: of functions take options via flags): function kitten_pet { local usage="usage: ${funcname[0]} [-h] <kitten>\npet kitten." ################################################ local help=0 local error=0 local optind local opt while getopts ":h" opt "$@" case $opt

datetime - DeliveryDate in Order Item Grid not sorting correctly -

i have created sales order item grid in admin panel in magento. grid displays display date correctly. when try sort based on delivery date not work. include delivery date follows: $this->addcolumn('proptions', array( 'header' => mage::helper('sales')->__('delivery date'), 'index' => 'proptions', 'renderer' => new bakery_core_block_adminhtml_renderer_data(), 'type' => 'datetime', )); in renderer_data following: $val = substr($_option['value'],0,10); //returns format dd/mm/yyyy $val = str_replace("/","-",$val); //returns dd-mm-yyyy $datetimestamp = mage::getmodel('core/date')->timestamp(strtotime($val)); $format_val = date('d m y', $datetimestamp); // returns e.g. 13 aug 2013 i have set type in grid column datetime. still

ubuntu 12.04 - warning in django installation via pip -

when try install django keep getting warning. tried solution mentioned in question still same should ? my virtual os ubuntu in vagrant. downloading/unpacking django==1.5.1 downloading django-1.5.1.tar.gz (8.0mb): 8.0mb downloaded running setup.py egg_info package django warning: no previously-included files matching '__pycache__' found under directory '*' warning: no previously-included files matching '*.py[co]' found under directory '*' installing collected packages: django running setup.py install django warning: no previously-included files matching '__pycache__' found under directory '*' warning: no previously-included files matching '*.py[co]' found under directory '*' changing mode of /home/vagrant/blog-venv/bin/django-admin.py 777 installed django cleaning up... these warnings not problem; django still being installed. (the previous question mention asking quite differ

How to import md5 salt passwords from symfony to laravel 4 -

the user table old symfony system has following columns: email | algorithm | salt | password --------------------+-------------+-----------------------------------+------------- techytimo@gmail.com | sha1 | ea579e44dd150e5ba6680d6a3cee26b4 | f48598ad17acf18583d8499d7c6abc430929ae49 the new system created laravel 4 has following columns: email | password --------------------+----------------------------------------------------------- techytimo@gmail.com | $2y$08$zz3rviw4qjfd5idtfzpw3orh0hxgo8brbxfoniqcvu33/ywqkuae how import 3000 accounts passwords old system new system without having users register again? also way encrypt passwords laravel 4 in same format help. a workaround extends auth module in laravel, implement hash solution symfony. rewriting auth::attempt() , hashing password way want to, work. same hash::x , have rewrite function in auth class hash new users password same way. how c

SQL Multiple FROM SELECT Adding count -

i have these following tables : user_profile id | name | avatar 1 john john.jpg 2 jack jack.jpg 3 yves yves.jpg package id | name | date | author_id | active 1 package 1 2013-08-13 08:00:00 3 1 2 package 2 2013-08-13 09:00:00 3 1 3 package 3 2013-08-13 10:00:00 3 1 package_content id | package_id | name | description 1 1 book 1 desc book 1 2 1 book 2 desc book 2 3 1 book 3 desc book 3 4 2 book 1 desc book 1 5 2 book 2 desc book 2 6 3 book 3 desc book 3 7 3 book 4 desc book 4 8 3 book 5 desc book 5 package_comments id | package_id | comment | user_id | view_by_package_author 1 1 comment 1 1 0 2 1 comment 2 1 0 3 2 comment 1 1 1 4 2 comment 2 1

php - Confusion between false and 0 arrays -

basically have following code : unset($items[array_search($i,$items)]); when key not found array_search returns false equivalent returning 0, results in deleting element 0 of array if item value not found. any workaround this? $itemindex = array_search($i,$items); if ($itemindex !== false) { unset($items[$itemindex]); }

.net - Wrong results in Visual Studio Performance Profiler -

i have used builtin sampling-based performance profiler of vs 2010 in past. highlighted code in code window off couple of lines. might have been due code optimization, profiler said not handle well. other that, worked me (in contrast instrumenting variant) however, time results plain wrong. instance, there a single line in code (a call method results in db query) accounts 40% of total run time , , found "comment out code bisection" method. the sampling profiler of vs2012 (and vs2010, double checked) tells me method accounts for 1% (inclusive) , i.e. not show in report summary , have search bottom of detail tables find it. cranked sampling frequency in case, no avail. what throw profiler far off? i profiling .net 3.5 based project, fair number of dlls. tried profiling in both 'release' , 'debug' mode. no substantial difference. are in "cpu profiling" mode? in mode blind i/o, , assume db query i/o. that's why rely on this ol

ios - Popover controller for iPhone -

i working on iphone application. , want create popover controller app. available ipad applications. please help. you can it, have live app with popover in iphone. have create interface popover nsobject+uipopover_iphone.h #import <foundation/foundation.h> @interface uipopovercontroller (overrides) +(bool)_popoversdisabled; @end nsobject+uipopover_iphone.m #import "nsobject+uipopover_iphone.h" @implementation uipopovercontroller (overrides) +(bool)_popoversdisabled { return no; } @end and import nsobject+uipopover_iphone.h in viewcontroller.h for reference check link

getting index value 0 from dataview any list itemtap from sencha touch -

Image
i unable index value form dataview: { xtype: 'list', itemid: 'catlist', store: 'categorystore', scrollable: false, layout: 'fit', itemheight: 20, itemtpl: [ '<div>', '<tpl for="data">', '<span >{category_name}</span> ', '</tpl>', '</div>'], listeners: { 'itemtap': function(list, index, target, record, e, eopts){ console.log(record.get('cat_id')); } } } edited: if put data static on store works fine not work while getting data server: it works displayed on list: { xtype: 'list', itemid: 'catlist', scrollable: false, data: [ { category_name: 'a', cat_id: 1}, {

Include PHP file with jQuery -

is possible include files jquery? eg. if browser width > 999 include(objects_path."_ids/catalogue_slideshow_popup.id.php"); else include(objects_path."_ids/art_catalogue_popup.id.php"); thanks! no, not in regular sense. php interpreters run on server while jquery runs on client (browser) , has no knowledge of server. jquery technically fetch code, wouldn't understand it. what make php server output client can understand, html code (with or without javascript) or json object can used jquery. (php language theoretically write client-side interpreter, there better options trying do.)

oracle - Query that shows 'BLOBs stored inline' -

i need produce query shows table(table_name, column_name) of blobs stored inline user_tables. appreciated. to determine whether lob column stored in-line or out-of-line, need take @ in_row column value of user_lobs view (or [dba] [all] _lobs views depending on privileges granted): yes - inline, no - out-of-line: for instance: select t.table_name , t.column_name , t.in_row user_lobs t table_name = 'blob_table' result: table name column name in row -------------------------------- blob_table col1 yes blob_table col2 yes blob_table col3 yes

backbone.js - Backbone Marionette. Rendering a view does not fire onRender? -

i have event firing executes 'this.render' in itemview. line of code run. however neither onbeforerender nor onrender events fired. they fired when view shown region. is expected behaviour? thanks --justin wyllie sorry. minor bug. this.render(). duh!

xml - use php to format page into a table -

i trying use following code sort page format of within table, need able extract h4, span , non span name, price, item of table <?php $c = file_get_contents('http://www.bunnings.com.au/products_category_plumbing-supplies_1637.aspx'); $dom = new domdocument(); $dom->loadhtml($c); $xpath = new domxpath($dom); $div = $xpath->query('//div[@class="details"]'); $div = $div->item(0); echo $dom->savexml($div); ?> this simple example put name, price , item number table: $xpath = new domxpath($dom); $div = $xpath->query('//div[@class="details"]'); echo '<table>'; foreach($div $details) { $name = $details->getelementsbytagname('h4')->item(0)->getelementsbytagname('a')->item(0)->nodevalue; $price = $details->getelementsbytagname('p')->item(0)->getelementsbytagname('span')->item(0)->nodevalue; $itemnumber = $details->getelemen

SQL: Only Rounded numbers shown, everything else: Useless -

i'm having terrible problems sql, trying calculate values, similiar ex. below: select sum(ordersachieved)/ sum(saleopportunities) calculatedvalue ( select count(ot.salesopportunity) saleopportunities count(vk.orders) ordersachieved fact_vertriebkalkulation vk ) sadly every number takes place in calculation, shown last rounded number! say: 3/4 gives me 0, , 4/4 = 1, 8/4 = 2, , on. while trying find out problem be, found following seems same thing! select 2/7 value gives out = 0!!! tried this select convert(float,2/7) value and it's same thing! can do, has ever seen this? or know answer question? lot in advance select 2/7 value ...using 2 integers means integer division, correct 0. select 2.0/7 value ...using @ least 1 floating point type gives 0.285714 seem looking for. in other words, cast either of operands float, , division give result want; select convert(float,2)/7 value if cast after division done i

doctrine2 - ZF2 + Doctrine + Composer + Upgrading Doctrine -

i'm thick in middle of zend framework 2 project using doctrine. my understanding of composer functionality @ present pretty limited, know need read , want understand happing, don't have time right now, following. say, know should read manual, , do, i'm struggling time @ present. i have installed doctrine in zf2 application adding following in 'require' section of composer.json file located in project route: "doctrine/doctrine-orm-module": "0.*" a few days had run composer update on project install latest version of zf2 in order obtain bug fix. looking @ doctrine-orm-module/src/doctrineormmodule/version.php believe have 0.4.0 installed. i've hit bug in doctrine\dbal v2.3.4 (specifically bug http://www.doctrine-project.org/jira/browse/dbal-522 ) , believe need upgrade dbal 2.3.5 fix. this problem. can't v2.3.5 of dbal using composer. i tried editing doctrine-orm-module/composer.json , updating "doctrine/dbal&quo

visual studio 2012 - Database first generation Entity Framework 5 System.Data.Entity vs EntityFramework -

trying use visual studio 2012, entity framework 5.0 database first approach generate edmx. when generate edmx database vs 2012 - says successfully registered assembly 'system.data.entity, version=4.0.0.0; web.config file says <add assembly="system.data.entity, version=4.0.0.0, culture=neutral.../> i see entityframework , system.data.entity both listed in references. entityframework shows in packages folder , system.data.entity points .net 4.5 install folder. mean succesfully using ef 5.0? for existing project migrations - when migrate project vs 2010 .net 4.0 , set .net client profile 4.5 system.data.entity assembly gets upgraded 1 in .net 4.5 install folder. not see entityframework.dll @ all. there changes need make in order existing project mgirate ef 5.0 , .net 4.5 am missing here? the version of system.data.entity.dll assembly same on both .net framework 4 , .net framework 4.5. catch 1 version can installed on machine @ same t