Posts

Showing posts from August, 2010

.net - Saving files in Windows Store apps -

my program handles files specified user. after preferable retain modified file directory of source file. storagefolder.getfolderfrompathasync method returns "access denied" . file type associations in manifest can not added because after processing files retain extension. , kind of file (with extension), user chooses impossible. code in error occurs. internal async static void setfile(list<byte> bytearray , storagefile file) { try { string path = path.getdirectoryname(file.path); storagefolder newfolder = await storagefolder.getfolderfrompathasync(path); storagefile newfile = await newfolder.createfileasync(string.format(@"crt{0}", path.getfilename(file.name)), creationcollisionoption.failifexists); stream stream = await file.openstreamforwriteasync(); binarywriter writer = new binarywriter(stream); writer.write(bytearray); writer.flush();

compression - Get compressed and uncompressed page size with PHP -

http://www.gidnetwork.com/tools/gzip-test.php great tool, need test site behind walls , want find similar results: compression type, markup size, compressed page size, , compression ratio. how can both compressed , uncompressed page sizes? better method fetching data ( file_get_contents() or curl )? the response headers contain else needed - i'm not sure sizes. you have use curl there 2 reasons so: as need headers of request , can have through curl easily file_get_contents() used internally include things , not external source fetch data. if used external purposes there issue memory limit, size etc. have taken great care of.

ios - Simple NSData's category to parse XML with cyrillic -

i have parse nsdata xml string, know simple category it? have such json, forced use xml. tried use xmlreader, it's interface looks clean, found issues: mysterious new line characters , spaces everywhere: "comment_count" = {text = "\n \n 21";}; my cyrillic symbols looks so: "description_text" = {text = "\n \u041f\u0438\u043a\u0430\u0431\u0443\u0448}; example: <?xml version="1.0" encoding="utf-8" ?> <news> <xml_count>43</xml_count> <hot_count>449</hot_count> <item type="text"> <id>1469845</id> <rating>147</rating> <pluses>171</pluses> <minuses>24</minuses> <title> <![cdata[Обновление огромного архива Пикабу!]]> </title> <comment_count>26</comment_count> <com

arrays - Echo only info - Session PHP -

how can echo information in session people added them self? script: <?php session_start(); $array = $_session["wenslijst"]; if (isset($_post["item"]) && (int)$_post["item"] > 0) { if (!isset($_session["wenslijst"])) { $_session["wenslijst"] = array(); $_session["aantal"] = array(); } $i = 0 ; while ($i < count($_session["wenslijst"]) && $_session["wenslijst"][$i] != $_post["item"]) $i++; if ($i < count($_session["wenslijst"])) { $_session["aantal"][$i]++; } else { $_session["wenslijst"][] = $_post["item"]; $_session["aantal"][] = 1; } } ?> when add product array looks this, echo bold message: (see long code spefic number product) array ( [0] => ar

vba - Access Excel parameter passing -

i have table in access has accessed in excel. set macro dumps whole table , filters based on particular cell within vba since have 20,000 records slows sheet. is there faster way of passing parameter? the method tried 1 of answers posted previously •in excel go data ribbon , click other sources icon •click microsoft query •select ms access database* •browse , select database. •in wizard select columns need import •on next page select column want filter on •select type of filter need, i.e. equals •instead of selecting value in next box enter [parameter please bob] •enter sort on next page •select return data microsoft excel , finish but somehow not able pass excel cell parameter. trying running in vba trying figure out how works out manually. any appreciated. thanks aprough, followed through procedure not selects parameters field once have set up, right-click anywhere in returned data , choose parameters. select parameter on left, , choose "get value fol

ruby on rails 3 - Will CSRF token warning prevent devise from having a current user? -

i use jquery ajax update timeslot model page showing campaign. campaign signup sheet columns of days , rows of time_slots. user can join timeslot clicking correct checkbox. when implemented feature several months ago wasn't getting errors. now, i'm getting 500 error saying there internal server error. did digging , appears error caused devise's current_user method not returning value. there csrf warning in log. causes nilclass returned , mismatched type exception thrown. causes 500 error. do need supply csrf token information in ajax call? if do, best way it? you can skip csrf check controller action ajax calling with: skip_before_filter :verify_authenticity_token, :only => :some_action

osx - How do I programmatically move Spaces' focus to a particular Space a window I want to focus on lives on Mac OS X with Objective-C? -

in osx menubar application, user can open particular application nswindow dropdown menu item. being menubar application, accessible any desktop (a desktop in mission control 'space' ). i've got reference window programmatically. say user has clicked menu item while on desktop 1 , active desktop. naturally, nswindow created, opened, brought front. lives on desktop 1 the user browses desktop 2 , it's active desktop. the user clicks on menu item again. since window open on desktop 1 , i'd spaces automatically bring set active desktop desktop 1 again, user can see window he/she wanted see. how programmatically achieve objective-c cocoa in osx?

Rails: update nested resource from the view -

i need form update tasks, belong projects projects view , error no route matches [patch] "/projects/1/tasks/1/edit" this list of routes available project_tasks_path /projects/:project_id/tasks(.:format) tasks#index post /projects/:project_id/tasks(.:format) tasks#create new_project_task_path /projects/:project_id/tasks/new(.:format) tasks#new edit_project_task_path /projects/:project_id/tasks/:id/edit(.:format) tasks#edit project_task_path /projects/:project_id/tasks/:id(.:format) tasks#show patch /projects/:project_id/tasks/:id(.:format) tasks#update put /projects/:project_id/tasks/:id(.:format) tasks#update delete /projects/:project_id/tasks/:id(.:format) tasks#destroy projects_path /projects(.:format) projects#index post /projects(.:format) projects#create new_project_path /projects/new

mysql - SQL Query, how to get all elements from one list and only the similar ones from another table -

i have 2 tables, , have partids similarity branch them. need pull 3 columns first table , 2 columns table 2. the problem having table 1 has more or different partids table 2 , ok. in third table want able have query can run , give me partids first table , second table if dont exist in other one. if exist in both data this code shows partids similar between both tables: select `sheet1$`.enspieceid, `sheet1$`.`part number`, `sheet1$`.description,`sheet1$`.titretype, `sheet1$`.utilization, `sheet2$`.notes, `sheet2$`.justification `sheet1$` `sheet1$`, `sheet2$` `sheet2$` `sheet1$`.enspieceid = `sheet2$`.enspieceid i need can flag partids coming 1st sheet , 2nd sheet. select `sheet1$`.enspieceid, `sheet1$`.`part number`, `sheet1$`.description,`sheet1$`.titretype, `sheet1$`.utilization, `sheet2$`.notes, `sheet2$`.justification `sheet1$` `sheet1$` left join `sheet2$` `sheet2$` on `sheet1$`.enspieceid = `sheet2$`.enspieceid would return records sheet1 , in sheet 2 mat

actionscript 3 - trace of array not changing after item's value was change -

so got 2d array simple map editor. every tile/cell of map have value of 0 default , mouseclick event listener. (var i:int =0; < _numrow; i++) { _map[i] = new array ; (var j:int = 0; j< _numcol; j++) { //i removed content _tile.val = 0; _tile.addeventlistener(mouseevent.click,onmouseclick); addchild(_tile); _map[i][j] = _tile.val; } } edit: click tile/cell, happen. problem commented. private function onmouseclick(e:mouseevent) { if (e.currenttarget.val == 0) { e.currenttarget.val = 1; trace(e.currenttarget.val); // trace output want, 1 of each tile clicked. e.currenttarget.transform.colortransform = new colortransform(1,0,0); trace(_map[0]); // check here if _map change since _map[x][x] = _tile.val, should output change made above. [[1,1,1,0,1

exception - Scope of Application.OnException AND Delphi -

i new programmer , trying understand how delphi's application.onexception event works. colleague has modified default exception handling creating own method , instantiating , passing application.onexception in initialization section of unit. unit declared in uses clause of unit , otherwise unused. unit adldebug; ... class procedure tadlexceptionhandler.adlhandleexception (sender: tobject; e: exception); ... initialization handler := tadlexceptionhandler.create; application.onexception := handler.adlhandleexception; i can step initialization section using debugger, , not adlhandleexception method. trying cause exception in code caught redefined handleexception method. should scope of redefined handleexception method in units include adldebug ? thinking should application wide, can't seem call it. the scope of application.onexception indeed application wide. event fire whenever exception raised not handled. you failing see event fire because r

validation - How to retrieve action error messages using multiple redirect actions in struts2? -

i'm using struts2 , struts.xml looks this: <action name="actiona" class="actionaclass"> <result name="success" type="redirectaction">actiond</result> <result name="error" type="redirectaction">actionb</result> </action> <action name="actionb" class="actionbclass"> <result name="success" type="redirectaction">actionc</result> <result name="error" type="redirectaction">actionc</result> </action> <action name="actionc" class="actionaclass"> <result name="success">homepage.jsp</result> <result name="error">homepage.jsp</result> </action> as can see, actiona error result redirect actionb , actionb error result redirect actionc. @ end, want display error message @ homepage.jsp homepage loaded

ruby on rails - Generating reset_password_token in non-Devise controller -

i processing form new controller , using email, want automatically send user reset password email. there kind of devise short-code have call in order this? assuming have recoverable set up, user model should have send_reset_password_instructions method available. use it, in controller: user = user.find_by_email(params[:email]) user.send_reset_password_instructions flash[:notice] = "reset password instructions have been sent #{user.email}." redirect_to whatever_path for more on method, see documentation: http://rubydoc.info/github/plataformatec/devise/master/devise/models/recoverable#send_reset_password_instructions-instance_method .

javascript - Watch and recompile individual templates with grunt -

i have directory bunch of jade templates , , grunt task compiles of them individual html files. i'd have watch task recompiles template when changes, right task recompiles every template when of them change. here demo in gist. is there succinct way write task recompiles template when changes, not of other templates? the solution add filter function files list: var fs = require('fs'); var join = require('path').join; module.exports = function(grunt) { grunt.initconfig({ jade: { files: { src: ['*.jade'], dest: './', expand: true, ext: '.html', filter: function(destdir, src) { var dest = join(destdir, src.replace(/jade$/, 'html')); var destmod; try { destmod = +fs.lstatsync(dest).mtime; } catch (e) { if (e.code === 'enoent') { // there's no html file, ensure

calculus - Fast integration technique in matlab? -

so have following function need code: lm = 1/d integral[exp(-i(a(x)t+mkx)) dx (from 0 d) what have right is: l = (1/period) * int(exp(- 1i*(ax*t+(m*k*x))),x,0,period); subs(l,[t,m],[beta0,tt]); where symbolic. takes long time if ax challenging (sin(x)). figure out way simplify this. have array a_x(xi) , have been referred colleagues quad function, far not sure how use that. thanks if integrand doesn't change (variables not function of x ) see no reason why couldn't take output of symbolic integration , use numerically without performing integration: kmp = k.*m.*period/2 l = exp(-1i*(ax.*t+kmp)).*sin(kmp)./kmp otherwise, yes, should matlab's quadrature integration methods – work vary similary sym/int , numerical values , functions. in newer versions of matab try integral or use quadgk . this: fun = @(x)exp(-1i*(ax*t+(m*k*x))); l = (1/period)*integral(fun,0,period); note highly oscillatory functions, quadrature methods have difficulty. sho

javascript setInterval not keeping it's timing properly -

i've got multiple elements on page fade in , out on timer using javascript setinterval set them in motion. have them delayed offset create nice cascading effect, if leave page open long enough, catch 1 , timing gets messed (you've got leave few minutes). i have ugly example of issue @ codepen here: http://www.cdpn.io/wgqjj again, you've got leave page open , untouched few minutes see problem. if had more items on page (5 or 10) problem becomes more apparent. i've used type of effect several jquery photo rotator plugins, , on time, issue crops up. is there explanation this? here code i'm using (i know javascript cleaner): html: <p id="one">first</p> <p id="two">second</p> <p id="three">third</p> javascript: $(document).ready(function() { var timer1 = settimeout(startone,1000); var timer2 = settimeout(starttwo,2000); var timer3 = settimeout(startthree,3000); }); function star

unity3d - Changing the foreground color of a glyph in a texture -

before dwell issue i'm having, more context needed. i've written fontrenderer class render text. here's how works: during run-time, if display string abc , gameobject generated have 3 quads, each uv coordinates of every glyph looked atlas texture. simple enough. allows single draw call given same material used. however, if add feature of, changing foreground of specific glyph, how approach problem? plan \c escape sequence so: \c[a-f]{2}[a-f]{2}[a-f]{2} . for example, if color a in abc red , rest of string white, pass following string fontrenderer : "\cff0000a\cffffffbc" . my first thought make use of atlas texture. idea behind plot new glyph new foreground color , allocate sprite within atlas texture. however, can quite complex. my next idea use vertex/fragment shader i'm unsure if possible. issue if possible, instance of material using shader needed every rendered string increasing number of draw calls. what other way can done? p

performance - Slow load image from button Tool after event Mouse hover and leave in VB.net -

sorry english writing new vb.net. have button sets image background picture using mouse hover , mouse leave change image . problem seem slow when loading images after event. there way improve performance? private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load button1.backgroundimage = my.resources._1 end sub private sub button1_mousehover(byval sender object, byval e system.eventargs) handles button1.mousehover button1.backgroundimage = my.resources._2 end sub private sub button1_mouseleave(byval sender object, byval e system.eventargs) handles button1.mouseleave button1.backgroundimage = my.resources._1 end sub its not image slow load rather default time needs fire mousehover event here more info on mousehovertime seem can set system wide via api though. a alternative use mouseenter instead of mousehover private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load butto

.net - How to sign assemblies in MVC web application prior to deployment -

i'm going deploying mvc 4 web application hosting provider via vs web deploy. i've never signed .net assemblies research seems there 2 ways: use assemblylinker (al.exe) use [assembly:assemblykeyfileattribute("keyfile.snk")] or [assembly:assemblykeynameattribute("mycontainer")] since want avoid rdp'ing host , signing assemblies post deployment. i'll assume should use option 2. i used vs command prompt generate file: sn.exe -k mydomain.snk now should add [assembly:assemblykeyfileattribute("mydomain.snk")] assemblyinfo.cs in each project in solution , deploy application? what default locations check file? i'd avoid adding each project , have 15 copies floating around. am missing else? i have in common or shared folder on same level project folders , provide relative path it. default folder project's binaries folder (debug/release) far remember.

sql - Mysql, get rows before specific row in a multi-column index -

say have table high-scores: id : primary key username : string score : int user names , scores can repeating, id unique each person. have index high-scores fast: unique scores ( score, username, id ) how can rows below given person? 'below' mean go before given row in index. e.g. ( 77, 'name7', 70 ) in format ( score, username, id ) want retrieve: 77, 'name7', 41 77, 'name5', 77 77, 'name5', 21 50, 'name9', 99 but not 77, 'name8', 88 or 77, 'name7', 82 or 80, 'name2', 34 ... here's 1 way result: select t.score , t.username , t.id scores t ( t.score < 77 ) or ( t.score = 77 , t.username < 'name7' ) or ( t.score = 77 , t.username = 'name7' , t.id < 70 ) order t.score desc , t.username desc , t.id desc (note: order clause may mysql decide use index avoid " using filesort " operation. index "covering"

bloomberg - Pulling minute bar data with bar() function in Rbbg (RBloomberg) package in R -

i new rbbg package, please excuse ignorance on part, wondering if possible pull more ~25 days of minute bar data using bar() function. i've found can't pull more 25 or 26 days worth of data , wondering if doing wrong, or if not possible. here code using: #install.packages("rjava") #install.packages("rbbg", repos="http://r.findata.org") #install.packages("timedate") library(rjava) library(rbbg) library(timedate) conn <- blpconnect() weekdays = timesequence(from = (sys.date()-38), = (sys.date()-1), = "day")[isweekday(timesequence(from = (sys.date()-38), = (sys.date()-1), = "day"))] date_time=numeric() volume=numeric() for(i in 1:length(weekdays)){ start.date <- paste(weekdays[i],"13:30:00.000") end.date <- paste(weekdays[i],"20:00:00.000") raw=bar(conn, "goog equity", "trade", start.date, end.date, "1") date_time=append(date_time,raw$time) volum

Can jQuery fadeIn() add a class instead of an inline style? -

when running .fadein() jquery automatically adds display:block inline selector: $('div').hide().fadein(); is possible result this: <div class="active"></div> instead of this: <div style="display:block"></div> i don't want add/remove inline styles. can't remove style attribute because there might styles set not have control over. want add class on fadein() instead of add inline display:block style. you try adding active class , clearing display style after fadein() completes so: $('div').hide().fadein(400, function() { $(this).css('display', '').addclass('active'); }); here's quick example: js fiddle

Is there a reliable tool for removing comments in ASM/C/C++ code? -

i know question has been asked before (e.g.: see remove comments c/c++ code ), haven't found satisfiable result. i parsing set of complex c/c++ code first must normalized, includes eliminating comments input source code. all decommenting tools have tried failed degree, , includes: decomment stripcmt cloc note: have tried "gcc -fpreprocessed -e", not lead perfect result; output has weird macro annotations keeping tack of lines of code. to illustrate problem particular tool (cloc), removing comments this header file leads removing non-comments well, such includes in begining of file. that said, there reliable tool comment removal can used in stripping out comments in exceptionally complex code? much appreciated. #!/bin/bash if [[ "$#" != 1 ]] ; echo "usage: stripcomments input-file" > /dev/stderr exit fi gcc -fpreprocessed -dd -e -p "$1" 2> /dev/null

AWK/SED to remove first part of path -

i'm writing script pull users ad home , i've been able users smbhome dscl command , need path this: //server-01/home-employee/user_name to this: /home-employee/user_name i've tried used awk command of /usr/bin/awk 'begin{rs="//"; fs="/"}{print$1}' think i'm going in wrong direction here. sed better choice? for example, using sed: kent$ echo "//server-01/home-employee/user_name"|sed 's#//[^/]*##' /home-employee/user_name

browserstack requesting localhost:45691 -

anyone idea why browserstack might requesting localhost:45691. when open browserstack in chrome request continuously. xmlhttprequest cannot load localhost:45691. origin http://www.browserstack.com not allowed access-control-allow-origin. in ff showing js file causing issue localhost:45691/ http://www.browserstack.com/assets/bsjs.js?1376347645 anyone having issue? sent report browser stack 3 days ago , nothing either. driving me crazy. browserstack provides feature of local testing via command line tunnel. check if tunnel connected or not, javascript(js) tries talk http server runs on port 45691 inside browserstacktunnel.jar. when don't have command line tunnel set, js gets these errors, turns 200 ok response tunnel gets connected.

database - Insert part of a PL/SQL output into a message body and email it -

i trying create pl/sql program allow me automatically send out emails data picked in output of sql command. my current output columns are db_name sc_name ro_name user_name email_id. there 293 rows in output. out of 293... there 11 distinct outputs in the user_name column. example: 1 of distinct outputs in user_name column john. now... every row john... want send email email id mentioned in corresponding email_id row. how extract information send email based on each of distinct outputs? * edit * http://i.imgur.com/0q5paqs.png if @ image above... want email jmgr@gmail.com first 3 rows ( user_name john). , want email mmgr@gmail.com 4th row (where user_name mike) , forth. the image above have far. you want use listagg() function: select email_id, listagg(db_name || ' ' || sc_name || ' ' || ro_name, ', ') within group(order db_name, sc_name, ro_name) message table group email_id

javascript - How to animate the width of a div slowly with jquery -

i have navigation nested in div offscreen left , when user scrolls down page , reaches pixel 296, left navigation appears it's width growing towards right. what have half working. navigation nested in div appears when user scrolls down page want animate right , not happening. not sure doing wrong. specific line having problems is: $("#slidebottom").animate({ width: "100" }, 'slow'); but here entire code: $(window).scroll(function(){ var wintop = $(window).scrolltop(), docheight = $(document).height(), winheight = $(window).height(); var bottomheight = $("#slidebottom").height(); var zeroheight = 0; if  (wintop > 296) { bottomheight = $('#slidebottom').height(docheight); $("#slidebottom").animate({ width: "100" }, 'slow'); } if( wintop < 296) { bottomheight = $('#slidebottom').height(zeroheight); //$("#slidebottom").animate({ widt

python - How to make dots change color when they land in a box -

this question exact duplicate of: set dot color based on in python turtle? 2 answers from turtle import * random import randint speed("fastest") pendown() goto(200, 0) goto(200, 200) goto(0, 200) goto(0,0) goto(200,200) area_size = 800 max_coord = area_size / 2 num_dots = 300 setup(area_size, area_size) _ in range(num_dots): dots_pos_x = randint(-max_coord, max_coord) dots_pos_y = randint(-max_coord, max_coord); if dots_pos_y > dots_pos_x , dots_pos_y <= 200: elif dots_pos_y <= dots_pos_x <= 200: else: hideturtle() done() ok code draws square line splitting making 2 equal triangles, , generates 300 randomly places dots on screen. want know how can dots land in 1 half of square turn red , when land in other half of square want them turn blue. , ones don't land in box stay black? any appreciated. i suppo

menu - Floating/Hovering PageList in Blogger -

does know how create or know html/css floating/hovering pagelist (navigation menu bar) blogger? seen here: http://www.fabulousk.com & http://apairandasparediy.com/ . want display when user scrolling down on site. i'm using code edit text of pagelist, if helps any. .pagelist {text-align:center !important; text-transform:uppercase; border-top: solid black 1px; border-bottom: solid black 1px; letter-spacing:2px} .pagelist li {display:inline !important; float:none !important;} i have read tutorial this. can done using jquery. first of need have id of pagelist gonna #pagelist1 then add style want add , then add css, using class sticky. so in case of second example this: .sticky{ position: fixed; top: 0; left: 0; width: 100%; background: white; } then add following script (best in widget, , put in bottom of blog) (if have jquery framework, don't need add first line. what scipt add class sticky pagelist, stick top scroll down.

windows - Does .net run on Unix and Mac? -

quoting documentation of path.directoryseparatorchar the value of field slash ("/") on unix, , backslash ("\") on windows , macintosh operating systems. did ms, text there since @ least .net 1.1 , write in anticipation of future port or of creation of (something like) mono? or can run .net on non-ms os? you have read .net's history , close relationship java, know of why such designs exist in api. microsoft shiped java, , extended feature set developing j++. sun bans such attempts , that's why .net born. thus, .net similar java, , api speaking portable. http://en.wikipedia.org/wiki/visual_j%2b%2b http://en.wikipedia.org/wiki/.net_framework however, microsoft never releases .net framework other platforms except windows, obvious strategy promote windows. exception far product called silverlight mac, ports lite version of .net framework os x, http://support.microsoft.com/kb/981760 mono , xamarin.ios/android/mac not microsoft expe

Collect multiple forms data as JSON with Javascript and send via AJAX to PHP -

i not sure if missing point json because have seen; tutorials, examples , questions not involve posting form data via json/ajax php. i see lot of examples using jquery have not learned jquery yet because told getting understanding of javascript first best , use jquery shorthand later. i can 'collect' form data , process , output string believe json syntax. "{p1:{'lname':'adsfer','fname':'asdf','email':'ewrt','sex':'male'},p2:{'lname':'erty','fname':'erty','email':'erty','sex':'male'}}" html <form id="p1"> <h2>add person 1:</h3> surname: <input type='text' name='lname' value='' ><br> first name:<input type='text' name='fname' value='' ><br> email: <input type='email' name='email' value=''><br> s

Using re.findall to create a link grabber in Python -

so going try , create scrapper friend. basically, want take links website. that's it. i know around lines of: links = re.findall() print links i found re.finall on web, not sure how use it! pointers in right direction lot! try beautifulsoup instead. handles crappy html , presents nice interface parsing html. plus, it's easy use. here's scraper (straight from docs ): for link in soup.find_all('a'): print(link.get('href'))

asp.net mvc - how to use mvc4 model value in knockout viewmodel js -

i using knockout asp.net mvc here view populated mvc controller html <html> <input type="text" data-bind="value:name" /> <script src="/scripts/viewmodel.js"></script> </html> controller public actionresult xyz(){ var mymodel = new fiestmodel(); mymodel.name = "james"; return view(mymodel); } viewmodel.js function mymode(){ var self = ; self.name = ko.observable('@model.name'); } after doing of when page render input doesn't have specified value james . update i tell guys whole scenario , in application user click on signup facebook button , facebook return user xyz action method , want show username in xyz view . how can api because @anders said me web api . thanks in advance . you shouldnt mix server side mvc , client side mvvm. move model population webapi controller method. load data using jquery.getjson or other framework ajax can use ko.mapping map

java - Spring Transaction : rollbackfor and norollbackfor both defined -

here problem got in application have maintain: i have first class annotation @transactional(rollbackfor = customexceptiona.class) in following code call method of @transactional(norollbackfor = customexceptionb.class) nb : customexceptiona or customexceptionb have 1 common ancestor wich exception . and of course, when execute code exception raised wich neither of type customexceptiona or customexceptionb nor subclasses them. so question simple : what happens transaction in case ? commit ? rollback ? hold on unfinished state waiting application (which answer might explain ugly things seen in application) ? , : why ? thanks , time. spring framework's transaction infrastructure code will, default, mark transaction rollback in case of runtime, unchecked exceptions; is, when thrown exception instance or subclass of runtimeexception. (errors - default - result in rollback.) checked exceptions thrown transactional method not result in transaction being rolle

Embedded youtube API player copyright issue on android -

new android youtube api allows developer embed , play videos in third party app. made android app shows list of youtube videos , show video in app (not using youtube official app) in case, wonder there no copyright issue @ all. know youtube can play ad on player case looks app providing content directly.

memcached - how to set the expiry time more than 30 days in memcachedClient set() method -

is there way set memcachedclient set(string key,int exp,object obj) method store object more 30 days(2592000 second). if explain please. i believe can set expiry timestamp. according documentation : expiration times can set 0, meaning "never expire", 30 days. time higher 30 days interpreted unix timestamp date. if want expire object on january 1st of next year, how that.

linux - Parsing a variable in shell scripting -

i new shell scripting started off. have written script #!/bin/sh profile_type= cat /www/data/profile.conf echo $profile_type the o/p of script is . /tmp/s_panica1.txt . /tmp/s_panica0.txt away_def="panica1 panica0" away_byp=0 away_sts=$((panica1+panica0-away_byp)) in want panica1 panica0 , 0 , store in other variable how this? when want assign output of command variable, use dollar parenthesis syntax. foo=$(cat /my/file) you can use backticks syntax. foo=`cat /my/file` in script, run command cat , assign result, nothing, variable. hence output consisting of content of file, result of cat , followed empty line, result of echo empty variable.

c# - Do I need to explicitly dispose SqlDataAdapter? -

this question has answer here: why should encapsulate objects in using if there garbage collection [duplicate] 5 answers in this thread , there's suggestion after operation, instance of sqldataadapter disposed of explicitly so. string connstring = @"your connection string here"; string query = "select * table"; sqlconnection conn = new sqlconnection(connstring); sqlcommand cmd = new sqlcommand(query, conn); conn.open(); sqldataadapter da = new sqldataadapter(cmd); da.fill(datatable); conn.close(); da.dispose(); is necessary? gc? it highly recommended dispose idisposable objects manually. there nice syntax shortcut this: using (sqlconnection con = new sqlconnection(connstring)) using (sqlcommand com = new sqlcommand()) using (sqldataadapter da = new sqldataadapter()) { com.connection = con; //etc.. } this way co

javascript - add image src and <a> href in List.js -

i using plugin list.js. working fine. don't know how add image src or href values in it. works fine , other tags. here url list.js. http://listjs.com/ and here documentation. https://github.com/javve/list here code. <script src="http://code.jquery.com/jquery-1.9.0.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <div id="div1"> <input class="search" id="text1" /> <span class="sort" data-sort="name">sort name</span> <span class="sort" data-sort="desc">sort desc</span> <ul class="list"> </ul> </div> <div style="display: none;"> <div id="hacker-item1"> <div style="width: 20%; float: left"

forms - What breaks this code from PHP 5.2 to 5.4 -

<?php $values = ''; foreach($_request $key => $val) { $values .= $key.'='.$val.'&'; } $url = 'https://someurl.com'; $ch = curl_init( $url ); curl_setopt( $ch, curlopt_post, 1); curl_setopt( $ch, curlopt_postfields, $values); curl_setopt( $ch, curlopt_followlocation, 1); curl_setopt( $ch, curlopt_header, 0); curl_setopt( $ch, curlopt_returntransfer, 1); $response = curl_exec( $ch ); echo ($response); ?> something breaking code between php 5.2 , 5.4, i'm not entirely sure what. i've been able verify request variables exist, , values correct after foreach loop. appears issue curl , response not echo. receive no errors, , nothing returned if curl not return response. try curl_setopt($ch, curlopt_ssl_verifypeer, false);

web applications - Attach file from web page directly into an Outlook email -

i have web app generates pdf reports. users can send generated report email addresses within web app. recipient email addresses receive email pdf attachment. however, users have requested ability drag generated pdf report within web app directly outlook email, when drag file windows explorer email. add file email attachment , can send whoever like. possible? if drag , drop not possible there other way @ user can attach file outlook directly webpage?

apache - Combining URLs with & without subdomain prefix -

on root of hosting account sit 2 important folders: httpdocs , subdomains in order silently load page index.htm 4 of domainvariations (below) i'm stuck in bits n pieces other answers don't join make work: team.bravo.org bravo.org www.team.bravo.org www.bravo.org the server folder structure: /httpdocs/ index.htm .htaccess [1] /subdomains/ /team/ .htaccess [2] /www.team/ .htaccess [3] in .htacces [1] siting in httpdocs folder non-www gets nicely redirected www using: rewritecond %{http_host} !^(www\.|$) [nc] rewriterule ^ http://www.%{http_host}%{request_uri} [r=301,l] what needs go the first, second , third '.htaccess'file make domains redirect permanently team.bravo.org , load index.htm ?? thanks! assuming mod_alias available on server (just try first , see if works), put in each .htaccess : redirect permanent / http://team.bravo.org/ otherwise, mod_rewrite solution: rewriterule

ckeditor - Hide toolbar and show colors -

i have problem. i'd show ckeditor without toolbar, , still keep colors on it. code. $(document).ready(function() { var textareaname = 'description'; ckeditor.replace( textareaname, { removeplugins: 'toolbar,elementspath', readonly: true } ) ; var ockeditor = ckeditor.instances[textareaname]; }); the problem text color doesn't show. seems ckeditor disable color well. assuming (because it's still unclear) want keep text color in editor's contents (btw. editor's contents not rendered using textarea - used easier data submitting) solution: config.extraallowedcontent = 'span{!color}'; this allow span elements color style. read more advanced content filter .

android - How to use google map V2 inside fragment? -

i have fragment part of viewpager, , want use google map v2 inside fragment. have tried far, in fragment, private supportmapfragment map; private googlemap mmapview; @override public void onactivitycreated(bundle savedinstancestate) { // todo auto-generated method stub super.onactivitycreated(savedinstancestate); fragmentmanager fm = getchildfragmentmanager(); map = (supportmapfragment) fm.findfragmentbyid(r.id.map); if (map == null) { map = supportmapfragment.newinstance(); fm.begintransaction().replace(r.id.map, map).commit(); } } @override public void onresume() { super.onresume(); if (mmapview == null) { mmapview = map.getmap(); marker hamburg = mmapview.addmarker(new markeroptions().position(hamburg) .title("hamburg")); marker kiel = mmapview.addmarker(new markeroptions()

jsf 2 - How to display a html tag if JSF conditon is true? -

i want display <span>lorem ipsum</span> if backing-bean value not empty. <h:outputtext rendered="#{not empty pubcontroller.location}"> <span>lorem ipsum</span> </h:outputtext> the lorem ipsum never display. apparently, doesn't work if remove not in condition. fyi: before run h:outputtext, print boolean statements. prints expect. true values not empty. also, rendered-condition works h:form tag expect it. looks h:outputtext inappropriate in case, it? is there better approach using h:outputtext want do? this can't work because h:outputtext doesn't accept child elements stated in documentation : if element has children, must ignored default. implementions may provide configuration option allows element render children. trying following code should solve problem: <h:outputtext value="lorem ipsum" rendered="#{not empty pubcontroller.location}"/> note following: &l

pdf - signature is invalid in revision 2 - caused by attachmens -

i've write code attaches files pdf document. i've seen code in pdfbox page. pdembeddedfilesnametreenode eftree = new pdembeddedfilesnametreenode(); pdcomplexfilespecification fs = new pdcomplexfilespecification(); fs.setfile( "test.txt" ); inputstream = ...; pdembeddedfile ef = new pdembeddedfile(doc, ); ef.setsubtype( "test/plain" ); ef.setsize( data.length ); ef.setcreationdate( new gregoriancalendar() ); fs.setembeddedfile( ef ); map efmap = new hashmap(); efmap.put( "my first attachment", fs ); eftree.setnames( efmap ); pddocumentnamedictionary names = new pddocumentnamedictionary( doc.getdocumentcatalog() ); names.setembeddedfiles( eftree ); doc.getdocumentcatalog().setnames( names ); doc.save("attachedpdf"); that, works. then, i've attached files, , sign document. result -everything works! then, signed document (which have attachments ), , sign document with attachment (i create revision 2. in other words, atta

hibernate - Saving master detail entities -

i have small invoicing app have (invoicemaster) , (invoicedetails) entities, facing problem on how save master , details in same time / in other words in 1 transaction... i have following classes in application: - invoicemasterdao - invoicedetailsdao - invoicemasterservice - invoicedetailsservice and thinking shall call invoicemasterdao, invoicedetailsdao save method within invoicemasterservice class? if did there no use invoicedetailsservice class? or shall create invoiceservice class , use to control both invoicemasterdao, invoicedetailsdao in same time? taking in consideration saving invoice me means, saving master, saving details, deducting product balances.....or rollback in case went wront kindly advice it's you, having invoiceservice looks more logical me. services shouldn't designed 1 service per entity. should designed logical group of ... services caller needs (the ui layer, usually). in other words, should use-case oriented, , not entity-

Python create list from CSV -

i trying build python list csv file. csv file has 5 columns shown below separated pipe(|): qtp|install|c:\cone_automation\runtest.vbs|install|sequence qtp|open |c:\cone_automation\runtest.vbs|open |sequence qtp|install|c:\cone_automation\runtest.vbs|install|parallel qtp|install|c:\cone_automation\runtest.vbs|install|parallel qtp|install|c:\cone_automation\runtest.vbs|install|parallel qtp|open |c:\cone_automation\runtest.vbs|open |sequence qtp|install|c:\cone_automation\runtest.vbs|install|sequence qtp|open |c:\cone_automation\runtest.vbs|open |parallel qtp|open |c:\cone_automation\runtest.vbs|open |parallel qtp|open |c:\cone_automation\runtest.vbs|open |parallel above test cases in csv. i want build list based on last column of file. want list as, if first 2 lines having text "sequence" in column[4], should complete line in list seq1 . if line 3rd, 4th , 5th having parallel should complete 3rd, 4th , 5th records in list par1 . then after th

php - How to deploy same functionality, with different data source with symfony2? -

i have software product deploy arbitrary number of times, same functionality, different data sources. able instantiate each automatically, running script. i using symfony2, , thinking using environments. work? there better way this? it definetly possible , there many ways can it. depends how getting data. for instance if using files can user parameters specify location of file. http://symfony.com/doc/current/components/dependency_injection/parameters.html

java - ContextMenu doesn't invoke delete in managedbean -

i'm new in jsf , want use contextmenu of primeface delete method.but delete methode never invoked. here parts of code.i don't know mistake <p:datatable id="datatable" var="bon" widgetvar="bontable" value="#{bonessencebean.allbonessence}" rowkey="#{bon.idbon}" selection="#{bonessencebean.bonessence}" selectionmode="single" sortmode="single" rows="10" paginator="true" paginatortemplate="{currentpagereport} {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}" rowsperpagetemplate="10,15,25"> <f:facet name="header"> <p:outputpanel> <h:outputtext value="search:" style="height:30px"/> <p:inputtext id="globalfilter" onkeyup="bontable.filter()" style=&

actionscript 3 - Microphone capturing doesn't work on dedicated server -

i'm trying stream audio browser via rtmp. use flash api that. , works perfect on localhost. when i'm trying record sound browser on dedicated server it's says me, client (me) haven't allowed capturing ( microphone.muted true ) microphone in browser, did allow after first request , it's still allowed in settings. idea? <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="500" minheight="350" creationcomplete="init()"> <fx:declarations> <!-- place non-visual elements (e.g., services, value objects) here --> </fx:declarations> <fx:script> <![cdata[ import mx.controls.alert; import mx.core.flexglobals;