Posts

Showing posts from February, 2012

iOS - Accessing generated signal from Audio Unit render callback -

i have ios/objective-c program uses single audio unit play generated signal when button pressed. i'd add functionality such that: a) when button first pressed, signal generated in kind of numeric array. b) audio begins, , render callback accesses (and plays) generated signal. given current code, feel these additions few lines, i'm having trouble syntax, variable types use, how track current sample, , on. i've included related code now: the button press: - (ibaction)startpressed:(id)sender { [self setupaudioplayer]; [self createsignal]; [self playaudio]; } a line setupaudioplayer: input.inputprocrefcon=&mysignal; // mysignal instance var the audio creation: -(void)createsignal{ int beeplength=0.020*fs; // fs sampling frequency float beepfrequency=440; // hz // declare kind of numeric array "mysignal", instance var. mysignal=...? // generate audio signal (pure tone) (int i=1; i<=beepl...

javascript - Show xml in TextArea using jQuery -

the following works in firefox , chrome, not in ie - <html> <head> <title>test ie</title> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> </head> <body> <button onclick="ftest2()">test textarea</button> <br /> <textarea rows="4" cols="50" id="log" > textholder . . . </textarea> <script type="text/javascript" > var currentline = 3; var strxml = "<xmlstring id='misssing' >" + currentline + "</xmlstring>"; function ftest2() { $('#log').html(strxml); } </script> </body> </html> found - i had use $('#log').val(strxml); instead of $('#log').html(strxml);

subtraction - Java: Prefix - Postfix issue -

i have small issue performing subtraction on numbers using prefix , postfix operators. program: public class postfixprefix { public static void main (string args[]) { int = 5; int b; b = (a++) - (++a); system.out.println("b = " +b); } } doing this, theoretically supposed 0 answer, however, getting -2. when try individually try increment values in program: public class postfixprefix { public static void main (string args[]) { int = 5; int b, c; b = a++; c = ++a; system.out.println("b = " +b); system.out.println("c = " +c); } } i values b = 5, c = 7. so idea 'c' takes value of 'a' 'b' (please correct me if wrong), want know is how can have not take value of 'a' 'b', and using prefix - postfix, can have 0 answer when they're subtracted. b = a++; means: assign b value of a increase 1 c =...

image - Batch Script creating mutliple text files with incrementing numbers inside -

i'm trying right script creates multiple text files list of image names need each of them have incremented number in contents. far i've come this setlocal enabledelayedexpansion set /a i=0 /f %%f in ( 'dir /b /a-d %1"*.jpg"' ) ( set /a i=i+1 @rem echo %%f !i! ) %%a in (*.jpg) echo caption= / %i% >> %%~na.txt which gives me text files correct names , part of content including total number of files need each file created different first caption= 1 / 64 , second 2 / 64 example. can please me have sore head :) does want? @echo off setlocal enabledelayedexpansion /f "tokens=1 delims= " %%a in ('dir *.jpg^|find "file(s)"') (set numfiles=%%a) set /a i=0 /f %%f in ( 'dir /b /a-d %1"*.jpg"' ) ( set /a i=i+1 & echo caption= !i! / %numfiles% > %%~nf.txt )

r - Generating yearly frequency plot from multi-year data -

i have hourly wind speed data in following format dt,dir,speed 2002/01/01 00:00,***,0.0 2002/01/01 03:00,360,0.89408 2002/01/01 06:00,070,4.91744 2002/01/01 09:00,050,4.4704 2002/01/01 15:00,050,2.2352 2002/01/01 18:00,050,3.12928 2002/01/01 21:00,020,0.89408 which starts data point recorded once in 3 hours data point 3 times in single hour year 2002 2012 below: 2012/12/31 00:00,***,0.0 2012/12/31 00:10,***,0.0 2012/12/31 00:40,***,0.0 2012/12/31 01:10,***,0.0 2012/12/31 01:40,***,0.0 2012/12/31 02:10,***,0.0 2012/12/31 02:40,***,0.0 2012/12/31 03:00,***,0.0 2012/12/31 03:10,310,2.2352 2012/12/31 03:40,060,4.02336 2012/12/31 04:40,060,3.12928 2012/12/31 05:10,070,4.91744 i trying create yearly frequency plots showing speed vs no.of.hours using r. tried use histograms number of points unequal , doesn't represent no.of hours. how can solved? not...

c# - How to show the current user using ASP MVC and EF -

developing asp .net mvc 3 application using c# , sql server 2005. using entity framework code first method. i have interface log on (connection) related base have user table (contain login + password). i want show current user logged. so, created viewmodel class user didn't result. tried in controller : public actionresult logon() { var user = new userviewmodel(); user.nom_user = this.user.identity.name; viewdata["userdetails"] = user; return view(); } and add in master page : <% var user = viewdata["userdetails"] mvcapplication2.viewmodels.userviewmodel; %> hello : <%: user.nom_user %>! when execute, have error : object reference not set instance of object. you said placed code in masterpage. means run every view. but have set viewdata["userdetails"] inside logon action. when navigate other action (such home/index action example) bo...

android - Preserving fragment state -

in app, have following architecture: mainactivity |_ firstfragment | |_ gridfragment | |_ mapfragment | |_ secondfragment | |_ thirdfragment please note that: mainactivity using actionbarsherlock , slidingmenu . slidingmenu switches between fragments ( firstfragment , secondfragment , thirdfragment ). firstfragment creates button action bar switch between grid , map mode. is, switch between subfragments. what want achieve i need fragments need preserve state when switching between them. is, if in firstfragment , select map mode (show mapfragment subfragment), , slide menu choose option , come back, i should see map again . right now, it's resetting each fragment when selecting section slide menu. this isn't surprising, @ moment commiting transactions new firstfragment() when menu options pressed. however, first tried have references each fragment parent. example, mainactivity had 3 fragments members which, when commiting transactions, checked...

X-Content-Security-Policy-Report-Only not working in Firefox 20 -

i have following content security policy defined: x-content-security-policy-report-only: default-src 'self'; report-uri /foo if change x-content-security-policy , policy gets enforced , report sent. however, when set report-only , no policy warnings appear in console , no report sent. i'm aware of bug don't support unsafe-inline , unsafe-eval , rather have use options inline-script eval-script , i'm not using either on page. i don't know if has it, header being sent x-content-security-policy-report-only , firebug translates x-content-security-policy-report-only - changing case. also, when supplying both x-content-security-policy , x-content-security-policy-report-only follows: x-content-security-policy: default-src 'self'; options inline-script; report-uri /csp-report.php x-content-security-policy-report-only: default-src 'self'; report-uri /csp-report.php the console has warn level message: report-only csp policy ignor...

sql - delete records from 2 tables after testing to see if they are duplicates -

editing else's sql server design here: i have been tasked removing duplicate rows database. i have 2 tables: table1 , table2 . table1 has columns t1id, , t1name table2 has columns t2id, data1, data2, data3 tables join on t1id = t2id if several rows have same t1name, data1, data2 , and data3 , need remove 1 of them both tables. i guess t1id in table1 , t2id in table2 primary key corrosponding tables. if can use following approach - 1) want delete both tables, need store t1id (or t2id) 1 temp table can use values deleting second table 2) extracting desired t1id/t2id need group joined table t1name, data1, data2, data3 , select record getting multiple records. 3) exclude 1 t1id duplicate records found delete. so can use commands shown below - create table test_table (select t1id table1, table2 t1name, data1, data2, data3 in (select t1name, data1, data2, data3 (select t1name, data1, data2, data3, count(*) ...

php - How to execute a function every n seconds? -

i'm writing monitor in php that's monitoring uptime of host. every n seconds ask host it's status. make cronjob executes every minute, this: while(1) { check_status(); sleep(60); } what's efficient way this? the better method use cron. cron launch php every minute. if php crash, relaunched. if launch manually php, , crashes, you'll have manually relaunch it. more this, cron, you'll not have care what's happening on machine boot time. final note : php not best tool make sort of things ;) cheers, k.

c++ - compile a simple test with CGAL -

i have installed cgal brew on mac system. i'm exciting try simple , minimal example. ho can compile g++? i want compile sample file with: gcc namefile.cpp -lcgal -i/usr/local/include/cgal and lot of errors... (too many paste here think) as example file i'm using file: examples/arrangement_on_surface_2/sweep_line.cpp #include <cgal/cartesian.h> #include <cgal/mp_float.h> #include <cgal/quotient.h> #include <cgal/arr_segment_traits_2.h> #include <cgal/sweep_line_2_algorithms.h> #include <list> typedef cgal::quotient<cgal::mp_float> nt; typedef cgal::cartesian<nt> kernel; typedef kernel::point_2 point_2; typedef cgal::arr_segment_traits_2<kernel> traits_2; typedef traits_2::curve_2 segment_2; int main() { // construct input segments. segment_2 segments[] = {segment_2 (point_2 (1, 5), poi...

mkmapview - Fluctuation in iPhone Screen when trying to open mapview -

i have app has functionality such when button pressed, alert view pops asking login credentials. when submitted, web called returns latitude , longitude plotted on mapview. in case lat , long not available, user sees alert. till stage goes well. when press cancel button on second alert iphone screen fluctuates. after whenever navigate other page, screen fluctuates. when sent background , brought foreground again, starts working fine. can problem?

reporting services - How to I get cumulative monthly subtotals in SSRS? -

Image
i'm using ssrs create report shows lot of transactions according trade date. i've made group on month , year called 'grpmonthyear' . inside group i've made subgroup on 'tradedate'. the groups , work perfectly. i'm generating monthly subtotals in footer of group 'grpmonthyear'. but want cumulative subtotals. example, if jan'13 totaled $5,000.00 , transactions in feb'13 totaled $7,000.00 monthly subtotal in feb'13 should show me $12,000.00 i tried using runningvalue(fieldname,sum,'grpmonthyear') but doesn't work. am missing out something? you need set scope in runningvalue function 1 outside current group, example table's dataset itself. so like: runningvalue(fieldname,sum,"dataset") here's simple example based on following data: i've created simple report grouped grpmonthyear : the month total sum in current group scope. the cumulative total expression foll...

php - file not including in wordpress header -

i want include file in header file in directory : wp-content/themes/themename/header.php the code used inclusion : include("../../plugins/booking/informationform.php"); while file want include in directory : wp-content/plugins/booking/informationform.php so gives me error : warning: include(../../plugins/booking/informationform.php) [function.include]: failed open stream: no such file or directory in /home/zapptv/domains/tvworkshop.com/public_html/wp-content/themes/tvworkshop/header.php on line 100 warning: include(../../plugins/booking/informationform.php) [function.include]: failed open stream: no such file or directory in /home/zapptv/domains/tvworkshop.com/public_html/wp-content/themes/tvworkshop/header.php on line 100 warning: include() [function.include]: failed opening '../../plugins/booking/informationform.php' inclusion (include_path='.:/usr/local/lib/php') in /home/zapptv/domains/tvworkshop...

Custom map in Google Map? -

on website see use google map, map looks special , different other google maps saw. special-looking map provided google maps or made website themselves? i checked "my maps" on google maps , didn't find related options. a website special-looking google map tiles it's called styled maps. see documentation , examples here: https://developers.google.com/maps/documentation/javascript/styling?hl=en

c++ - Program output is different when executed through Powershell remote session -

i'm developing windows console application, using visual studio 2010, prints progress percentage on screen such last number gets overwritten current number. i'm using carriage return achieve so: std::wcout << "[running: " << std::setw(3) << std::setprecision(3) << percent << "%]" << '\r' ; when execute program through powershell on remote host using pssesion: enter-pssession www.xxx.yyy.zzz -credential <username> [www.xxx.yyy.zzz]: ps c:\> .\test.exe it behaves differently compared when executed locally either in powershell or in cmd.exe. face following 3 problems: 1) console output of program different, in that, instead of overwriting [running xx%] printing in next line so: [running 1%] [running 2%] [running 3%] [running 4%] ... this similar happens when output of program redirected file (lone carriage returns or newlines replaced carriage returns + newline...

python - Regular expression with Lao? -

in python display lao characters in html code (just in "textarea" tag): <font color="red">ພິມຄໍາສັບລາວ ຫຼື ອັງກິດແລ້ວກົດປຸ່ມຄົ້ນຫາ - enter english or lao hit search</font><br /> <center><table id='display' border='0' width='100%'> <tr> <td id='lao2' colspan='3' style='height: 18px; text-align: left'> <span style='color: #660033'><span style='font-size: 12pt'>&nbsp;&nbsp;&nbsp;</span></span>&nbsp;&nbsp; </td> </tr> <tr> <td style='width: 120px'>&nbsp;</td> <td style='width: 192px'> <textarea id='lao' font-name='phetsarath ot' font-size='12' rows='10' cols='84' readonly='readonly'> 1. (loved, loving) 1. ຮັກ 2. ມັກຫຼາຍ 3. love ຢາກໄດ້ຫຼາຍ, ຢາກເຮັດຫຼາຍ ...

memoize to disk - python - persistent memoization -

is there way memoize output of function disk? i have function def gethtmlofurl(url): ... # expensive computation and like: def gethtmlmemoized(url) = memoizetofile(gethtmlofurl, "file.dat") and call gethtmlmemoized(url), expensive computation once each url. python offers elegant way - decorators. basically, decorator function wraps function provide additional functionality without changing function source code. decorator can written this: import json def persist_to_file(file_name): def decorator(original_func): try: cache = json.load(open(file_name, 'r')) except (ioerror, valueerror): cache = {} def new_func(param): if param not in cache: cache[param] = original_func(param) json.dump(cache, open(file_name, 'w')) return cache[param] return new_func return decorator once you've got that, 'decorate...

Can I have same WordPress theme name as an existing one? -

i came name(as thought) wordpress theme want create. unfortunately, found wp theme using same name after googled it. theme free , available on own site. name. can have same wordpress theme name existing one? the short answer yes. there many themes out there similar/identical names sheer amount of themes available, e.g. http://themeforest.net/ has many themes same names created different people. however there drawbacks doing so. example harder differentiate between theme , theirs, if theme successful people searching theme find other theme in search results instead.

Setting Spring bean property value in ApplicationContext without using properties file -

i want change value of bean property in application context without reading properties file. property values set in properties object. properties object passed api while calling api interface. you can through custom applicationcontextinitializer , using propertysource called propertiespropertysource create custom applicationcontextinitializer way: public class propertyregisterappinitializer implements applicationcontextinitializer<configurableapplicationcontext>{ @override public void initialize(configurableapplicationcontext applicationcontext) { mutablepropertysources sources = applicationcontext.getenvironment().getpropertysources(); properties props = new properties(); props.put("testkey", "testval"); sources.addfirst(new propertiespropertysource("propertiessource", props )); } } register applicationcontextinitializer through web.xml file: <context-param> <param-n...

code timing - Strange results from tic / toc in MATLAB -

i'm checking running time of function using tic/toc. write following in command window (and execute simultaneously): tic res = checkfunc('case2736sp',1:3000); toc elapsed time 0.080491 seconds. where checkfunc returns 2736x2500 full matrix. what puzzles me have wait 20 seconds output saying run time 80 ms. does have clue why is? it's possible tic/toc's internal counter getting reset somehow during execution. try this: t = tic res = checkfunc('case2736sp',1:3000); toc(t)

r - Finding slope before and after breakpoint -

Image
i'm using bfast package in r decompose time series. curious if possible extract slope of trend segment before , after breakpoint (until end or breakpoint)? the example below taken reference manual. the code generate here. require(bfast) require(strucchange) require(sandwich) require(forecast) require(raster) require(sp) fit <- bfast(harvest, season="harmonic", max.iter=2) plot(fit, type="trend") the problem result output objects aren't automatic, in other words, can find values between breakpoints , try formulate slope trend values, process time consuming because have manually find start/end breakpoint values , extract every value in between. ideally, want find easier way identify slope of trend (blue line) before , after available breakpoints multiple time series. any appreciated, thanks. plot(fit, anova = true) would give 'slope , significance values each identified trend segment'. interestingly, work when specify: t...

browser - Jquery setInterval stops in separate tab -

i need setinterval function work when browser tab current script not active. can see example here http://jsfiddle.net/4mwqv/ . var balance=100000000; setinterval(function(){balance=balance+1;$('#balance').text(balance)},1); when current tab active script runs fine, when switch window, counting stops. how can make count work in separate tab?

Does the RavenDB compresion bundle provide benefits with many small documents? -

i trying better understand how ravendb uses disk space. my application has many small documents (approximately 140 bytes each). presently, there around 81,000 documents give total data size of around 11mb. however, size of database on 70mb. is of actual space being used indexes? i had read somewhere else there may minimum overhead of around 600 bytes per document. consume around 49mb, more in ballpark of actual use seeing. would using compression bundle provide benefit in scenario (many small documents), or targeted towards helping reduce size of databases large documents? i have done further testing on own , determined, in answer own question, that: indexes not main consumer of disk space in scenario. in case, indexes represent < 25% of disk space used. adding compression bundle database large number of small documents not reduce total amount of disk space used. due minimum data overhead each document requires. compression benefit documents large. ...

javascript - Increasing pagesize on expanding the kendo grid -

i have kendogrid thousands of records. want show grid in shrinked view 5 items in grid on dashboard expand button on grid. when user click on expand button items in grid should increased 20. for expanding grid on dashboard using below code: function expand(widgetname, speed) { var widget = $("#" + widgetname + "widget"); debugger; var gridname = widgetname + "grid"; gridname.data().kendogrid.datasource.page(20); widget.css({ "z-index": 100 }); getwidget(widgetname).expanded = true; var expandedheight = getexpandedheight(widgetname); widget.animate( { top: '5', height: expandedheight }, speed, function () { // animation complete. var grid = $("#" + widgetname + "grid"); if (grid.length > 0) { grid.ani...

c++ - "Declaration of xxx outside of class is not definition" error -

this error: error: declaration of 'datastream::datastream()' outside of class not definition [ fpermissive]| ||=== build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===| this main.cpp file: #include <iostream> #include <iomanip> #include "datastream.h" #include "msgpacket.h" using namespace std; datastream * packet = new datastream(); datastream::datastream(); int main() { int source; int destination; int type; int port; int input; std::string data; cout << "my assignment" << endl;; msgpacket * packet = new msgpacket(source,destination,type,port,data); } this msgpacket.h #ifndef msgpacket_h #define msgpacket_h #include <string> #include "packetaddress.h" using namespace std; class msgpacket : public packetaddress { public: msgpacket(); msgpacket (const msgpacket & rhs); msgpacket(string datain); msgpacket(int source, int destination, int port, int ty...

c++ - Boost Xpressive sregex assignment and capture group issue -

i notice strange behavior in boost xpressive sregex assignments. see code below. first code snippet not work has sregex has object preliminary assignments , being used in main expression later. second code snippet work has no prior sregex assignments (except final main one). please let me know if using boost xpressive api incorrectly. code not work mark_tag value1(1), value2(2), value3(3), value4(4), value5(5), value6(6), value7(7); boost::xpressive::sregex name,multicast,rtsp; name = ( (value1 = (+boost::xpressive::set[_w|_d|'-'|'_'|as_xpr(' ')]) ) >> ',' ); name1 = ( (value2 = icase(as_xpr("mark1:") ) ) >> (value3 = (+boost::xpressive::set[_d|'.']) ) >> ':' >> (value4 = (+boost::xpressive::set[_d]) ) >> optional(as_xpr(",")) ); name2 = ( (value5 = icase(as_xpr("mark2:") ) ) >> (value6 = (+boost::xpressive::set[_d|...

asp.net - How to get CheckBox working with ItemTemplate -

Image
i need checkbox working gridview, displays whether checkbox read database checked or not. sarchive - checkbox field - bit field in database. if dbnull want no tick in checkbox. unfortunately @ moment it's showing either true or false text next checkbox. when edit record has true, check box not checked, though it's true in database. screenshot: not edited screenshot: edited mode code: <itemtemplate> <asp:checkbox id="label7" runat="server" text='<%# eval("sarchive") %>' > </asp:checkbox> </itemtemplate> <edititemtemplate> <asp:checkbox id="cb1" runat="server" text='<%# eval("sarchive") == dbnull.value ? false : convert.toboolean(eval("sarchive"))%>'> </asp:checkbox> </edititemtemplate> any please, thanks. tea. you have set checked property: <asp:checkbox id=...

dll injection - Strange results while trying to inject a dll into a process via windll.kernel32.CreateRemoteThread() of python mode ctypes -

i trying following task: 1. inject dll process; 2. use windll.kernel32.createremotethread() within mode of ctypes of python; and encouting following results: 1. new thread created success; 2. can not grap thread via windbg; 3. call stack (grapped via processexploer) strange: ntkrnlpa.exe!kiunexpectedinterrupt+0x8d ntkrnlpa.exe!psdereferenceprimarytoken+0x362 ntkrnlpa.exe!kideliverapc+0xb3 ntkrnlpa.exe!zwyieldexecution+0x19a4 ntkrnlpa.exe!lsaderegisterlogonprocess+0x29b56 ntkrnlpa.exe!lsaderegisterlogonprocess+0x2ac2b ntkrnlpa.exe!lsaderegisterlogonprocess+0x2b20b ntkrnlpa.exe!psremovecreatethreadnotifyroutine+0x11d ntkrnlpa.exe!kidispatchinterrupt+0x5a2 kernel32.dll!createthread+0x22 the code "gray hat python", , it's this: import sys ctypes import * page_readwrite = 0x04 process_all_access = ( 0x000f0000 | 0x00100000 | 0xfff ) virtual_mem = ( 0x1000 | 0x2000 ) kernel32 = windll.kernel32 pid = sys.arg...

Haskell IO function type mismatch -

what problem following code: nextmatch :: (a -> bool) -> [io a] -> (io a, [io a]) nextmatch f (x:xs) = s <- x if f s (return x, xs) else nextmatch f xs the compile error says: src\main.hs:364:10: couldn't match expected type `(io a, t0)' actual type `io a' in stmt of 'do' block: s <- x in expression: { s <- x; if f s (return x, xs) else nextmatch f xs } in equation `nextmatch': nextmatch f (x : xs) = { s <- x; if f s (return x, xs) else nextmatch f xs } i want function searches list match , returns matched element plus remaining list, tuple. i still quite new haskell, problem might quite simple... thanks! chris as x if of type io a , no need re-return it, contrary tuple need injected monad. if f s return $ (x, xs) but, not issue, io monad , signature doesn't reflect it, return type (io a, [io a]) should io (io a, [io a]) ...

shell - mklink permission on windows 8 -

i need create symbolic links via mklink user, not administrator. have set via secpol.msc , security settings → local policies → user rights assignment rule create symbolic links user, logged in. after have restarted laptop , tried create symlink. i still error: not have sufficient privilege perform operation. the strange thing when create junction ( mklink /d /j ...) works fine. other mklink operations not. so question simple, how can need set permissions in windows 8 mklink work under user, not administrator? thank help. user account control requires elevation commands can link accross smb boundaries. junction not require elevation cannot link accross. the way around springs mind disabling uac or runas admin. not recommend this.

java - How to declare chess pieces in a chess game? -

im coding chess game actually. made chessboard cases , can coordinates. my question : how can make (by example) pawn class attributes ( color etc..) game. thanks everyone! my code : package coordboutons; import java.awt.color; import java.awt.container; import java.awt.dimension; import java.awt.eventqueue; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import javax.swing.jframe; import javax.swing.jpanel; public class coordboutons extends jframe { coordboutons() { super("gridlayout"); setdefaultcloseoperation(exit_on_close); container contenant = getcontentpane(); contenant.setlayout(new gridlayout(8, 8)); (int = 0; < 8; i++) { (int j = 0; j < 8; j++) { contenant.add(new caseechiquier(i, j)); } } pack(); setvisible(true); } class caseechiquier extends jpanel { private int lin, col; private char...

C# 2D array with string keys and int values -

i'm trying create data structure looks following: xls | doc | ppt | pdf |--------------------- app/xls | 1 | 0 | 0 | 0 app/msword | 1 | 1 | 0 | 0 app/ppt | 0 | 0 | 1 | 0 app/pdf | 0 | 0 | 0 | 1 basically have list of lists in have information like: [ext, xls], [mime, app/xls] [ext, ppt], [mime, app/ppt] [ext, doc], [mime, app/msword] [ext, xls], [mime, app/msword] note extension doesn't match appropriate mime value. reason wanting output table able see graphically distribution of extensions not mapped correct mime. so can loop through list of lists , access each document both ext , mime, can't head around how extract/store hence output information in tabular form. have dictionary of correct ext-mime, important ensuring diagonal line top-left of table bottom-right, place should have non-zero values if data correct (because order of column-row matters in case). so go here?! if understand q...

Java XStream Deep Copy raises Exception ObjectAccessException -

i have xstream cloning. here simple code, have not expertise it. com.thoughtworks.xstream.xstream xstream = new com.thoughtworks.xstream.xstream(); later store clone instances in hashtable (i know not idea storing on legacy system). i store class of student, later store (clone) other instance of student , raises. com.thoughtworks.xstream.converters.reflection.objectaccessexception: not call com.model.student_$$_javassist_83.writereplace():null java.lang.nullpointerexception here code storing clone objects. public void keep(string key, object value) { object obj = xstream.fromxml(xstream.toxml(value)); storage.put(key,obj); } i think here source code problem arising. [xstream sources.][snippet] public object callwritereplace(object object) { method writereplacemethod = getmethod(object.getclass(), "writereplace", null, true); if (writereplacemethod != null) { try { ...

Inserting a new value into an already created file - perl -

i have file created has data in columns 0, 1 , 2. have new variable called $percentage has 11 values associated wish add column 3 of file. how do without appending bottom of file? currently data looks like, formatted next existing data: title name number title name number title name number title name number $percentage value 1 $percentage value 2 $percentage value 3 $percentage value 4 etc use tie::file ; #! /usr/bin/env perl use common::sense; use tie::file; tie @f, 'tie::file', 'foo' or die $!; $n; (@f) { $_ .= ' $percentage value ' . $n++; } untie @f; example: $ cat foo title name number title name number title name number title name number $ perl tie-ex $ cat foo title name number $percentage value 0 title name number $percentage value 1 title name number $percentage value 2 title name number $percentage value 3

html - Creating a Responsive input field between other elements -

having trouble getting search input act responsively in header. in codepen have basic header, logo left, search bar in middle , navigation buttons on right. goal search / input bar in middle responsive , stretch fill space between logo , navigation buttons left/right margin. in attempts haven't been able replicate basic reponsiveness of input @ bottom set 100%. * how approach problem? * http://codepen.io/leongaban/pen/wipav my input: <div class="navigation"> <div class="head-search"> input should responsive <input class="txtinput" type="text"/> <img src="http://leongaban.com/_stack/images/search_button.png" alt="search"/> </div> <nav id="user-actions"> <ul> <li class="btn-blue user-action" data-btn="login" data-pane="login">log in</li> <li class="btn-purple user-action"...

google chrome - Why does a span of 'display: none' prevent deletion of a preceding, 'contententeditable = false' span? -

this behaviour specific chrome (at time of writing version 26.0.1410.64 m know it's been happening while). take following html: <div contenteditable="true"> <div contenteditable="false"> <div contenteditable="true"><div><span contenteditable="false">[interruption]</span><span style="display: none;"></span></div></div> </div> in resulting contenteditable div, put caret after 'interruption' span. try use backspace delete it. you'll find impossible. here jsfiddle illustrating this. note typing text after 'interruption' span fixes issue, in can left-arrow span finishes , backspace usual. remove text, issue recurs. it of particular concern me because span of display: none integral part of rangy , range , selection library using. finding using rangy prevent spans being deleted , seems root cause.

string - Notepad++ Search Multiple and Replace Respectively -

doing string manipulation , want ask if below possible in notepad++: i have string years: 10-jan-13 22-feb-14 10-jan-13 10-mar-13 i want 10-jan-13 22-feb-14 10-jan-13 10-mar-13 (there's more data on each line there showing simplified example). i know can or search | character find, jan|feb|mar... how replace according what's found. (just trying save time) thanks. not sure if it's plugin or built-in, can use textfx characters plugin, select text, , in textfx characters dropdown, click upper case. update looks plugin: textfx menu missing in notepad++ multiple files i found site gives way convert text uppercase regular expressions: http://vim.wikia.com/wiki/changing_case_with_regular_expressions so, can bring find in files dialog (ctrl+shift+f), change search mode regular expression, , use this: find: (\d{2}-\w{3}-\d{2}) replace with: \u\1 directory: whichever directory files in (and files want changed). \u uppercase flag, , br...

javascript - How to convert non-Latin numerals to their Latin counterparts -

i have system in different language implemented in unicode. condition system must accept unicode characters (for digits) , process them accordingly. possible convert unicode characters(that represents numbers) sensible english numbers equivalent? how can implement in javascript? edit: searched web , found chart in unicode.org . there codes corresponding literals want there. now, how read code input unicode string ? the unicode database contains in column 6-8 information digit values, decimal digit values , number values (like u+216e: roman numeral 5 hundred has number value of 500). to use in javascript, might parse file other language , dump information need json or similar, , value in json javascript. documentation of unicode database file format either dump unicode codepoints json "\u20ac" u+20ac , can compare characters, or can use somestring.charcodeat(someposition).tostring(16) convert character hex string (like 20ac ) compare there.

stdvector - Bounds checking of std::vector (and other containers) in clang? -

in clang, there way enable bounds checking [] access std::vectors , other stl containers, preferably when building in debug mode only? i spent hours hunting down subtle bug turned out caused accessing past end of std::vector. doesn't need clever when detects error, trap in debugger can find out happened , fix in code. is there way other "create own type inherits std::vector", i'd avoid? (i'm using clang version 3.1 if makes difference.) if you're using linux or os x should address sanitizer: http://clang.llvm.org/docs/addresssanitizer.html it introduces 2x slowdown, bunch of memory checking , may catch bug. another amazing tool has saved me countless times valgrind. if can run valgrind catch ton of memory bugs , leaks.

animation - jQuery Count Numbers Up -

i'm not @ javascript, i'd love have nice little animation counts number upwards. i've found this on github, it's way slow. (i'm counting number 10 decimals). got tips on how modify it, counts quicker? (i've tried decrease data-interval, sort of stagnates @ "0". <p class="counter" data-interval="0" data-format="999999" data-stop="193847"></p> i found perfect solution: https://github.com/mhuggins/jquery-countto

gem - Ruby require not finding all files -

i've done research , nothing quite hits on issue... i'm building gem have directory structure this root/ - lib/ - mygem/ - cli.rb - version.rb - xmltemplates.rb - mygem.rb - bin/ it's thor app in cli.rb have: require 'thor' require 'mygem/version' require 'mygem/xmltemplates' module mygem #stuff end and in vesrion.rb : module mygem version = '0.1.0' end and in xmltemplates.rb : module mygem my_template = 'test' end i getting errors when trying compile gem decided play in irb. so test did cd lib make myself local lib directory. 1.9.3-p392 :001 > require 'rubygems' => false 1.9.3-p392 :003 > require 'mygem' => true 1.9.3-p392 :005 > require 'mygem/cli' loaderror: cannot load such file -- mygem/xmltemplates /users/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/cust...

google mirror api - Access to built-in icons for Menu Items? -

i know can use iconurl customize icon custom menu items there way access built-in icons such checkbox see during confirmation reply ? no. there's no way override part of interface, potentially added api. you may want file enhancement request in glass api issue tracker . if do, please include intended use case.

clearcase - Confused on checking out in Git -

i have trouble understanding checkout process of git . via cli do: git log , history. 1) how know file/version 1 want check out? see hashes/author/comments/dates. not filename. 2) if git checkout -commitid- go previous version. same doing check-out in clearcase? 3) return latest changes do: git checkout master . returns latest version checkout latest element? i think confusing terminologies used other version control systems. git checkout command used switch branch working on. git checkout master switch working on master branch. git checkout test cause work in branch named test. try answer questions: i don't understand question, think stems misunderstanding of checkout command. every version of file in git separate hash, git log show commits, can see each version of file there. to change branch previous state use git reset command. git checkout -commitid- detach head pointer , leave no branch checked out. can used see state @ time of commit git ch...

c# - Transfering information between forms -

i've been working on project hour , got stuck. i've got 4 forms last 3 relevant. in form 2 use: this.visible = false; form3 form3 = new form3(); form3.show(); to create , show form 3. form3 got textbox empty , want transfer info label in form4. in form 3 use same cod in form 2 make form 3. i've tried couple of things , searched on forums nothing seems work... lbln2.text = form3.txtf.text; i want transfer text user writes in textbox(txtf) in form3 empty label(lbln2) in form4. help appreciated! try (code in form3 class): form4 frm4 = new form4(); frm4.lbln2.text = this.txtf.text; frm4.show(); alternative modify constructor method in form4 accept string parameter , invoke follows: form4 frm4 = new form4(this.txtf.text); frm4.show();

java - How to Merge Two Dates in EJB JPA -

i try merge 2 dates, current date , date in ejb of jpa it's class userbean in class prepare 1 method setexpiredate. method use merge 2 dates 1 currentdate{ new date() } , date { new date(1,6,0) } @stateless(mappedname = "cms/userbean") public class userbean implements userbeanlocal { @persistencecontext(name = "cms-ejbpu") entitymanager em; @override public boolean setexpiredate(int userid,int planid) { try { entitybean.user usr = em.find(entitybean.user.class, userid); int day = 20; int month = 6; int year = 0; date expr = new date() + new date(year, month, day); usr.setexpiredate(expr); return true; } catch(exception ex) { system.out.println("error occure, while setting expiredate"); return false; } } you should consider using joda-time handle dates...

backbone.js - In Backbone views, which is better: this.$el.find('.selector') or this.$('.selector')? -

both of these work, , ff console shows selecting same element, there advantage of using 1 on other? from fine manual : $ (jquery) view.$(selector) [...] it's equivalent running: view.$el.find(selector) so this.$(selector) short hand this.$el.find('.selector') . use whichever 1 prefer, there's no functional difference between them.

iphone - Does iOS Address Book store the time/date that a contact was added? -

i'm building ios app lists contacts in device , displays them added. contact app (or addressbook api) store date contact added? if not, there way can list contacts added? you're looking kabpersoncreationdateproperty documented here .

django model returning multiple values -

i have convert of code django php here sample code: def loadproduct(id=0) if id==0: product=baseproduct.products.all()[0]; else: product = baseproduct.objects.get(id=id); color = product.color images = color.images.all(); return {'product':product, 'color':{'color':color, 'images':images}} now have basic knowledge of django.. not able understand return type in this... can 1 me on this... the method returning dictionary, equivalent associative array in php.

php - Ajax responseText doesn't contain all of the output -

i started learning basic ajax. not using jquery ajax yet. having problem couldn't resolve after lots of searrching. my php file is- $sql = "select * posts"; $result = mysqli_query($con,$sql) or die ('error: ' . mysqli_error($con)); while($feeditem = mysqli_fetch_array($result)) { echo $feeditem['user']." "; } echo "dd"; and file i'm calling has js script- xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { alert(xmlhttp.responsetext); } } xmlhttp.open("get","loader.php", true); xmlhttp.send(); now, if run php file alone, prints--- user1 user2 user3 dd but if run other file, alert contains "dd". doesn't alert me user1 user2... why doesn't inside loop included in responsetext? your code works me, i've tested it. use console see raw response coming serve...

java - SecurityException with Bouncy Castle -

this question has answer here: bouncycastle + jboss as7: jce cannot authenticate provider bc 4 answers i on mac os , getting issue after performing software update on mac. caused by: java.lang.securityexception: jce cannot authenticate provider bc @ javax.crypto.sunjce_b.a(dashoa13*..) @ javax.crypto.secretkeyfactory.getinstance(dashoa13*..) @ org.jasypt.encryption.pbe.standardpbebyteencryptor.initialize(standardpbebyteencryptor.java:667) ... 95 more caused by: java.util.jar.jarexception: cannot parse jar:file:/users/himajumdar/work/jboss/jboss-5.1.0.ga/server/default/tmp/a00c-b5p2h4-hgi84jo1-1-hgi84qe5-w/csa.ear!/lib/bcprov-jdk15-140.jar @ javax.crypto.sunjce_c.a(dashoa13*..) @ javax.crypto.sunjce_b.b(dashoa13*..) @ javax.crypto.sunjce_b.a(dashoa13*..) ... 98 more i tried these suggestions added security.provider.11=org.bouncy...

elisp - Is there emacs capability for visiting last edits? -

in jetbrains products, there's handy key binding lets visit spots made edit. hit key once go last edit (file , location), , keep hitting key go earlier edits. it's typically when editing want editing same places on , on again, , if 1 has many buffers open, many of not edited, more useful. emacs has mark ring, that's not quite same thing. on related note, there functionality in magit, emacs git add-on, jump edits? there gotolastchange allows travel along chain of undo locations. can assign key: (global-set-key "\c-x\c-\\" 'goto-last-change)

ruby on rails - Paper clip - stored image path inside active admin -

all files uploaded paper clip beeing stored inside public/system/images/pictures/ , lots of 000/000/002 folders , etc. i want use image_tag inside 1 active admin's view print images related 1 gallery. can image object, , of course image name, how figure out right stored path? just call url on image object, this: <% @gallery.images.each |image| %> <%= image_tag image.url %> <% end %>

angularjs - Mocking collaborators in Angular controller and service Jasmine tests -

i have been writing jasmine unit tests in angular. in first example i'm testing controller. myapp.controller('myctrl', function($scope, config){ ... }); i have configuration service (config) keeps configuration database , injected controller. unit test, want mock out configuration service altogether, rather allowing execution pass through , using $httpbackend. examples found taught me $controller function can use this, in order instance of controller mocks injected in place of usual collaborator: beforeeach(inject(function($controller, $rootscope){ var scope = $rootscope.$new(); var configmock = { theonlypropertymycontrollerneeds: 'value' }; ctrl = $controller('myctrl', { $scope:scope, config: configmock }); })); but have other services use config service. unit test them, assumed there similar $service function use instantiate service whatever mocks want provide. there isn't. tried $injector.g...