Posts

Showing posts from April, 2010

c# - Finding or creating an object in Entity Framework -

my domain model , associations follows: customer has many region s region has many location s our client supplies csv file has following columns: customer name region name location name latitude longitude ... based on information, have find or create customer name, find or create region name, , find or update location name. i have tried following: var customer = c in _data.customer c.name == cells[0] select c; if (customer == null) customer = new customer(...); i follow same pattern finding or creating/updating region , location, however, problem run type of linq query cannot converted customer -object on line customer = new customers(); . need reference customer object later can't have 2 separate variables. how accomplish in entity framework? this code var customer = c in _data.customer c.name == cells[0] select c; returns customers has name equals cells[0] return type...

java - Can DailyRollingFileAppender roll logs at midnight instead of at next message? -

i using log4j logging. have jetty based module. need daily logging used dailyrollingfileappender. thing need log file roll on 12:00 a.m, @ moment wait new request before rolling, there way "force" rolling process? i doubt it. logging service have spawn thread waits day or depend on sort of timer service. loggers try hard not have dependencies or consume resources. can app log message every day trigger rollover? sure want 0 length log files days no messages? otherwise, need subclass appender.

uitableview - iOS 5.1 Drag&Drop from text view to table view -

i've developing ipad app , have been wondering if it's possible select text text view , drag , dropping paste uitableview. if can tell bit can start working on it? one way might work use touch events , detect when dragging textview , if so, put text inside textview private property , detect when dragging ends , see if in area of tableview (you need know boundaries of tableview (cgrect). if in area, add text whatever datasource have populates tableview , reload tableview. this take lots of trial , error make sure touch locations right.

html - Form does not submit if action present -

a few days ago set small development server. running on windows vista business , latest wamp. today wrote simple script test something, , when hit submit button, nothing happens. doesn't submit same page, doesn't give me 404 not found (which should). nothing. page doesn't flicker: <form method='post' action='controller.php'> <input type='hidden' name='test' value='test' /> <input type='submit' /> </form> nothing! however, if remove action, follows, page submits , probe of global $_post variable shows hidden value passed. <form method='post'> even following works: <form method='post' action=''> is there i've missed in apache setup?? solved! through trial , error got point happened in chrome. turned out malformed 'base' tag in . didn't affect other browser! thanks everyone's input.

c# - Repository NInject linq exception: different context exception on same context -

i working mvc , repository approach, using ninject inrequestscope(). using ef have 1 edmx file contains tables. testing functions through test project , running fine. when running site (and using ninject) exception: the specified linq expression contains references queries associated different contexts i assume because each time call db dbcontext getting created , destroyed right away, ef thinks have 2 different context. how can solve this?

salesforce - How do I get my Customer Portal to auto-adjust its component's size? -

Image
i have few html home page custom components titled custom_news, custom_articles, , custom_cases. here's html them: <iframe src="/apex/newspage?id=a1tw0000000ejal" frameborder="0" width="100%"></iframe>&nbsp; <iframe src="/apex/custom_home" frameborder="0" width="100%"></iframe>&nbsp; <iframe src="/apex/casespage" width="100%" frameborder="0"></iframe>&nbsp; this customer portal home page layout looks like: and custom components when login customer portal: how rid of scroll bars? want customer portal auto adjust size of components none of components have scroll bars. how do this? you try modifying height of iframes dynamically javascript. answer explains how accomplish this. here's example using javascript provided : <script language="javascript"> <!-- function autoresize(id){ var new...

java - Facebook extended permission grant by user -

how know if user has granted extended permission requested application. use java @ end, , login , facebook registration handled socialauth api. want publish feed user's timeline. javascript unable hit url because doesn't have access token facebook communication. can thing done without using client facebook java api? get /me/permissions graph api, in ever way like.

facebook - How to translate open graph objects -

i quite new facebook api. have used open graph generate actions , objects.this actions validated facebook. but, have translation trouble : action , object in english. , facebook doc action , objects automatically translated when meta tags made 'locale', done. site french , actions objects still appearing in english. can hep ? (the ref's doc:https://developers.facebook.com/docs/opengraph/internationalization/, http://developers.facebook.com/blog/post/605/ ) best , newben if you’re refering documentation – why don’t read well? the blog post says how translating app works, , https://developers.facebook.com/docs/internationalization/ describes in more detail.

sql - Keyword GO throws errors with PHP -

i've come across problem trying restore mssql dumps in php on linux server. i'm reading in file , passing file in query. this works: create table [dbo].[recipes]( [id] [int] identity(1,1) not null, [title] [nvarchar](500) collate sql_latin1_general_cp1_ci_as null, [desc] [text] collate sql_latin1_general_cp1_ci_as null, [directions] [text] collate sql_latin1_general_cp1_ci_as null, [compauthor] [nvarchar](500) collate sql_latin1_general_cp1_ci_as null, [compname] [nvarchar](500) collate sql_latin1_general_cp1_ci_as null, [servings] [nvarchar](50) collate sql_latin1_general_cp1_ci_as null, constraint [pk_recipes] primary key clustered ( [id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) ) but add n word go with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) ) go it throws e...

Calling _msize() via PInvoke from C# -

i'm writing c# library calling app pass in large amount of contiguous, unmanaged memory. calling app can either .net or visual c++ (it go through intermediate c++/cli library before calling library if c++). useful validate there sufficient memory, decided call _msize() function. unfortunately, _msize seems give me wrong size back. went , modified allocation routine in sample app , call _msize. here code snipet: public unsafe class mymemory { /// <returns></returns> [dllimport("msvcrt.dll", setlasterror = true)] public static extern int _msize(intptr handle); public static intptr myalloc(int size) { intptr retval = marshal.allochglobal(size); ... int memsize = mymemory._msize(retval); if (memsize < size) { ... } return retval; } when pass in size 199229440, memsize of 199178885. i've seen similar results different numbers. less 0.01% off, totally understan...

c++ - Is const a lie? (since const can be cast away) -

possible duplicate: sell me on const correctness what usefulness of keyword const in c or c++ since it's allowed such thing? void const_is_a_lie(const int* n) { *((int*) n) = 0; } int main() { int n = 1; const_is_a_lie(&n); printf("%d", n); return 0; } output: 0 it clear const cannot guarante non-modifiability of argument. const promise make compiler, not guarantees you. for example, void const_is_a_lie(const int* n) { *((int*) n) = 0; } #include <stdio.h> int main() { const int n = 1; const_is_a_lie(&n); printf("%d", n); return 0; } output shown @ http://ideone.com/ejogb is 1 because of const , compiler allowed assume value won't change, , therefore can skip rereading it, if make program faster. in case, since const_is_a_lie() violates contract, weird things happen. don't violate contract. , glad compiler gives keeping contract. casts ...

jquery - Can we set the value of a control from variable -

is possible set value of control control id saved in variable. code looks like var textmonth = $(this).parent().find('input[id$=txtmonths]').attr("id"); i'm trying this textmonth.val("only numbers"); is possible? the demo code given below: the html code is: <div id="pagecontent"> <h1> collection master</h1> <table cellpadding="1" cellspacing="2" style="padding-left:40px; font-size:medium; padding-right:20px" width="100%" border="0"> <tr> <td colspan="2" style="width: 100%"> <asp:gridview id="grdfees" runat="server" allowpaging="false" cssclass="grid" autogeneratecolumns="false"><columns> <asp:templatefield headertext="si no" headerstyle-horizontalalign=...

asp.net - Why SQL Server stored procedure runs in live database but not in local pc? -

i have created stored procedure : create procedure usp_pettycash_getsingleuserinfo ( @maerskid varchar(50) ) begin select isnull(maerskid,'') uniqueid, isnull(firstname,'') firstname, isnull(middlename,'') middlename, isnull(lastname,'') lastname, isnull(employeetype,'') employeetype users left outer join t_pettycash_employeeinfo b on a.maerskid = b.uniqueid a.maerskid = @maerskid end go and works fine in live database server. make modification, backup database , restore in local pc. problem is, when run web app local pc, gives exception, could not find stored procedure 'usp_pettycash_getsingleuserinfo' i gave pc's database user admin rights still gives error. not sure problem is. don't think problem in code because, when connect live database, fine. please help. of course, first tested stored procedure in local pc before going live db. time works fine, not. i using sql server 2000 ...

SSAS cube Deployment -

i trying hands on building cubes using adventureworksolap database. build trying do. concern want deploy cube server rest of team members can use cube datasource while generating ssrs reports (might other tools). i have heard ssas not allows sql authentication. so, 1) how members access cube? 2) authentication changes need incorporate? 3) how can other developer using computer's ssms access cube , make changes (just can in oltp database)? 4) need prepare dashboard using cube. suggestions on one. thanks in advance. 1) windows authentication 2) none. 3) once cube deployed cant change it. can change things partitions , roles, cant add dimension example. need change project on bids , redeploy it

How to use bootstrap dropdown in creation forms? -

i don't know how can satisfy connection database. now have code in _form: <div class="field"> <%= f.select :language, options_for_select(%w[english chinese ukrainian]) %> </div> how can bootstrap or how can make bootstrap ?

sencha touch2: mouse pointer changes to cursor when hover on button -

i noticed issue buttons. had created button , on mouse hover mouse pointer changes cursor. know in mobile won't having cursor issue not there want know if there possible solution when testing in browser? thanks you can attach css rule sets cursor.

python - Correctly parse date string with timezone information -

i'm receiving formatted date string via pivotal tracker api: "2012/06/05 17:42:29 cest" i want convert string utc datetime object, looks python-dateutil not recognize timezone, pytz doesn't know either. i fear best bet replace cest in string cet, feels wrong. there other way parse summer time strings utc datetime objects couldn't find? pytz.timezone('cest') # -> pytz.exceptions.unknowntimezoneerror: 'cest' dateutil.parser.parse("2012/06/05 17:42:29 cest") # -> datetime.datetime(2012, 6, 5, 17, 42, 29) edit: after thinking again subtracting 1 hour false corresponding timezone in summer time, issue of parsing still stands there no real cest timezone. use europe/paris , europe/berlin or europe/prague (or one) according region: >>> pytz.country_timezones('de') [u'europe/berlin'] >>> pytz.country_timezones('fr') [u'europe/paris'] they (currently) identical , r...

Spaces writing a PDF file from PHP with TCPDF -

this question exact duplicate of: write space tcpdf pdf file 3 answers i must write dynamic data sent form post method , script should write list of element, divided blank line in pdf file. the code is: <?php require_once('libs/tcpdf/config/lang/ita.php'); require_once('libs/tcpdf/tcpdf.php'); // create new pdf document $pdf = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); // set document information $pdf->setcreator(pdf_creator); $pdf->setauthor('label creator'); $pdf->settitle('labels'); $pdf->setsubject('labels di prova'); $pdf->setkeywords('tcpdf, pdf, example, test, guide'); // set default monospaced font $pdf->setdefaultmonospacedfont(pdf_font_monospaced); $pdf->setprintheader(false); $pdf->setprintfooter(false); //set auto page breaks ...

Passing arguments to a ruby script while using the expanded rvm command line syntax? -

the rvm command lets tell environment want use , pass block invoke script or (for one-time run of command) e.g.: rvm 1.9.2-p290@whatever-gemset ruby my-script.rb however, if script accepts command line arguments , try pass them script @ invocation, rvm complains. know if rvm has syntax support/allow this? e.g.: rvm 1.9.2-p290@whatever-gemset ruby my-script.rb -p error: unrecognized command line argument(s): '-p' ( see: 'rvm usage' ) to avoid rvm trying parse parameters arguments rvm itself, put them in quotes pass them single argument: rvm 1.9.2-p290@whatever-gemset "ruby my-script.rb -p" the reason fail if kind of shell-expansion being done before command executed non-standard behavior.

javascript - Always active the first ul list and the first div for certain id using jQuery -

problem: i have jquery code switch between tabs. however, wondering how can extended activates first subelement of each id. code html tab navigation: <div id="navtabs"> <div> <a href="#tab1" class="active btn btn-info" data-toggle="tab"><i class="icon-home"></i>start</a> <a href="#tab2" class="btn btn-info" data-toggle="tab"><i class="icon-book"></i>essay</a> <a href="#tab3" class="btn btn-info" data-toggle="tab"><i class="icon-ok-sign"></i>criteria</a> <a href="#tab4" class="btn btn-info" data-toggle="tab"><i class="icon-time"></i>time</a> </div> </div> code example tab: <div class="tab-pane" id="tab2"> <ul id=...

c++ - There is no phonenumber.pb.h in libphonenumber -

there no phonenumber.pb.h , phonemetadata.pb.h in libphonenumber (cpp) lib so there way find them out? thanks! these files generated google protobuffers library simple .proto file describes protocol messages. check out library sources, there should phonemetadata.proto , phonenumber.proto

opencv - cv::VideoCapture in android native code -

i using cv::videocapture in native code , having issues : in android java code, videocapture gives yuv420 frame, in native code it's bgr one. since need gray image, having yuv image better (i read there no cost in converting yuv gray). here questions : a im using asus tf201, acquiring frame takes 26ms lot... standard android camera api gives yuv native version of videocapture performs conversion ? (which explain time cost) is possible change format cv_cap_prop_format ? whenever try mycapture.get(cv_cap_prop_format) app crashes... edit : andrey kamaev answered one. have use grab/retrieve methods adding argument in second 1 : capture.retrieve(frame, cv_cap_android_gray_frame); thanks look @ opencv samples android. of them getting gray image videocapture object: capture.retrieve(mgray, highgui.cv_cap_android_grey_frame); internally gray image "converted" yuv420 frame in efficient way - without copying.

javascript - window.onblur event also triggers window.onfocus event when using IE8 -

both events getting fired @ time onblur event. <%@ page language="c#" masterpagefile="~/site1.master" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="webapplication1.webform1" title="untitled page" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> <script src="js/jquery-1.7.2.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> window.onfocus = function() { $('#msg').html($('#msg').html() + '<br/> focus'); }; window.onblur = function() { $('#msg').html($('#msg').html() + '<br/> blur'); }; </script> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runa...

HTML5 - css file -

i trying make html document , having strange issue. when css file in different directory works great when move css file same directory html file doesn't recognize it. i changed link href of css. thanks help ok sorry, elaborate- – when use - <title>profile</title> <link href="./me_files/as.css" media="screen, handheld" rel="stylesheet" type="text/css"> it works. , when move file same folder , use <title>profile</title> <link href="as.css" media="screen, handheld" rel="stylesheet" type="text/css"> it doesn't work ok managed fix it. problem needed drop the- media="screen, handheld" thank all!!! "when use - <title>profile</title> <link href="./me_files/as.css" media="screen, handheld" rel="stylesheet" type="text/css"> - works , when move file same folder , use...

scala - count occurrences of elements -

this question has answer here: scala how can count number of occurrences in list 12 answers counting elements in list one-liner in haskell: count xs = tolist (fromlistwith (+) [(x, 1) | x <- xs]) here example usage: *main> count "haskell scala" [(' ',1),('a',3),('c',1),('e',1),('h',1),('k',1),('l',3),('s',2)] can function expressed elegantly in scala well? scala> "haskell scala".groupby(identity).mapvalues(_.size).toseq res1: seq[(char, int)] = arraybuffer((e,1), (s,2), (a,3), ( ,1), (l,3), (c,1), (h,1), (k,1))

JavaScript Fullscreen API plugin -

i've found plugin called screenfull.js , i'm wondering if it's possible automatically open page in fullscreen without clicking on button. example of code making page fullscreen : document.getelementbyid('#button').addeventlistener('click', function() { if ( screenfull ) { screenfull.request(); } else { // ignore or else } }); using demo, run request on window load: e.g. window.onload = function() { screenfull.request( $('#container')[0] ); }; [edit] run jquery document ready... e.g. $(document).ready(function() { screenfull.request( $('#container')[0] ); });

ios - clang: error: linker command failed with exit code 1, only when testing on device -

Image
i test app on device when ran problem, i'm getting linker error. i've checked compile sources , build phases, there's no sign of importing things twice. ld: duplicate symbol _calculatenextsearchpage in /users/wouter/sites/test/fastpdfkit.embeddedframework/fastpdfkit.framework/fastpdfkit(fastpdfkit) , /users/wouter/sites/test/fastpdfkit.embeddedframework/fastpdfkit.framework/fastpdfkit(fastpdfkit) architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) this happens when testing on device, not in simulator. alright guys had same problem. seems fixed it. using cocapods therefor described standard procedure can not executed. steps add fastpdfkit cocoapods. download fastpdfkit in project add files "your project" go fastpdfkit folder have downloaded locate 1 folder , 1 project file. press , hold command key , add these in project fastpdfkit.xcodeproj fastpdfkit.embeddedframework (note: fastpdfk...

java - Set up embedded jetty with document root -

if enter http://example.com/index.html in browser, jetty should in specified dir file index.html. how can achieve embedded jetty? this code start jetty: inetsocketaddress socketaddress =inetsocketaddress.createunresolved("0.0.0.0", 80); server server = new server(socketaddress); server.start(); server.join(); found description @ http://wiki.eclipse.org/jetty/tutorial/embedding_jetty public class fileserver{ public static void main(string[] args) throws exception{ server server = new server(); selectchannelconnector connector = new selectchannelconnector(); connector.setport(8080); server.addconnector(connector); resourcehandler resource_handler = new resourcehandler(); resource_handler.setdirectorieslisted(true); resource_handler.setwelcomefiles(new string[]{ "index.html" }); resource_handler.setresourcebase("."); handlerlist handlers = new handlerlist();...

asp.net mvc - MVC4 WebAPI not compressing GET responses -

i'm working on project uses mvc4 webapi (rc). responses not gzip compressed (dynamic compression in iis enabled). the responses normal mvc controllers compressed. need specific setting enable gzip compression webapi responses? i add custom compression handler, if possible, use built-in iis compression. btw, know duplicate of compress http response , accepted answer there doesn't answer question. is dynamic compression enabled mimetype application/json; charset=utf-8 ? default not enabled if dynamic compression enabled. to see if enabled, can in applicationhost.config file under %windir%\system32\inetsrv\config in section. you should not edit file, instead use appcmd.exe change this: https://stackoverflow.com/a/7375645/243936

image processing - PHP getimagesize(): IMAGETYPE or MIME-type? -

i have simple images resizing script works great jpegs, not gifs or pngs. first step getting correct image type can process accordingly. my question is: seems getimagesize() returns both imagetype , mime-type... should use determine if imagine jpeg, png, or gif? it seems strange php gives 2 ways of doing this, presume each have designated uses? documentation says that: mime correspondant mime type of image. information can used deliver images correct http content-type header i believe imagetype valid choice.

jquery - Is there a better webview for Android -

is there better webview android? google's own documents mention not rely on webview object. but using webkit seems strange limited, compared other webkit browsers used on mobile devices comparable hardware. this evident in jquery mobile implementations, or sencha touch implementations web apps. android version suffers slowdowns, rendering issues, , poor user experience, other mobile devices - iphone - run fine. both use webkit. , outside of app, actual android browser runs fine. is there way address android's problem, on lower level? has made more comprehensive web object android? thanks insight i afraid both answers (commonsware , fuzzical logic) avoiding reality. the reality our two-years experience of developing html5 web app , later phonegap app (hybrid using web view) ios, android , windows phone is: works great on ios (both safari , in webview), works reasonable in chrome on android, ie on windows 8 , ie webview (all had issues, can solved) remain...

Can I configure Eclipse to run my Android app project when I run from my Android library? -

when i'm editing files in android library , run/debug, wants launch library. launch android application (which project in workspace). i have 3 projects in workspace: library, full app, lite app. full , lite apps wrappers around library allow me build 2 versions. thanks! will just right click on project want run , run it or open class in project want run , click run or works selecting folder of project (in package explorer) , clicking run

file - Debugging a C program using Structs -

i attempting write program sorts speed dating information credit in computer science 1 course; , running odd problem. program when get's series of nested loops crashes after running loop twice (at point debug function called). function transferdata; designed take data file , move structures later processing yet written function. life of me can't figure out advice welcome, below i've placed code , below test data using. cadata transferdata(fdata * filedata, cadata * workingdata, int numcouples) { int = 0, j = 0, k = 0; workingdata->madata = (struct mdata*)malloc(sizeof(mdata)*(numcouples*2));//create array of match data cells equal double number of couples workingdata->madata->coudata = (struct cdata*)malloc(sizeof(cdata)*numcouples);//create couple structure array number of cells equal number of couples. ///todo: //read in names for(i = 0; < (numcouples * 2); i++)//rotate through matches { if(i < numcouples)//men firs...

XQIB XQuery - error when trying to 'let' a variable -

my xquery knowledge pretty lacking i'm trying play around xqib (xquery in browser), setting variable errors let $foo := "bar" ...generates error mxquery output following error during compilation: line 1, column 18: err:xpst0003 error while parsing fflwor expr: 'return' expected! let $foo := "bar" error unknown.anonymous(unknown source) i've looked @ samples on xqib site, , seems let statements there in sub-routines, e.g. alerts or functions. suggest in xquery, code must live in function of sorts, rather free-standing? for example, 1 of examples this, of course works: b:alert( let $x := <a><b>2</b><c>4</c></a> return xs:string($x/b * $x/c) ) but this, altered version, doesn't. let $x := <a><b>2</b><c>4</c></a> b:alert( return xs:string($x/b * $x/c) ) what's latter? in advance help. your return @ wrong p...

java - How to build Mojarra from source -

i downloaded mojarra source code here . downloaded pom file build source code files. turns out code structure different original , need create directories , files there. i created directory structure: laptop@laptop javax.faces-2.1.9-sources]$ tree . |-- pom.xml `-- src `-- main |-- java | |-- com | | `-- sun | | `-- faces ....(other sub directories) | `-- javax | `-- faces ....(other sub directories) `-- resources `-- meta-inf `-- manifest.mf i created directories src , main , java , resources , placed source code directories in directories it's not working. proper way place source code files the package? best wishes as of jan 16, 2017 , can build mojarra using following steps: note: building mojarra requires ant , maven installed on system. requires using correct jdk version: for mojarra 2.3.x use jdk 8 (or 1.8 ). for mojarra 2.2.x use j...

ruby - RSpec testing module methods/ -

i have next modules. module module b def self.method_b(value) #code end end end and module module c def self.method_c(value) a::b.method_b(value) end end end how test these module? how create stub self.method_b? spec_helper.rb rspec.configure |config| config.mock_with :mocha end thanks. you have switched out built-in rspec mocking library mocha. has different api . try: a::b.stubs(:method_b).returns('value')

Vim folding - mark opened folds -

Image
is there way see, opened folds in current file? have problem when opening folds , moving around, i'm not able find line fold started from! maybe there option set nice-looking folding-hint next numbers. maybe this: + 1 void myfunc(void) { | 2 printf("hello world\n"); | 3 printf("goodby world!\n"); - 4 } 5 6 void anotherfunc(void) ... it nice! used google , used vim-help found no way this. kind regards, musicmatze try :set foldcolumn=1 if want more fold columns indicators increase number, example below uses :se fdc=3 (the shortcut)

regex - PHP - regular expression (preg_match) -

<?php $string = "http://example.com/file/d1 http://example.com/file/d2 http://example.com/file/d3"; preg_match_all('/(https?\:\/\/)?(www\.)?example\.com\/file\/(\w+)/i', $string, $matches); foreach($matches[3] $value) { print $value; } ?> i want preg match third link , "d3". dont want matches other 2 links. why should check if link has whitespace @ beginning or end. know match whitespace expression \s . tried somehow don't it. :( you can add $ match end of string this, , return last one. preg_match_all('/(https?\:\/\/)?(www\.)?example\.com\/file\/(\w+)$/i', $string, $matches);

android - Missing APIs in Google Tasks API Java library -

i'm trying write tasks app android, using v1.3 library here: http://code.google.com/p/google-api-java-client/source/browse/com/google/?repo=mavenrepo&r=07a469e9e478c9e13e375c4d569436d4e261c59c#google%2fapis%2fgoogle-api-services-tasks%2fv1-1.3.0-beta as per javadoc , tasklist class has getupdated() api, returning last-modification time of list. however, it's missing in library , need api. reason why it's missing , how can it? the api added in v1.6 of library. not sure why missing before.

How to update python-sqlite on mac osx -

python 2.7.3 on mac os x snow leopard (downloaded python.org), tells me using sqlite 3.6.12 ( sqlite3.sqlite_version ). however, use foreign keys, need @ least sqlite 3.6.19. how can update sqlite alone? i tried pip install pysqlite (from question/answer: updating sqlite3 build on python install ), sqlite_version did not change. pip search sqlite shows pysqlite 2.6.3 installed, still have, both commands python , python2.7 >>> import sqlite3 >>> sqlite3.sqlite_version #3.6.12 >>> sqlite3.version #2.6.0 (yeah, no 2.6.3) you'll first need install sqlite , build , install pysqlite , making sure it's building against newly installed version of sqlite , not system's version of sqlite. alternately, if pysqlite dynamically linked, might able fiddle ld_library_path make existing pysqlite load newer version of library. for more, see: https://groups.google.com/group/python-sqlite/browse_thread/thread/9fb6694c803431eb

php - Cronjob issue. Doesn't recognize variable -

works: php -q /home/site/public_html/cron/file.php doesn't work: php -q /home/site/public_html/cron/file.php?variable=1 any suggestions? need send variable $_get (or not) do this curl http://hostname/cron/file.php?variable=1 and in file.php managing code $_get[variable] this woould behave simple browser call in shell/terminal hope helps

Design a GWT UI Layout -

Image
we wanted design layout in gwt has quite lot of small small sections on screen. has left menu, header, footer, main content area lot of sub sections can closed user in case if not want see them. remaining content section should adjusted automatically. using gwt platform. in doubt, whether docklayoutpanel suits or not, because, has must more flexible. apart that, didnt layout examples. can achieve using gwt panels or have manually using div in module html file? please find below draft layout. confused panel start.... kindly advice. there millions of way achieve that. give opinion , try explain why way. first of all, seems want, websites have, top header (or two) , menu on left. docklayoutpanel can quite nicely, use start with. way, consider adding footer layout (sorry, thinking apps have one)... then, have 2 little panels on left (tree str1 , 2) , content areas. depending on how flexible want these be, need different structures. let's want have not two, potenti...

Android ListView: Can not center items on start up, due to Null Pointer Exception -

this first ever post here , i'm dumb novice, hope out there can both me , excuse ignorance. i have listview populated arrayadapter. when either scroll or click, want selected item, or item nearest vertical center, forced exact vertical center of screen. if call listview.setselection(int position) aligns selected position @ top of screen, need use listview.setselectionfromtop(position, offset) instead. find offset, take half of view's height half of listview's height. so, can vertically center item easy enough, within onitemclick or onscrollstatechanged, following: int x = listview.getheight(); int y = listview.getchildat(0).getheight(); listview.setselectionfromtop(myposition, x/2 - y/2); all works fine. problem initial listview setup. want item centered when activity starts, can't because nullpointerexception from: int y = listview.getchildat(0).getheight(); i understand because listview has not yet rendered, ha...

RecorderObject in OpenSL does not implement the interface to set the volume or configure on Android -

i tried sldevicevolumeitf interface of recorderobject on android got error: sl_result_feature_unsupported. i read android implementation of opensl es not support volume setting audiorecorder . true? if yes there workaround? have voip application not worl on galaxy nexus because of high mic gain. i tried sl_iid_androidconfiguration set streamtype new voice_communincation audio-source again error 12 (not supported). // create audio recorder const slinterfaceid id[2] = { sl_iid_androidsimplebufferqueue, sl_iid_androidconfiguration }; const slboolean req[2] = { sl_boolean_true, sl_boolean_true }; result = (*engine)->createaudiorecorder(engine, &recorderobject, &audiosrc, &audiosnk, 2, id, req); if (sl_result_success != result) { return false; } slandroidconfigurationitf recorderconfig; result = (*recorderobject)->getinterface(recorderobject, sl_iid_androidconfiguration, &recorderconfig); if(result != sl_result_success) { error(...

proof - Proving lemma with implication based on functions -

i want prove lemma below. trying to use tactic 'destruct', can't prove it. please body guide me how can prove such lemmas. can prove emptystring, not variables s1 , s2. thanks inductive nat : set := | o : nat | s : nat -> nat. inductive string : set := | emptystring : string | string : ascii -> string -> string. fixpoint compstrings (sa : string) (sb : string) {struct sb}: bool := match sa | emptystring => match sb | emptystring => true | string b sb'=> false end | string sa' => match sb | emptystring => false | string b sb'=> compstrings sa' sb' end end. lemma eq_lenght : forall (s1 s2 : string), (compstrings s1 s2) = true -> (eq_nat (length s1) (length s2)) = true. first off, let me argue style. have written function compstrings this: fixpoint comp...

asp.net mvc 3 - HttpPost method is not fired if the submit button is disabled -

i have view follows: demoview.cshtml @model mvc3razor.models.usermodel @{ viewbag.title = "create"; layout = "~/views/shared/_layout.cshtml"; } <h2> create</h2> <script src="@url.content("~/scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (html.beginform()) { @html.validationsummary(true) <fieldset> <legend>usermodel</legend> <div class="editor-label"> @html.labelfor(model => model.username) </div> <div class="editor-field"> @html.editorfor(model => model.username) @html.validationmessagefor(model => model.username) </div> <div class="editor-label"...

java - IceFaces puts it's CSS and JavaScript resources on every page, whether or not they use Ice components. Is there a way to block this? -

it appears merely having icefaces on classpath can severely affect page load times of jsf application. several things happen, if no ice: components used on page ace-jquery.js 312kb ace-datatable.js.xhtml 182kb theme.css 22kb icepush-js 84kb compat.js 16kb icefaces-compat-js 289kb total: .88mb furthermore request polled server every 15 seconds icepush listener. there appears no way turn these off in icefaces, other removing jars app. we're trying migrate primefaces, app large, can migrate few pages @ time every release. the ideal answer if knows way turn things off. next best answer way implement wrapper around resource handler somehow. since no 1 found better answer, i'll post answer know of, in hopes else may find information useful. what definitively works removing following jars classpath: icefaces-compat icepush icefaces-ace i recommend staying away icefaces. instead, use primefaces omnifaces resource combiner. can compact pages , li...

ruby on rails - undefined method `key?' for nil:NilClass when using MongoMapper -

i set new rails application following these instructions . generated new controller , added resources :tickets routes file. hexapoda::application.routes.draw resources :tickets end this controller (`/app/controllers/tickets_controller.rb'). class ticketscontroller < applicationcontroller def index @tickets = ticket.all end end i added new model ticket in /app/models/ticket.rb . class ticket include mongomapper::document key :summary, string, :required => true end here's view ( /app/views/index.html.erb ): <h1>tickets#index</h1> <p>find me in app/views/tickets/index.html.erb</p> now when go /tickets in browser, error message. nomethoderror in ticketscontroller#index undefined method `key?' nil:nilclass i have no idea what's going on. problem? i'm using rails 3.2.5 , mongomapper 0.11.1. you need latest monomapper master: gem 'mongo_mapper', github: "jnunemaker/mon...

mysql - nhibernate select n points in date range -

so here's situation: have 2 tables contains statistics, 1 table statistic definitions, , table statistic events. each row in stats event table has timestamp, value, , reference statistic definition applies to, , each statistic definition has collection of stat entries. (i.e. 1 many) my app allows user select statistic definition , date range, , graphs entries stat event table selected definition. however, it's possible user select large date range, , result in larger number of returned events necessary. i'd return subset of data (n points) that's evenly distributed on time range user selects. current (naive) implementation following: var totalentries = session.queryover<statevent>() .where(x => x.date > start_date && x.date < end_date && statdef.id == defn.id) .list() int modfactor = (int) math.ceiling((double)totalentries.count/30); var temp = totalentries.where((x, i) =...

sharepoint - PublishingRolloutImage not persisting on Update(); -

i have list, has 3 fields: title, publishingrollupimage , description. i want upload image library sitecollectionimages , reference on list. i'm able upload file folder sitecollectionimages, , it's url. i'm able insert item in list "mylist", publishingrolloutimage won't persist after update() method. tried set constructor imagefieldvalue, this: new imagefieldvalue("<img src='test.jpg' />"); but didn't work. here's code: using (var site = new spsite(spcontext.current.site.id)) using (var web = site.openweb()) { var folder = web.getfolder("sitecollectionimages"); var file = folder.files.add(filename, file, true); folder.update(); var list = web.lists["mylist"]; var item = list.items.add(); item["title"] = "myitemtitle"; item["publishingrollupimage"...

php - Set value from database to textbox based on search by id -

please me solve case. have code below : <script> function getxmlhttp() { var xmlhttp = false; try{ xmlhttp=new xmlhttprequest(); } catch(e) { try{ xmlhttp= new activexobject("microsoft.xmlhttp"); catch(e){ try{ xmlhttp = new activexobject("msxml2.xmlhttp"); catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getcity(url, id1) { var req = getxmlhttp(url); if (req) { req.onreadystatechange = function() { if (req.readystate == 4) { // if "ok" if (req.status == 200) { document.getelementbyid(id1).value=req.responsetext; // document.getelementbyid(id2).value=req.responsetext; ...

java - Android PhoneGap PHP Code -

i creating app phonegap framework android. possible app run php code without need of external server? such local ajax php app? thanks phonegap html5 library client side, php server side scripting language needs interpreter run in cases apache server no can't in short what php? php widely-used general-purpose scripting language suited web development , can embedded html. if new php , want idea of how works, try introductory tutorial. after that, check out online manual, , example archive sites , of other resources available in links section. check php website here

Wordpress push post in category from php -

i have conditional statement , when condition becomes true want push specific post specific category. something wp_push_post($post, $category) does exists function makes job? use <?php wp_insert_post( $post, $wp_error ); ?> with $post = array( 'id' => [ <post id> ] //are updating existing post? 'menu_order' => [ <order> ] //if new post page, sets order should appear in tabs. 'comment_status' => [ 'closed' | 'open' ] // 'closed' means no comments. 'ping_status' => [ 'closed' | 'open' ] // 'closed' means pingbacks or trackbacks turned off 'pinged' => [ ? ] //? 'post_author' => [ <user id> ] //the user id number of author. 'post_category' => [ array(<category id>, <...>) ] //add categories. 'post_content' => [ <the text of post> ] //the full text of post. 'post_date...

android - a parser application which can implement xml files and run accordingly -

i want implement application work parser. user able upload xml files describe ui , functional properties of android application. wonder if there way parse xml files , use them layouts without compiling? i think you're parser have generate new views receive "parameters" via xml files. afterwards you'd have add views progammatically layout root. it doesn't matter parser technology using purpose you're going create objects - sax, dom & pull-parser suitable.

javascript framework needed for video post processing -

are there solutions achieve video post processing (filters) using canvas / html5? i found https://github.com/brianchirls/seriously.js needs webgl , need alternatives. ive had success combining both requestanimationframe video playing canvas each frame using pixastic . more of 'high-end' video post-production (as used in nuke, flame etc) method video treated set of frames in framestore. i've seen things seriously.js , they're great keep in mind when rendering video canvas you're dealing image sequence , therefore have lot of freedom , can use pretty image filter/process/algorithm on data before displaying it. other thing mention pixastic effects work without webgl enabled (so can support internet explorer too) seriously.js not. bit off topic but: ps: i've had in mind make whole javascript realtime node based post-prod app based on this: http://idflood.github.com/threenodes.js/ example: http://idflood.github.com/threenodes.js/public/index.html...

c# - .NET LINQ to entities group by date (day) -

i have same problem posted here: linq entities group-by failure using .date however, answer not 100% correct. works in cases except when different timezones used. when different timezones used, groups on timezones. why? managed bypass using many entity functions. int localoffset= convert.toint32( timezone.currenttimezone.getutcoffset(datetime.now).totalminutes); var results = ( perfentry in db.entry (....) select new { perfentry.operation, perfentry.duration, localtime = entityfunctions.addminutes(perfentry.start, localoffset - entityfunctions.gettotaloffsetminutes( perfentry.start)) } ).groupby(x => new { time = entityfunctions.truncatetime( entityfunctions.createdatetime(x.localtime.value.year, x.localtime.value.month, x.localtime.value.day, 0, 0, 0)), x.operation } ).orderbydescending(a => a.key). select(g => new { time = g.key.time, ... }); is there out ther...

javascript - getComputedStyle or currentStyle for border-left-width -

my html : <div id="bar" ></div> my css : #bar { border-left-width:150px; } my js : function getstyle(el,styleprop) { if(el.currentstyle)var y=el.currentstyle[styleprop]; else if(window.getcomputedstyle)var y=document.defaultview.getcomputedstyle(el,null).getpropertyvalue(styleprop); return y; } alert(getstyle(document.getelementbyid("bar"),"border-left-width"));//outputs 0px the fiddle : http://jsfiddle.net/4abhz/1 how can border-left-width property? (with exemple it's not working (on firefox)) check border-left-style property. it's set none (the default). set solid , you're go: http://jsfiddle.net/paulpro/4abhz/4/

sql - c# how to terminate and start a process -

in c# program (using visual studio 2010), uploading files sharepoint document library, problem running our of memory, apparently process "sqlservr.exe*32" on 1 gb of memory. upload file, first read bytes of file byte[] array. upload array file document library. need way clear memory before uploading each file. the program uploads files in loop iterates in directory. there way clear memory of byte[] array? actually there way can restart process "sqlservr.exe*32" free memory? this code use upload: and error message see on website (when problem occurs, think running out of memory, different files in message): url 'test library/myfolder/file.txt' invalid. may refer nonexistent file or folder, or refer valid file or folder not in current web. using system; using microsoft.sharepoint; using microsoft.sharepoint.webcontrols; using system.io; using microsoft.sharepoint; namespace customapplicationpage.layouts.customapplicationpage { public partia...