Posts

Showing posts from January, 2014

ruby - How can I store a hash in my database? -

ruby - How can I store a hash in my database? - is there ruby, or activerecord method can write , read hash , database field? i need write web utility take post info , save database, later on pull database in original hash form. ideally without 'knowing' construction is. in other words, info store needs independent of particular set of hash keys. for example, 1 time external app might post app: "user" => "bill", "city" => "new york" but time external app might post app: "company" => "foo inc", "telephone" => "555-5555" so utility needs save arbitrary hash text field in database, then, later, recreate hash saved. you can utilize serialization 3 options: marshal in binary format, yaml , json human-readable formats of info store. once trying each of methods, not forget measure time serialize , deserialize well. if need pull info in origin format, js...

iphone - How do I keep track of the total number of complete rotations of an image in an iOS app? -

iphone - How do I keep track of the total number of complete rotations of an image in an iOS app? - i working on app has rotating image (the user tapps , drags , image rotates in circle tracking finger). trying maintain track of how many times user makes finish circle. additional "hitch" need know if user circling clockwise vs counter clockwise. here code rotating image... please sense free request additional information. - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [[event alltouches] anyobject]; cgpoint touchpoint = [touch locationinview:self.view]; long double rotationnumber = atan2(touchpoint.y - originy, touchpoint.x - originx); totalrotationcount ++; schedulingwheel.transform = cgaffinetransformmakerotation(rotationnumber); offset = (rotationnumber * 100)/14; dateribbon.center = cgpointmake(offset, 24); } thanks help! my solution isn't elegant , there might cleaner so...

javascript - jquery: unable to print ajax response header (Jquery 1.7.1) -

javascript - jquery: unable to print ajax response header (Jquery 1.7.1) - $.ajax({ async:false, type: 'post', url: itemurl, success: function(data,status,jqxhr) { responseobj = data; console.log('success function resp'); console.log(jqxhr.getallresponseheaders()); }, error: function(data){ responseobj = data; }, data:item, datatype: "json", }); here's code; unable print response headers; missing anything? prints out empty string. tried using getresponseheader("location"), that's not working either; trying "location" header that's beingness returned ajax call. however firbeug shows response headers including "location" after. i using jquery 1.7.1 i worked @satish in he...

sql server collation for stored procedures generated script -

sql server collation for stored procedures generated script - i have generated stored procedures script database "modern_spanish_ci_as". run script without problem in 1 server has "sql_latin1_general_cp1_ci_as" collation, in server has "modern_spanish_bin" collation, script fails because variables declared @userlogin (or else) , used @userlogin. caps vs no caps there no difference whether script like: exec dbo.sp_executesql @statement = n'my sp body' or script like: create procedure [dbo].myspname i have executed next ensure database collation right one: select databasepropertyex('mydatabase','collation');/*returns "modern_spanish_ci_as"*/ i'm not allowed alter server collation. what (other alter case of thousands of expressions) in order succesfully run script , ensure sp's work fine??? and, there impact @ runtime when sp seek compare varchar values??? thanks in advance you must...

how to run GIF file in the blackberry simulator inside theme builder of blackberry theme studio6.0 -

how to run GIF file in the blackberry simulator inside theme builder of blackberry theme studio6.0 - hi have created gif animated image using blackberry theme builder 6.0 not showing moving image on simulator.when press ok still showing still image.how can solve issue. blackberry

java - How to test jsp attribute type -

java - How to test jsp attribute type - i have spring mvc app user settings. settings objects strings name, value, user , type field. edit values form table generated , values editable strings. for settings have value checkbox in field type, display checkbox, ie: <c:if test="setting.type=='checkbox'"> <form:checkbox path="setting.name" /> </c:if> i cannot figure out. suggestions? did seek change <c:if test="setting.type=='checkbox'"> to <c:if test="${setting.type=='checkbox'}"> ? of course, 'setting' object must passed jsp correctly. java jsp spring-mvc jstl

java - Using activerecord migrations for a non-rails application, what are the steps? -

java - Using activerecord migrations for a non-rails application, what are the steps? - i have java application, , want utilize rails migrations this. what steps working? i have done far: 1. installed jruby 2. installed next gems: rspec, cucumber, rake do install rails or activerecord? any suggestions on folder construction store rakefile? i'm assuming rake work on same path rakefile is? how tell db connection information? here's succinct article believe answers of questions: http://community.active.com/blogs/productdev/2011/02/28/using-activerecord-3-without-rails it talks using ar sinatra you'll see adapted problem. java ruby-on-rails activerecord jruby

asp.net - Client Deletion Confirmation -

asp.net - Client Deletion Confirmation - i have "delete" alternative showing on gridview populated via sql info source. trying implement way user asked verify wish delete row of information. have been next guide http://msdn.microsoft.com/en-us/library/ms972940.aspx. the issue i'm having when add together objectdatasource, select class , when go take desired method not listed (fig. 37). addition info - created gridview populated via sqldatasource, i'm trying transition on objectdatasource , add together deletemethod. stuck @ part , not yet have popup window inquire user continue. work on after overcome current challenge. here aspx code: <asp:content id="content1" contentplaceholderid="headcontentadmin" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="maincontentadmin" runat="server"> <asp:gridview id="gridview1" runat=...

c - exit() vs _exit() : Does calling _exit() ensures closing of all open fd and sockets? -

c - exit() vs _exit() : Does calling _exit() ensures closing of all open fd and sockets? - i have used exit() terminate process. not have exit handlers registered not care flushing buffers on exit, thought of using _exit() more robust method terminate process. the question is, _exit() handles closing of open file descriptors , open sockets gracefully? the function exit calls _exit . tlpi: the next actions performed exit(): exit handlers called the stdio stream buffers flushed the _exit() scheme phone call invoked the standard page _exit says this: all of file descriptors, directory streams, conversion descriptors, , message catalog descriptors open in calling process shall closed. c linux exit

join - MySQL: many to many how to get all (related) categories & combine queries -

join - MySQL: many to many how to get all (related) categories & combine queries - the table: id | category (there index on id & category) ----------- 1 | 1 1 | 7 1 | 3 2 | 1 2 | 2 2 | 4 3 | 1 3 | 6 3 | 3 select distinct category many_to_many e1 id in ( select distinct e1.id many_to_many e1 inner bring together many_to_many x1 on e1.id=x1.id e1.category in (3) ) i retured: ** 6, 1, 7** (what query above) seems me query not gone preform well, because sub query searches id's , list can huge. also doesn't matter how many if id related. performance if there 100 id's checking 1 time each unique category populated enough. secondly utilize other query (the sub query )the id's contain category: select distinct e1.id many_to_many e1 inner bring together many_to_many x1 on e1.id=x1.id ...

c++ - Delete or not after copy/load -

c++ - Delete or not after copy/load - that's trick question, i'm not sure; do have phone call delete after : qimage::copy() qimage::load(qstring) qpixmap::fromimage(qimage) by delete mean, deleting when don't need more. qimage objects not special in how created , destroyed. on stack or new/delete or whatever, rules same c++ objects. qimage implicitly shared, copying inexpensive (like shared pointer) performs copy-on-write preserve value semantics. short story, don't ever have new/delete qimage, pass around value , quit worrying. you don't have special deleting after calling copy/load methods, although might want assign my_image=qimage() release cached info or something. c++ qt qimage

html - CSS - how to make DIV with wrapped floats inside only be as large as it needs to be to hold the floats? -

html - CSS - how to make DIV with wrapped floats inside only be as large as it needs to be to hold the floats? - i have several floats , div around them. div within div, , supposed horizontally centered within it. thing inner div not fixed-width, , can't be. here code: div.outer { text-align: center; } div.inner { display: inline-block; width: auto; } div.floatdiv { display: block; float: left; width: 270px; height: 400px; margin: 5px; background-color: gray; text-align: center; } div.clearboth { clear: both; } and html: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link href="main.css" rel="stylesheet" type="text/css...

sql server 2005 - How to avoid duplicate records from group by? -

sql server 2005 - How to avoid duplicate records from group by? - below query used find min cost of product i update table @rates field available_count. but result coming duplicate because of grouping by. how update this? set nocount on declare @products table (product_id varchar(50),product_name varchar(50) ) insert @products values ('1','pen'); insert @products values ('2','pencil'); insert @products values ('3','aschool bag'); insert @products values ('4','book'); insert @products values ('5','pencil box'); set nocount on declare @rates table (product_id varchar(50),price int, avail_count varchar(50)) insert @rates values ('1','10','1'); insert @rates values ('3','5','5'); insert @rates values ('1','5','6'); insert @rates values ('4','20','3'); insert @rates values ('4','15',...

c - GTK: Infinite lazy list of widgets -

c - GTK: Infinite lazy list of widgets - i need display virtually infinite scrollabe list of interactive widgets , add/remove them necessary when new info added or user scrolls uncached area. a treeview (as asked here) no option, because, need total widgets items (composed of standard widgets multiple actions etc, cellrenderer isn't this) worse, don't know widgets' height in advance (not much variance though), using vbox might cause jumpiness. using scrollbar should still sense if list finite (i.e. updated after scrolling has finished scrollbutton doesn't jump away mouse), , when resizing window , layout of windows updated, scroll position shouldn't alter much (the focused widget should remain is, unless of course of study focused widget scrolled away…). what's best way this? maybe library sends me signals when new widget needs added? or listview coerced in not-too-nasty way? (i.e. draw on offscreen buffer, re-create cell using cellrendere...

Most efficient way to parse a large .csv in python? -

Most efficient way to parse a large .csv in python? - i tried on other answers still not sure right way this. have number of big .csv files (could gigabyte each), , want first column labels, cause not same, , according user preference extract of columns criteria. before start extraction part did simple test see fastest way parse files , here code: def mmapusage(): start=time.time() open("csvsample.csv", "r+b") f: # memory-mapinput file, size 0 means whole file mapinput = mmap.mmap(f.fileno(), 0) # read content via standard file methods l=list() s in iter(mapinput.readline, ""): l.append(s) print "list length: " ,len(l) #print "sample element: ",l[1] mapinput.close() end=time.time() print "time completion",end-start def fileopenusage(): start=time.time() fileinput=open("csvsample.csv") m=list() ...

javascript - Background window popup -

javascript - Background window popup - i opening new window popup , want maintain in background , maintain focus on current window. doing doesn't work. var currentwindow = window; var newwindow = window.open("http://www.xyz.com"); currentwindow.focus(); i appreciate suggestions or kind of help. if window doesn't ever need seen, instead utilize hidden iframe. var iframe = document.createelement("iframe"); iframe.src = "http://xyz.com"; iframe.style.display = "none"; javascript javascript-events

Customize Android PreferenceFragment not working -

Customize Android PreferenceFragment not working - currently 2.x preference screens, in every preferenceactivity add together line setcontentview(r.layout.activity_preferences); have custom layout in activities. the activity_preferences.xml layout file looks this: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout style="@style/titlebar"> <imagebutton style="@style/titlebaraction" android:src="@drawable/ic_title_home" android:onclick="onhomeclick" /> <imageview style="@style/titlebarseparator" /> <eu.vranckaert.worktime.utils.view.customtextview style="@style/titlebartext" android:text="@string/lbl_preferences_title"/> ...

How to install binary portably -

How to install binary portably - is there portable way install binaries? illustration guaranteed posix there /usr/local/bin (and included in search path). or distribution alway platform dependent? posix doesn't guarantee that, else might, depending on os. in case of linux lsb. in experience, cannot count on /usr/local/* beingness universally present. not nowadays on fresh clean installs of flavours of unix. should rare though. de facto standard location third-party software can placed, , install scripts should not have qualms creating /usr/local well-known subdirectories bin , lib if don't exist , installing things there. of course, software utilize default give user selection in case want alter it. i'm not sure whether meant question installation more or pathnames & locations? command utilize in makefile recipe install things (usually install )? binary install posix

java - JPA deep inheritence annotation attributes -

java - JPA deep inheritence annotation attributes - i have hierarchical jpa mapping several classes deep. this @entity @inheritance(strategy= inheritancetype.single_table) public abstract class baseentityclass implements serializable { // lots of stuff mutual entities. } @entity @inheritance(strategy= inheritancetype.table_per_class) public abstract class entitytypeone extends baseentityclass { // stuff mutual entitytypeone } @entity @inheritance(strategy= inheritancetype.table_per_class) public abstract class entitytypetwo extends baseentityclass { // stuff mutual entitytypetwo } i know utilize @inheritence method superclass define mapping strategy. how work deep hierarchies? want leaf classes mapped own tables. should single_table baseentityclass? your base of operations class should marked table_per_class . here's illustration openjpa: @entity @table(name="mag") @inheritance(strategy=inheritancetype.table_per_class) public clas...

How can I break the string on Java? -

How can I break the string on Java? - i need write strings bytearrayoutputstream , need write strings breaking. have tried example: out.write("123".getbytes()); out.write("\n456".getbytes()); but '\n' doesn't work. please, tell me, how can prepare it? or suggest me alternative outputstream storing strings (this os must allow utilize breaking of lines) without making files. give thanks you. bytearrayoutputstream stream = ...; printstream printer = new printstream(stream, true); // auto-flush printer.println("123"); // writes newline printer.print("hello"); // no new line printer.print(" world"); printer.println(); note generate platform-specific bytes. newlines can \n , \r\n or \r . actual character sequence used specified in system property line.separator . java

ruby on rails 3 - getting a could not resolve host error when trying to install RVM on osx lion -

ruby on rails 3 - getting a could not resolve host error when trying to install RVM on osx lion - i have prereq's installed.. on osx lion 10.7.2 xcode: $ xcodebuild -version xcode 4.2.1 git: $ git --version git version 1.7.5.4 when run $ bash < <( curl -s https://rvm.beginrescueend.com/install/rvm ) i next error: curl: (6) not resolve host: hd; nodename nor servname provided, or not known not download 'https://github.com/wayneeseguin/rvm/tarball/master'. any ideas why? if run sudo goes through more errors... need install single user. path home dir is: '/volumes/macintosh hd/users/mikedevita' it seems file brew referring has moved, hence looking dead link. i got past issue running 'brew update' in terminal. after letting run, , after brew updates latest version should have latest directories , files, , result should avoid dead links. should free go on normal now. ruby-on-rails-3 osx-lion rvm

java - How to handle producer flow control in jms messaging while using apache qpid -

java - How to handle producer flow control in jms messaging while using apache qpid - i trying handle flow command situation on producer end. have queue on qpid-broker max queue-size set. have flow_stop_count , flow_resume_count set on queue. now @ producer keeps on continuously producing messages until flow_stop_count reached. upon breach of count, exception thrown handled exception listener. sometime later consumer on queue grab , flow_resume_count reached. question how producer know of event. here's sample code of producer connection connection = connectionfactory.createconnection(); connection.setexceptionlistenr(new myexceptionlisterner()); connection.start(); session session = connection.createsession(false,session.client_acknowledge); queue queue = (queue)context.lookup("test"); messageproducer producer = session.createproducer(queue); while(notstopped){ while(suspend){//---------------------------how resume flag???...

c# - Multiple DisplayMember using special class -

c# - Multiple DisplayMember using special class - i trying listbox display concatenation of multiple rows of table accommodation . because can't edit datasource, prepared class, accommodationentity , contains both original accommodation object , string want listbox display. however, reason, fail set displaymember property of listbox, displays default jibber-jabber. i set listbox follows: accommodationlist.displaymember = "texttoshow"; // load , set accommodation list<accommodationentity> relatedaccommodations = dt.listholidayaccommodation(relatedholiday); accommodationlist.datasource = relatedaccommodations; accommodationlist.refresh(); the class objects stored in datasource looks this: class accommodationentity { public accommodation classicaccommodation; public string texttoshow; public accommodationentity(stay relatedstay) { this.classicaccommodation = relatedstay.accommodation; string = relatedstay.date...

css - HTML5 element state using Javascript -

css - <audio> HTML5 element state using Javascript - hi wondering if there javascrit method help getting info on state of sound tag: is sound playing has stopped is muted is paused and sort. know can utilize play(), pause() , others not quite sure on how check in script sound playing in order trigger event/action maybe ? thanks. yes can check number of attributes on html5 media elements, list of can find in w3c html5 specification itself. under "playback state" list can see such attributes paused , muted , ended etc. javascript css html5 javascript-events html5-audio

sql server 2008 - Sql condition statements -

sql server 2008 - Sql condition statements - i have excel sheet , have formula below. calculate same formula sql. in excel formula there nested if condition. possible sql ? have tried " case .. when .. .. else .. " not manage! in excel sheet calculation result "ok" thank you, declare @projectname nvarchar(max) declare @newtotalelapsedtimeend nvarchar(max) declare @totalelapsedtime nvarchar(max) declare @slatime nvarchar(max) declare @result nvarchar(max) set @projectname = '' set @newtotalelapsedtimeend = 0 set @totalelapsedtime = 69563 set @slatime = 86400 excel formula =if(projectname<>"","projected",if(newtotalelapsedtimeend=0,if(totalelapsedtime-slatime<0,"ok","nok"),if(newtotalelapsedtimeend-slatime<0;"ok";"nok"))) this should help (done on ms sql server, maybe database scheme needs little changes syntax). case-when working fine, need have timespan values ...

How to get memory allocation by content (ex. video, music) in Android? -

How to get memory allocation by content (ex. video, music) in Android? - i developing little application, in have collect amount of memory allocated video files , sound files in both onboard , external storage on android device. can take memory allocation content (e.g. video, music) in android? there api in android above? android memory video memory-management music

scala - Continuations and for comprehensions -- what's the incompatibility? -

scala - Continuations and for comprehensions -- what's the incompatibility? - i new scala , trying wrap head around continuations i'm trying reproduce yield return c# statement. following this post, have written next code : package com.company.scalatest import scala.util.continuations._; object gentest { val gen = new generator[int] { def produce = { yieldvalue(1) yieldvalue(2) yieldvalue(3) yieldvalue(42) } } // not compile :( // val gen2 = new generator[int] { // def produce = { // var ints = list(1, 2, 3, 42); // // ints.foreach((theint) => yieldvalue(theint)); // } // } // works? val gen3 = new generator[int] { def produce = { var ints = list(1, 2, 3, 42); var = 0; while (i < ints.length) { yieldvalue(ints(i)); = + 1; } } } def main(args: array[string]): unit = { gen.foreach(println); // gen2.foreach(println); g...

HTML Rendering with TCPDF(PHP) -

HTML Rendering with TCPDF(PHP) - i using tcpdf's writehtml function page renders in browser. in output pdf, fonts small. i've tried setfont, doesn't seem have effect. have experience this? i'd add together here html not in control, prefer tcpdf options(and not modifying source html) update: able alter font size setting on body. remaining problem that, render correctly in browser, needs 12px. render correctly in pdf, needs 30px. set media on css? media type tcpdf? are using tags? tcpdf's html engine gives tag precedence on css, or other size-adjusting tags. if remove extraneous tags html , utilize straight css, things should render expected. or, if aren't using css, should. because browser displays correctly doesn't mean same on other formats. browser has performed magic of own fill in gaps in css specifications. update here's illustration of specifying css declarations html when using tcpdf. note how styling applied using css d...

PHP: Accessing child arrays when you don't know the parent's keys and you can't just search for the value needed -

PHP: Accessing child arrays when you don't know the parent's keys and you can't just search for the value needed - i have php array containing film descriptions ($descriptions) , php array containing showtimes , ticket quantities ($stock) movies. each unique film id in $descripctions, need of showtimes , tickets $stock. is there no built-in php function search unique id , homecoming chain of keys needed access value? can't find elegant solution after total day of googling , reviewing every array function in php manual twice. if there's no more elegant solution, best approach custom recursive function? if so, guidance on best approach / command structure? maybe counting array elements , using several levels of while loops go through each level of array? here's origin of $stock array i'm trying info -- won't post entire print_r() because source array on 67,000 lines long much should indicate construction i'm working with. thank mu...

python - An interesting code for obtaining unique values from a list -

python - An interesting code for obtaining unique values from a list - say given list s = [2,2,2,3,3,3,4,4,4] i saw next code beingness used obtain unique values s: unique_s = sorted(unique(s)) where unique defined as: def unique(seq): # not order preserving set = {} map(set.__setitem__, seq, []) homecoming set.keys() i'm curious know if there difference between , doing list(set(s))? both results in mutable object same values. i'm guessing code faster since it's looping 1 time rather twice in case of type conversion? you should utilize code describe: list(set(s)) this works on pythons 2.4 (i think) 3.3, concise, , uses built-ins in easy understand way. the function unique appears designed work if set not built-in, true python 2.3. python 2.3 ancient (2003). unique function broken python 3.x series, since dict.keys returns iterator python 3.x. python

php - What's wrong with this img src and a href code? -

php - What's wrong with this img src and a href code? - what's wrong : echo '<a href="https://www.facebook.com/pages/haddad-guest-house/193701947328195" target="_blank">'<img src="http://imgit.me/i/6g0r4d9.png"></a>'; you have single quote between <a> , <img> node should remove. seek this: echo '<a href="https://www.facebook.com/pages/haddad-guest-house/193701947328195" target="_blank"><img src="http://imgit.me/i/6g0r4d9.png"></a>'; php html

c++ templates in vim -

c++ templates in vim - i downloaded c++ plugin official vim site. when press hotkeys plugin vim tells me there no appropriate template. can take collection of templates c++? newbie @ vim cannot write myself. update: i downloaded c.vim : c/c++ ide. at to the lowest degree should read installation directions in readme.csupport file in downloaded .zip . the templates in c-support directory. vim

php - VAT number validation API -

php - VAT number validation API - what can guys recommend? found 1 http://isvat.appspot.com/ can validate european union numbers, seems not work properly.. returns false on valid dk vat numbers? i need validate vat numbers outside eu you can utilize european union website validate them directly: http://ec.europa.eu/taxation_customs/vies/ outside european union states don't have standardized number system, have validate each individually, see formats on wikipedia php api validation

security - Encrypt number data in Oracle -

security - Encrypt number data in Oracle - i using oracle 10g (10.0.2) want encrypt columns in table info type number because securities, there simple way it? i'd take dbms_crypto. according link, dbms_crypto provides interface encrypt , decrypt stored data, , can used in conjunction pl/sql programs running network communications. provides back upwards several industry-standard encryption , hashing algorithms, including advanced encryption standard (aes) encryption algorithm. aes has been approved national institute of standards , technology (nist) replace info encryption standard (des). alternatively, might want transparent info encryption (for need seperate licence , enterprise edition). oracle security encryption oracle10g

c++ - Build XPCOM Mozilla Sample Component -

c++ - Build XPCOM Mozilla Sample Component - i'm trying build xpcom component available here: http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/ i tried compile own makefile, component isolated whole mozilla sources. so here file tree: frinux@bureau /cygdrive/c/dev/central_sample $ ls -rlah .: total 57k d---------+ 1 frinux none 0 jan 15 21:28 . d---------+ 1 frinux none 0 jan 15 20:34 .. ----------+ 1 frinux none 989 jan 15 21:22 makefile ----------+ 1 frinux none 2.4k jan 15 21:05 nsisample.idl ----------+ 1 frinux none 6.0k jan 15 21:05 nssample.cpp ----------+ 1 frinux none 5.1k jan 15 21:06 nssample.h ----------+ 1 frinux none 2.0k jan 15 21:06 nssample.js ----------+ 1 frinux none 131 jan 15 21:06 nssample.manifest ----------+ 1 frinux none 4.7k jan 15 21:06 nssamplemodule.cpp d---------+ 1 frinux none 0 jan 15 21:28 programme ----------+ 1 frinux none 8.7k jan 15 21:06 xpconnect-sample.html ./program: total 16k d---------+ 1 frinux none 0...

error in playing a video of 720*480 resolution in android application from sd card -

error in playing a video of 720*480 resolution in android application from sd card - i developing android application in have play video stored in sd card.when run code showing error sry video cannot played.dont know error ..i have done lot of r , d.but cant find exact solution.i have tried different formats.but not working,.my java class code http://pastebin.com/kxsgu4ux.i thankful you can help me regard thanks in advance tushar android

python - library for transforming a node tree -

python - library for transforming a node tree - i'd able express general transformation of 1 tree without writing bunch of repetitive spaghetti code. there libraries help problem? target language python, i'll @ other languages long it's feasible port python. example: i'd transform node tree: (please excuse s-expressions) (a (b) (c) (d)) into one: (c (b) (d)) as long parent , sec ancestor c, regardless of context (there may more parents or ancestors). i'd express transformation in simple, concise, , re-usable way. of course of study illustration specific. please seek address general case. edit: refactoringng kind of thing i'm looking for, although introduces exclusively new grammar solve problem, i'd avoid. i'm still looking more and/or improve examples. background: i'm able convert python , cheetah (don't ask!) files tokenized tree representations, , in turn convert lxml trees. plan re-organize tree , write-out r...

osx - I want -e to work case-sensitively on OS X. Is it possible? -

osx - I want -e to work case-sensitively on OS X. Is it possible? - i'm developing script makes utilize of -e flag, in unless (-e $filename) { ... } this works fine on os x. or, rather, doesn't work correctly. want case-sensitive. script run on linux machine, , -e check fails--rightly!--because of case sensitivity. i tried alternate path open <filehandle, '$filename') , seems that, too, case insensitive. edit: answered below. know hfs+ case-insensitive, thought "force" somehow. did end forcing check doing like: opendir my($dh), $dirname or die "couldn't open dir '$dirname'"; @reffiles = readdir $dh; closedir $dh; foreach $reffile (@reffiles) { if ($reffile eq $reffilename) { $found = 1; } } the famous mantra: "it's not pretty, works." the lack of case sensitivity due filesystem using (hfs+), not perl functions -e , open , nor underlying stat(2) , open(2) scheme calls...

android - Activity wont import AdMob AdManager -

android - Activity wont import AdMob AdManager - i working on implementing admob adview in app. did similar 5 months ago. however, there seemed problem new sdk. whenever utilize admanager.settextdevices, error on admanager no alternative import admanager, , if type import manually, wont work. sure have imported sdk properly. im 4.3.1. ideas? there no admanager.class file in 4.3.1 admob sdk. if trying set test devices, utilize adrequest.addtestdevice or adrequest.settestdevices , import com.google.ads.adrequest instead. android android-activity import admob

flash - Accurately measuring time delta -

flash - Accurately measuring time delta - as understand, gettimer() inaccurate - on own machine returns value product of ~16. (16, 33, 50, etc.) is there simple , efficient way more accurately measure time difference (delta) between 2 separate calls in program? i have looked info on subject, of find seems unnecessarily elaborate. edit: digging further, , help colleague, apparently can timing using sound. seek creating new sound object, playing , extract position property returned soundchannel -object. there ideas here: stack overflow - accurate bpm event listener in as3 i haven't tried this, seek using date class , extracting milliseconds property it, , utilize that. i'm unsure of how accurate is, in comparing gettimer, might worth experimenting with. see as3: date documentation more information. note date doc explicitly says this: to compute relative time or time elapsed, see gettimer() method in flash.utils package. other think you're stuck u...

war - Cargo maven plugin - start goal ignores configuration, "run" works fine -

war - Cargo maven plugin - start goal ignores configuration, "run" works fine - i want cargo maven plugin start tomcat7 set pom: <plugin> <groupid>org.codehaus.cargo</groupid> <artifactid>cargo-maven2-plugin</artifactid> <version>1.2.0</version> <!-- minimal configuration allow adb run (mvn bundle org.codehaus.cargo:cargo-maven2-plugin:run) in local tomcat --> <configuration> <containerid>tomcat7x</containerid> <containerurl>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip </containerurl> <configuration> <properties> <cargo.servlet.port>1718</cargo.servlet.port> </properties> </configuration> ...

objective c - Resize UIImage/UIImageView without keeping aspect ratio -

objective c - Resize UIImage/UIImageView without keeping aspect ratio - i have uiimageview i've added pinchgesturerecognizer to. currently, image resized nicely when pinching, want able resize image without maintaining aspect ratio. if user pinches horizontally, image view's width enlarge; if pinch vertically, height enlarge , forth. can give me hint on how please? write custom gesture recognizer requires 2 fingers on screen. 1 time both fingers on screen store offset imageview's border in uiedgeinsets. in touchesmoved, check if both fingers onscreen: if so, calculate new frame applying edgeinsets in current touch position. header: click implementation: click works , feels more natural other implementations i've seen. objective-c ios5 uiimageview uiimage

vBulletin Post ID Variable in Plugin -

vBulletin Post ID Variable in Plugin - first off, i'd give thanks replies in advance-- i using vbulletin 3.7 (old, know...), , trying add together plugin includes variable $post['postid']. however, doesn't seem work. hook location 'postbit_display_start'. i see no need post more information; problem small, , simple. try utilize postbit_display_complete hook location. , utilize plugin code on local installation echo '<pre>';print_r($post);echo '</pre>'; to see within $post. vbulletin

Bind a event listener to a submit form between a specific date and time in JavaScript -

Bind a event listener to a submit form between a specific date and time in JavaScript - i want popup message when user click on submit button between date of 2012-01-22, 00:00 2012-01-25, 23:59. write code below, won't works. suggest how convert date integer can check if today date greater x , less x, popup message? thanks function holiday_alert_msg() { var today_date = new date(); if (today_date > 201201220000 && today_date < 201201252359) { alert("today holiday"); } } $('#submit').bind('click', function() { holiday_alert_msg(); }); you can this: function holiday_alert_msg() { var today_date = new date(); // month parameter 0 based if (today_date > new date(2012,0,22) && today_date < new date(2012,0,25,23,59)) { alert("today holiday"); } } $('#submit').bind('click', holiday_alert_msg); javascript

apex code - Compare two views in salesforce -

apex code - Compare two views in salesforce - i looking way compare 2 views in salesforce. want create visual forcefulness page lets user select 2 views associated business relationship object , show accounts appear on both views. i struggling pretty hard here, can't figure out how results views, hoping there way accounts match filters each view. here soql query: select id, name, owner.name business relationship id in ( select accountid chance recordtypeid = :recordtype1id , stagename in :stageonelist ) , id in ( select accountid chance recordtypeid = :recordtype2id , stagename in :stagetwolist ) this basis of vf page have made far. possible filter business relationship account owner , drop downwards list province. thought is, many people in organization have created views accounts filtered need it. instead of including every possible business relationship field filter, drop downwards list of active users views associated account, , can selec...

wordpress - PHP SOAP call working in development but not in production -

wordpress - PHP SOAP call working in development but not in production - why php nusoap getproxy() (http://sourceforge.net/projects/nusoap/) phone call development webservice (splendid) homecoming object in development environment, , homecoming null in production? able create phone call production webservice development machine (but can't create phone call production machine production webservice). we using iis, same version of wordpress, same plugin, same version of php, , same source code: $this->client = new nusoap_client(splendid, true, false, false, false, false, 0, 30, ''); $proxy = $this->client->getproxy(); // getype($proxy) returns object in development //and null in production i understand can't pinpoint exact problem, pointers or tips appreciated. it because of iis server settings. made .net helpers ended telling me error. php wordpress soap wsdl nusoap

javascript - Validate at least 1 file input is completed with jQuery -

javascript - Validate at least 1 file input is completed with jQuery - here form <form action="b.php"> <input type="file" name="file[]"> <input type="file" name="file[]"> <input type="file" name="file[]"> <input type="file" name="file[]"> <input type="submit" value="value"> </form> the questions how ensure @ to the lowest degree 1 field have selected file jquery? try this: var validfields = $('input[type="file"]').map(function() { if ($(this).val() != "") homecoming $(this); }).get(); if (validfields.length) { alert("form valid"); } else { alert("form not valid"); } example fiddle javascript jquery html

How does Internationalization in ASP.NET work? -

How does Internationalization in ASP.NET work? - i wonder if possible create application multilingual creating resource files every required language like resource.resx english language //string abc(name)=xyz(value) resource.zh.resx chinese //string abc(name)=zh(value) and placing string in view(single view back upwards multilingual) string like @appname.resource.abc and <globalization culture="en-gb" uiculture="auto:en-gb" /> in web.config now question is is plenty started multilingual sites i.e if alter preferred language in browser chinese content of page changing? how work? what know is browser returns preferred civilization list need know - how mapping particular resource file take place. mean both resource files (resource.resx , resource.zh.resx) in illustration have 'abc' property different value. how asp.net figure out value render? there naming convention? at run time, asp.net uses re...

Django redirect with kwarg -

Django redirect with kwarg - i new python , django , have question regarding redirect function. this reduced version of views.py file. def page_index(request, error_message=''): print error_message def add_page(request): homecoming redirect('page_index') # work fine homecoming redirect('page_index', error_message='test') # not work and here short version of urls.py urlpatterns = patterns( 'x.views', url(r'^$', 'page_index', {'error_message': 't'}, name='page_index'), url(r'^add/$', 'add_page', name='add_page'), ) when seek redirecting page_index without keyword argument works fine, when utilize kwag next error message: noreversematch @ /pages/add/ reverse 'page_index' arguments '()' , keyword arguments '{'error_message': 'test'}' not found. what doing wrong? short answer: the...

oop - OO class diagram for directory structure in UNIX || Windows -

oop - OO class diagram for directory structure in UNIX || Windows - this interview question asked me (not homework question). did give reply wanted professional sentiment on whether reply gave relevant or not. proper question was: construct object oriented design unix || windows directory structure? thanks in advance!! since we're talking oo, assume wants concentrate on operations , structure. a file , directory implement mutual interface involving mutual operations have own operations. a tree construction involved, either directories , files part of tree or (as i'd do) tree external construction references files , directories. i'd list mutual operations in interface (delete, getsize), file-only operations (open, read, write, ...) in file interface/object , directory-only operations (changedirectory, createchilddirectory, createfile) in directory object. the point, however, open plenty question ensure there no right answer, rather it's...

Rails concurrent background processes -

Rails concurrent background processes - i need access , pull info number of api's on the course of study of number of days. streaming info process running time. each process pulling in info , inserting separate google fusion table. as want run processes in background , forget them, beingness able monitor fail , don't restart. i have looked @ delayed job, resque, beanstalk etc , question can these run processes concurrently. don't want queue processes run them in background. i looked @ spawn well, didn't understand how worked. so options available me, have recommendations? i utilize whenever gem schedule cron jobs pull data. every 2.hours yourapi.do_whatever secondapi.do_the_thing end ruby-on-rails ruby-on-rails-3 delayed-job resque spawn

visual studio - Keyboard shortcut to navigate through screens in VS project properties? -

visual studio - Keyboard shortcut to navigate through screens in VS project properties? - once in project properties dialog, there vertical listing of tabs on left hand side (application, build, build events, etc). there known keyboard shortcut cycle through them? ctrl+page up , ctrl+page down visual-studio keyboard-shortcuts

c# - Remove validation error after rejecting changes on DataGrid -

c# - Remove validation error after rejecting changes on DataGrid - i have datagrid , bound typed datatable , this: <datagrid itemssource="{binding path=mytypeddatatable}" ... /> this datagrid has rowvalidationrule . works ok exept in 1 case: when there error in row , press undo button ( mytypeddatatable.rejectchanges() ); validation error still there , info in row still same. in cases when there no errors, rejectchanges() works normally. how can create validation error disappear? in advance suggestions. i utilize , works in projects. public class rowdatavalidationrule : validationrule { public override validationresult validate(object value, cultureinfo cultureinfo) { bindinggroup grouping = (bindinggroup)value; foreach (var item in group.items) { datarowview rowview = item datarowview; datarow row; if (rowview != null) row = rowview.row; else ...

matrix - Regression in R using vectorization and matrices -

matrix - Regression in R using vectorization and matrices - i have vectorization q in r using matrices. have 2 cols need regressed against each using indices. info matrix_senttor = [ ... 0.11 0.95 0.23 0.34 0.67 0.54 0.65 0.95 0.12 0.54 0.45 0.43 ] ; indices_forr = [ ... 1 1 1 2 2 2 ] ; col1 in matrix info msft , goog (3 rows each) , col2 homecoming benchmark stkindex, on corresponding dates. info in matrix format sent matlab. i utilize slope <- by( data.frame(matrix_senttor), indices_forr, fun=function(x) {zyp.sen (x1~x2,data=x) $coeff[2] } ) betasfac <- sapply(slope , function(x) x+0) i'm using data.frame above not utilize cbind(). if utilize cbind() matlab gives error doesn't understand format of data. i'm running th...

rails content_tag nav builder helper -

rails content_tag nav builder helper - sorry if sounds obvious i'm getting confused. i'm trying build navigation list helper. at moment receives list of links array. module applicationhelper def site_pages %w{index contact promotions} end def nav_builder list list.map |l| content_tag :li content_tag :a, :href => "#{l}_path" l end end end end end but when run page ouput page array. [<li><a href="index_path">index</a></li> <li><a href="about_path">about</a></li> <li><a href="contact_path">contact</a></li> <li><a href="promotions_path">promotions</a></li>] instead of displaying list of links. there special do? ==edit== i phone call builder way: <%= nav_builder site_pages %> the helper expected homecoming string of html, rather arr...

css - Cycle testimony transparent background in IE not working -

css - Cycle testimony transparent background in IE not working - i'm using jquery cycle display testimonials on site , want set background transparent. having changed css background transparent in ff, safari, chrome , opera refuses transaprent in ie (specifically 8/9). i've tried manner of things including using transparent background png/gif no avail. you can see on test site www.roadtotheweb.co.uk does know how create transparent? or testimony rotator utilize instead create transparency easier deal with. thanks the problem ie set background color #fff; if view source in ie, see: <blockquote style="z-index: 5; position: absolute; width: 308px; zoom: 1; display: block; background: #ffffff; height: 150px; top: 0px; left: 0px" jquery15205686771777138462="2" cycleh="150" cyclew="308"> <p>"lorem ipsum dolor sit down amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dol...

Graph API & Real-Time updates -

Graph API & Real-Time updates - my need have facebook poll server using post requests whenever user has "allowed / installed" application changes something, eg, checkins. i have followed page @ http://developers.facebook.com/docs/api/realtime thoroughly , have set subscription. when place request subscriptions graph below response. { "data": [ { "object": "user", "callback_url": "http://www.hidden.com/forsecurity/callback.php", "fields": [ "checkins", "feed" ], "active": true } ] } which tells me subscription set up, , when user has authenticated app, changes feed / checkins, post request should sent callback_url. the problem is, not. have googled, troubleshooted, googled more, redid , can't seem find answer. i have tested callback.php file posting it, , captured data, capture in $_post create sure if there captu...