Posts

Showing posts from June, 2011

iPhone - Adding a button to keyboard existing accessory view (keyboard from UIWebView) -

Image
i'm searching way add button accessory view of keyboard, 1 comes when touching input field uiwebview , without using private functions or questionable tricks. do know how may ? note : know how may catch keyboard show/hide events. i'm asking how add button. you can using uikeyboardwillshownotification uiwindow reference information : [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow:) name:uikeyboardwillshownotification object:nil]; this notification raised when textfield even from uiwebview selected. look @ apple keyboardaccessory sample code shows how this. sample code use uitextxxxx inputaccessoryview property, doubt able use. notification give enough information add accessory directly in view or on top uiwindow, , animating keyboard : (gdb) po notification nsconcretenotification 0xb5a2190 {name = uikeyboardwillshownotification; userinfo = { uikeyboardanimationcurveuserinfokey = 0; uikeyboar...

iphone - Dynamically added subviews in a UIScrollView not appearing -

i'm having lot of trouble dynamically adding subviews uiscrollview. scroll view works fine content created in nib since subviews displayed depend on data in application (a mixture of images, labels, radio buttons, etc.) need able create , display them dynamically. according i've read seems pretty straightforward on various sites , in apple documentation. in view controller's viewdidload, i've added following code, uilabel *testlabel = [[uilabel alloc] init]; [testlabel setframe:cgrectmake(50, 50, 100, 40)]; [testlabel settext:@"my test label"]; [scrollview addsubview:testlabel]; [testlabel release]; the label not appear in scroll view @ if add testlabel self.view, appears (but not in scrolling content obviously). tried adding code viewdidappear in case misunderstood order of events no luck. when checked debugger, noticed address of scroll view 0x0 assume means null reason explain why not working. under assumption if connected scrollview pointer ac...

java - Dealing with exceptions examples -

may point me opensource project or book or site or tips whatsoever "good practices" in dealing exception - e.g. retrying offending code or other accepted strategy. exception antipatterns 10 best practices

multithreading - c++ thread for quadcore -

can tell me how can set thread run of core of cpu? make thread with: createthread(0, 0, thread, (lpvoid)1, 0, 0); run @ 25% speed of cpu, because takes 1 core calculates. how can set use 4 full speed? a thread run on single core @ 1 time, though may switched between cores os. have application take advantage of more 1 core need more 1 thread. you can use createthread start these threads, or wrapper around such boost::thread , or new c++11 std::thread . if have 4 threads (including first one) app can run on 4 cores @ once. however, adding threads application not lightly. multithreading complex topic, , can hard right. there many more difficulties may encounter , sources of bugs in multithreaded applications in single-threaded ones. consequently, there many articles , books (including mine ) on topic of multithreaded programming. take slow, read extensively multithreaded programming, , @ whether best approach application, , how best make use of cores.

makefile - android-ndk Adding static libraries to the android.mk -

i have 3 static libraries framework want use in project. these libraries called libtinysak_armv7-a.a, libtinynet_armv7-a.a , libtinyhttp_armv7-a.a . have placed them in same folder android.mk and application.mk . my native code dependent on them want include them in shared library. from i've read on stackoverflow , google'd believe android.mk supposed this: # tinysak include $(clear_vars) local_module := tinysak local_src_files := libtinysak_armv7-a.a local_export_c_includes := $(local_path)/../../../doubango/tinysak/src/ include $(prebuilt_static_library) # tinynet include $(clear_vars) local_module := tinynet local_src_files := libtinynet_armv7-a.a local_export_c_includes := $(local_path)/../../../doubango/tinynet/src/ include $(prebuilt_static_library) # tinyhttp include $(clear_vars) local_module := tinyhttp local_src_files := libtinyhttp_armv7-a.a local_export_c_includes := $(local_path)/../../../doubango/tinyhttp/include/ include $(prebuilt_st...

objective c - run install script when installing preference pane -

i've written ruby script looking @ wrapping in preference pane purpose of configuring ruby script. hoping there way me run arbitrary commands when preference pane gets installed in order install necessary ruby gems etc, can't seem find documentation on sort of functionality anywhere. any ideas appreciated. cheers nick you call ruby script performs necessary configurations you. if need install gems, you'll need run elevated privileges. how i've done in past: // path helper script main app bundle nsbundle *appbundle = [nsbundle mainbundle]; nsstring *scriptpath = [appbundle pathforresource: @"helperscript" oftype: @"rb"]; // construct applescript command run helper script elevated privileges nsstring *scriptcommand = [nsstring stringwithformat: @"do shell script \"ruby '%@'\" administrator privileges", scriptpath]; // execute helper script via applescript, lo...

asp.net - Response.Redirect, keep tabcontainer on active tab -

my vb.net tabcontainer needs stay on active tab when have each submit going through response.redirect. how can achieve this? need response.redirect there because show has been added in main tab container. <asp:tabcontainer runat="server" activetabindex="0" height="200px" width="175px" scrollbars="auto" enabletheming="true" font- underline="false" id="tabcontainer2" enableviewstate="false" style="float:right; padding-left: 110px; margin-bottom: 340px;" onactivetabchanged="tabcontainer1_activetabchanged"> protected sub tabcontainer1_activetabchanged(byval sender object, byval e eventargs) viewstate("activetabidx") = tabcontainer1.activetabindex end sub protected sub submitcompanies_click(byval sender object, byval e system.eventargs) handles submitcompanies.click *****there more code here question, it's not necessary has been omitted*****...

Error 3021, no current record has been found, Query data from Access to Excel -

i'm writing function in excel vba called extract data access database, i'm using ado connection. function get_g_gtop has parameters defined bellow. now, try use command object value recordset, however, got error message 3021 : either bof or eof true, or current record has been deleted. requested operations requires current record. debug points line : get_g_gtop = rst.fields(0).value. is there wrong sql statement query in access? advice highly appreciate! bing function get_g_gtop(byval vehtype string, byval speed single) variant dim dbfilepath string dbfilepath = "c:\users\sevenice\desktop\em database.accdb" set cnn = new adodb.connection cnn.open "provider= microsoft.ace.oledb.12.0;" & " data source=" & dbfilepath & ";" & "persist security info =false;" 'set rst = new adodb.recordset set cmd = new adodb.command cmd.activeconnection = cnn 'dim querystr string dim s single if strcomp(ve...

iphone - Proper iOS Background Location Updates -

location updates using apples cllocationmanager have been working fine while application running. decided implement monitorsignificantlocationchanges method described in apple documentation. here applicationdidenterbackground method: - (void)applicationdidenterbackground:(uiapplication *)application { // switch significant location change events monitoring [self.viewcontroller.locationcontroller.locationmanager stopupdatinglocation]; [self.viewcontroller.locationcontroller.locationmanager startmonitoringsignificantlocationchanges]; the problem having no matter whether startmonitoringsignificantlocationchanges or not, application still reports ios utilizing location updates when application has been removed multitasking bar. installing app without ever running enough make ios display location icon in top right of screen , phone starts drain battery. cannot figure out how stop location updates when home button pressed , how start significant change monitoring service. ple...

Ruby on Rails: How to customize validation error message? -

i have following code: validates :name, :presence => true error message produced "name can't blank" instead of using actual attribute name (in case "name") want display message "registration name can't blank". how overwrite default message on validations? tried appending :message didn't work... thanks! in en.yml file define custom keys as: activerecord: attributes: model_name: attribute_name1: key1 attribute_name2: key2 ...... this key used automatically when errors generated. reference: http://edgeguides.rubyonrails.org/i18n.html#translations-for-active-record-models (5.1 translations active record models)

Java HTTP receiver -

i trying make java program, servlet act receiver uploaded file, user used rnif 1.1 transport protocol uploading file. user call url. idea on how make using java? have made 1 , it's successful using java program upload file. however, using transport protocol above user isn't uploading successfully. your ideas appreciated. thanks.

c# - Mono / Ubuntu - Conflicting definitions -

i'm attempting build library (medsphere.widgets) on ubuntu, , it's throwing me error. i've had search around, nobody seems have answer it. configure script works fine, , completes no warnings or errors. when go run make, this: polynomial@ubuntu:~/projects/medsphere/$ make making in src make[1]: entering directory `/home/polynomial/projects/medsphere/src' /usr/bin/mcs /target:library /out:medsphere.widgets.dll -r:/usr/lib/pkgconfig/../../lib/cli/pango-sharp-2.0/pango-sharp.dll -r:/usr/lib/pkgconfig/../../lib/cli/atk-sharp-2.0/atk-sharp.dll -r:/usr/lib/pkgconfig/../../lib/cli/gdk-sharp-2.0/gdk-sharp.dll -r:/usr/lib/pkgconfig/../../lib/cli/gtk-sharp-2.0/gtk-sharp.dll -r:/usr/lib/pkgconfig/../../lib/cli/glib-sharp-2.0/glib-sharp.dll -r:/usr/lib/mono/2.0/mono.cairo.dll ./cpaned.cs ./fbox.cs ./gridview.cs ./cairohelper.cs ./iconlayout.cs ./icairocellrenderer.cs ./boxcellrenderer.cs ./pixbufcellrenderer.cs ./textcellrenderer.cs ./graph/axislocation.cs ./graph/axissi...

binary - PHP - read 8 bit integers -

i have binary file 8 bit integers. have tried use php unpack() functions cant of arguments work 1 byte integers. have tried combine data dummy byte can use 'n'/'v' arguments. working windows machine this. function return array of integers based on string of 8 bit binary integers. code have tried below - $dat_handle = "intergers.dat"; $dat_file = fopen($dat_handle, "rb"); $dat_data = fread($dat_file, 1); $dummy = decbin(0); $combined = $dummy.$dat_data; $result = unpack("n", $combined); what looking char datatype. there 2 version of this, signed (lowercase c ) , unsigned (uppercase c ). use 1 that's correct data. <?php $byte = unpack('c', $byte); ?> also, if data file bunch of bytes , nothing else, , know it's length, can this. (if length 16 signed chars in row.) <?php $bytes = unpack('c16', $byte); ?> if don't know how many bytes in file, know there going bytes can ...

objective c - Audio controls in lock screen iPhone, iPad -

Image
i use avfoundation play audio. when lock device playing music, , press home button twice, can see audio controls: forward, rewind, pause/play , volume slider how use them? when press don't anything. onlu volume slider works good.

Are there options with Json.NET that can have it deserialize inconsistent json types into objects? -

an example consuming json api. api not consistent in how returns json. have author , has property of books[]. api unfortunately choosing return author.books (of type book) in cases when there 1 book. prefered method return 1 book inside author.books[]. json.net understandably throws serialization exception when try have deserialize chunk of json , finds "author":{"book":{... mixed in "author":{"book":["... is there way around this? does answer question? deserializing json when array , object

.net - CInt does not round Double value consistently - how can I remove the fractional part? -

i've stumbled upon issue cint , converting double integer. the issue following: cint(10.5) 'result 10 cint(10.51) 'result 11, expected 10... i got used c# style conversion (int) 10.51 10. as pointed out in question integer.parse vs cint , result rounded in fashion. however, need integer part , throw away fractional one. how can achieve such type of conversion in vb.net? after research see can use fix() function trick, best choice? you may use int or fix functions return value type of these functions double have convert integer if option strict on . no = convert.toint32(int(10.51))

out of memory - out of mempry for large number of tests. using maven and sonar -

i using sonar 2.6 , on running command: mvn site cobertura:cobertura i getting following error... tests run: 1397, failures: 10, errors: 117, skipped: 0 flushing results... flushing results done exception in thread "thread-0" java.lang.outofmemoryerror: java heap space @ java.io.objectstreamclass.invokereadobject(objectstreamclass.java:974 ) @ java.io.objectinputstream.readserialdata(objectinputstream.java:1849) @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1 753) @ java.io.objectinputstream.readobject0(objectinputstream.java:1329) @ java.io.objectinputstream.readobject(objectinputstream.java:351) @ java.util.arraylist.readobject(arraylist.java:593) @ sun.reflect.generatedmethodaccessor33.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodacces sorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ java.io.objectstreamclass.invokereadobject(objec...

c# - Which Micro ORM to use? -

trying decide between dapper , massive , petapoco . simplicity of dapper, flexibility of massive , poco support in petapoco procrastinating 1 choose next project. i realise that, large extent, it's matter of personal taste, believe valuable hear opinions on subject, people tried more 1 of these, err, libraries (what is right term: library, file, framework?) try decide of features mention -- simplicity, flexibility, poco support -- useful , project(s) one year now. make work easier? then you'll have answer. , if still can't choose, pick dapper (just random selection made :-) cheshire cat says, if don't know want go, doesn't matter road choose.

shared ptr - C++ destruction list -

i have class computation using callbacks. callbacks need allocate data (dynamic arrays) needs live outside of callback scope not after class destructs. thought make vector of auto_ptr destructed automatically when class destructs: class myclass { vector<auto_ptr<myobject>> thingstodie; }; the problem have lot of objects allocated , don't share base type can't use 1 vector this, , making vector every type lot of work. hierarchy following: auto_ptr_base (virtual destructor) | auto_ptr<t> will solve problem because like class myclass { vector<auto_ptr_base> thingstodie; }; and destruction virtually dispatched each specialized type automatically. problem stl doesn't have hierarchy , don't want re-implement auto_ptr. there other solution this? you use vector<shared_ptr<void>> . read this: why std::shared_ptr<void> work

r - ggplot2 geom_line() should point at specified value -

Image
i have written following code: library(ggplot2) data <- structure(list(x = c(1l, 6l, 3l, 4l, 2l, 3l, 6l, 1l, 5l, 2l, 1l, 5l), y = c(1l, 7l, 5l, 6l, 3l, 4l, 6l, 2l, 5l, 6l, 5l, 2l ), year = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l), .label = c("2010", "2011"), class = "factor"), matching = structure(c(1l, 2l, 3l, 4l, 5l, 6l, 1l, 2l, 3l, 4l, 5l, 6l), .label = c("person1", "person2", "person3", "person4", "person5", "person6"), class = "factor")), .names = c("x", "y", "year", "matching"), row.names = c(na, -12l), class = "data.frame") data$year <- factor(data$year) colors <- c("#4cb5ee", "#a0d099", "red") p <- ggplot(data, aes(x=x, y=y)) + ...

objective c - Object added to Array is immediately 'out of scope' -

i'm new objective c , use assistance. i have created class called agent. agent class contains following method: + (agent *)agentwithname:(nsstring*)thename { agent *agent = [[[agent alloc] init] autorelease]; agent.agentname = thename; return agent; } then root view controller want loop through dictionary of names creating agent object each name , adding agent object nsmutablearray: (id object in dictarray) { nsstring *agentname = [object objectforkey:@"name"]; [self.myagents addobject:[agent agentwithname:agentname]]; } the trouble execution has passed [self.myagents addobject:[agent agentwithname:agentname]]; , agent objects inside of nsmutablearray self.myagents listed debugger 'out of scope'. causes exc_bad_access later in code when try access objects in array. objects getting added array (at least they're showing in xcode debugger) they're out of scope, they're out of scop...

gen server - Erlang gen_server cast bad return value -

i try cast message gen_server: gen_server:cast({global, id}, {watchers}). the handler is: handle_cast({watchers}, state) -> case state#table_state.watchers of [] -> {reply, no_watchers, state}; _ -> {reply, state#table_state.watchers, state} end; but when execute gen_server:cast gen_server terminates error: =error report==== 29-apr-2011::18:26:07 === ** generic server 1 terminating ** last message in {'$gen_cast',{watchers}} ** when server state == {table_state,1,"1",11,[]} ** reason termination == ** {bad_return_value,{reply, no_watchers, {table_state,3,"3",11,[]}}} why bad_return_value ? you cannot reply using cast (see gen_server documentation ). whole point of casting asynchronous message instead of using call. in case want return reply, use gen_server:call/2 instead.

c++ - How to use the (the Boost Multidimensional Array Library) to construct a dynamic two-dimensional array? -

i need in using boost multidimensional array. have construct 2 dimensional array where: (0 <= j <= 1) , (i) grows dynamically according to: long boostarray[i][j]; thus, it's constructing table of (unknown) columns , 2 rows. i started example provided @ boost library website: #include "boost/multi_array.hpp" #include <cassert> int main () { // 3 x 4 x 2 typedef boost::multi_array<double, 3> array_type; typedef array_type::index index; array_type a(boost::extents[3][4][2]); int values = 0; for(index = 0; != 3; ++i) for(index j = 0; j != 4; ++j) for(index k = 0; k != 2; ++k) a[i][j][k] = values++; int verify = 0; for(index = 0; != 3; ++i) for(index j = 0; j != 4; ++j) for(index k = 0; k != 2; ++k) assert(a[i][j][k] == verify++); return 0; } the problem didn't thoroughly understand above code in order tweak on structure , build desired array. don't know precisely how add/dele...

sql - Access 2010 Query using IIF and ISERROR -

i trying accomplish following in access 2010 query select unit, date, sum(iif(iserror(a),null,a)) dlp_percentage tablea; where a = (act-base)/base i generic overflow error. missing obvious. trying catch error in calculation , return null if error exists or result if no error. have in query. ideas have overlooked? sum((act-base)/iif(base=0, null, base)) dlp_percentage

javascript - How to place a jQuery snippet into a global file -

i have javascript file here http://www.problemio.com/js/problemio.js , trying place jquery code looks this: $(document).ready(function() { queue = new object; queue.login = false; var $dialog = $('#loginpopup') .dialog({ autoopen: false, title: 'login dialog' }); var $problemid = $('#theproblemid', '#loginpopup'); $("#newprofile").click(function () { $("#login_div").hide(); $("#newprofileform").show(); }); // called right away after clicks on vote link $('.vote_up').click(function() { var problem_id = $(this).attr("data-problem_id"); queue.voteup = $(this).attr('problem_id'); voteup(problem_id); //return false prevent page navigation return false; }); var voteup = function(problem_id) { alert (...

android - Is it possible to test a local value using a junit test? -

sometimes test intermediate value in method. method can't split. wonder if junit can test method unit. if can put breakpoint in method, , local value , assert it, better. if impossible, how solve kind of problem. adding break point not unit testing , in fact not testing @ all. can call checking there no such thing check driven development. anyhow, people new unit testing quite find issue want test private or local values let variable or method. when started tdd in fact quite phased myself. thing is, in unit testing purpose black box testing of particular functionality , possible outcomes that. happens inside black box not concern nor need unit test it. if feel testing intermediate value maybe method long , should split 2 or more testable small methods. , if can not done should not worrying testing them. if intermediate value getting value public method it's that method want test in separate unit test, not value inside method testing.

javascript - Changing the RegExp flags -

so wrote myself function able count number of occurances of substring in string: string.prototype.numberof = function(needle) { var num = 0, lastindex = 0; if(typeof needle === "string" || needle instanceof string) { while((lastindex = this.indexof(needle, lastindex) + 1) > 0) {num++;} return num; } else if(needle instanceof regexp) { // needle.global = true; return this.match(needle).length; } return 0; }; the method performs rather , both regexp , string based searches quite comparable execution time (both ~2ms on entire vast ray bradbury's "451 fahrenheit" searching "the"s). what sort of bothers me, though, impossibility of changing flag of supplied regexp instance. there no point in calling string.prototype.match in function without global flag of supplied regular expression set true, note first occurance then. set flag manually on each regexp passed function, i'd prefer being able clone , manipulat...

Can't start Aptana, doesn't find JDK -

i added .bashrc, still doesn't work: path="$path:/usr/java/default/bin" path="$path:/usr/java/jdk1.7.0/bin" export jdk_home=/usr/java/default this error i'm getting: a java runtime environment (jre) or java development kit (jdk) must available in order run aptanastudio3. no java virtual machine found after searching following locations: /home/pc/programming/ides/aptana studio 3/jre/bin/java java in current path i don't know error means, there no folder called "jre" inside aptana download. most people might error message while installing aptana studio 3 first time but there simple solution it, follow given steps go [java.com][2] then download latest jre os **i preffer both x86 & x64 install 4.then restart ur pc 5.launch aptana 3

Android SQLite delete multiple rows -

i want delete rows in table specific id (not primary key). have tested 2 different methods, remove first row finds specific id: db.delete(calendartable.table_name, "repeat_group="+repeatgroup, null); and db.delete(calendartable.table_name, "repeat_group=?", new string[]{integer.tostring(repeatgroup)}); none of these methods works, how can remove rows in table specific id? in advance! update: lol, method above did work! me stupid 1 called own method delete() instead of deleterepeatgroup(), guess i'm tired! anyways, thank guys taking time. if else fails, can try following. rows in table id trying delete , save rowid's in array. iterate on array , delete each row. i hope works expected

height - CSS issue: Links on page becoming unclickable when other element is positioned "absolute" -

this longer story i'm trying cut short. i'm playing around website menu supposed partly slide under partly transparent background gif image, , reveal upon mouseover. that, i'm using z-index parameter on both background image , menu. since can't use z-index on body background image, i'm using "regular" image, i'm setting 100% width , height - , z-index paramenter work, need specify "position" well. seems though combo, i'm creating invisible shield that'll make links untouchable. i've cooked down following lines: <style> #style { position: absolute; width:100%; height:100%; } </style> <div id="style"></div> <a href="">test</a> if try this, see "test" link unclickable (cross-browser). does have idea how can solve this? thanks! <style> #style { background-color:#ccc; position: absolute; width:100%; height:100%; } {po...

iphone - Is there a clever way to figure out what size a UIWebview needs to be to hold all text -

i page full of info server via json. there lot of info , different parts info, images, text, graphs etc. display inside uiscrollview whole page can scroll. html want display inside uiwebview. have html before create uiwebview can change height of uiwebview contain text without uiwebview needing scroll. can vary in length each time new load of data server cant hardcore height needs be. so question is. given have nsstring holding html. there way calculate how high uiwebviews frame needs be, contain html without having scroll. hope understand question kinda long :) thanks, -code if it's ok resize webview (and parent scroll view's contentsize property) after html finishes loading, can use javascript query rendered height of html , use that. see ipad - find true height of uiwebview

objective c - NSHTTPCookieStorage state not saved on app exit. Any definitive knowledge/documentation out there? -

struggling problem , loath implement custom cookie management system. it appears hidden level of ios's implementation of http fails manage sessionless cookies properly. time http response sets or deletes cookie, immediate inspection of nshttpcookiestorage cookies yield expected results , indicate correct sessiononly value. but if app quits after response updates cookies, upon relaunch sessiononly=false cookies reverted previous state , recent updates lost. whether cookies set/deleted response header or nshttpcookiestorage setcookie: makes no difference. some caching/syncing voodoo must going on behind scenes. time takes cookie become persistent can 5 seconds. anyone out there has or can point definitive explanation of behavior? bug, plain , simple? or undocumented feature purpose can't comprehend? some code can use reproduce: - (void)applicationdidbecomeactive:(uiapplication *)application { [[nshttpcookiestorage sharedhttpcookiestorage] setcookieacceptpol...

sql - How can I insert 100000 rows to MSSQL? -

insert pantscolor_t (procode,color,pic) values ('74251', 'black', '511black.jpg'), ('74251', 'od green', '511odgreen.jpg'), ('74251', 'black', '511black.jpg'), ('74251', 'od green', '511odgreen.jpg'), ('74251', 'black', '511black.jpg'), ('74251', 'od green', '511odgreen.jpg'), .......... .......... .......... insert pantscolor_t (procode,color,pic) values ('74251', 'charcoal', '511charcoal.jpg'), ('74251', 'charcoal', '511charcoal.jpg'), ('74251', 'charcoal', '511charcoal.jpg'), ('74251', 'charcoal', '511charcoal.jpg'), ............. ............. ............. insert into........................ insert into........................ insert into........................ insert into........................ i have 100000 rows insert statement...

jQuery template on complete render event -

just curious if there way trigger operation (or attach event to) once jquery.template( name, template ) method completes rendering. the $.tmpl method executes synchronously far can see. why not put operation on next line? "it won't run until render complete.

java - JSF 2: property on bean assumed to be written instead of read? -

i have following simple view main.xhtml , request url like: http://localhost:8080/myproj/main.jsf?pq=2 <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="/templating/layout-2col.xhtml"> <ui:define name="metadata"> <f:metadata> <f:viewparam name="pq" value="#{pqhome.id}" required="true"> <f:convertnumber integeronly="#{true}" /> </f:viewparam> <f:event type="prerenderview" listener="#{pqhome.init}" /...

Microsoft Excel 2010 Web Query Macro: Pulling Multiple Pages From One -

i looking find on macro.. idea is, upon execution macro pull data web page (i.e http://www.link.com/id=7759 ) , place let's sheet2, , open page 2, , place right below page 1's data in sheet 2.... , on , on until set page number.. ideally pull following in order; title artist type paper size image size retail prize quantity and further more ideal placed in proper columns , rows of 4 , 8 rows down(columns across in web page). any on greatly, appreciated. have done research , found similar macros, sadly have had no luck getting them work me. vb's fail go through well. bit of useful info (maybe) figured out when trying write own, maybe save ever helps time.. .webtables = "8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38" those tables each item want put que... here's sample method going based on few assumptions workbook contains sheet hold query data called "query" workbook contains ...

Create Chat in WebApplication Java -

i have java web application servlet , java class in backend, , ajax , jsp in frontend deploy on tomcat6. create chat service users of application. kind of technology can use? i have jsp footer.jsp common other jsp page, in jsp create popup facebook chat comunication. have in hashmap of context application user logged, don't know how create java listner send , recive message user logged , other. kind of technology must use create backend , frontend listner? it depends on know / want learn , functionallity application should have... why not add current application ? use jsp front end, use ajax communication - servlet server .....

Android 3.x image crop freezing(motorola xoom and acer iconia) -

intent intent = new intent("com.android.camera.action.crop"); file path = this.getexternalfilesdir("tmp"); file file = new file(path, "tmp_" + string.valueof(system.currenttimemillis()) + ".jpg"); uri tmpuri = uri.fromfile(file); intent.setdata(selectedimage); intent.putextra(mediastore.extra_output, tmpuri); intent.putextra("outputformat", bitmap.compressformat.jpeg.tostring()); intent.putextra("crop", "true"); intent.putextra("scale", "true"); intent.putextra("outputx", 100); intent.putextra("outputy", 100); intent.putextra("aspectx", 1); intent.putextra("aspecty", 1); intent.putextra("return-data", false); startactivityforresult(intent, request_crop); i using code crop image. works on android 2.x. on 3.1(motorola xoom) , 3.2(acer iconia) application freeze after select crop area , tap "save" (onactivityresult not calle...

android - Fragment in ViewPager using FragmentPagerAdapter is blank the second time it is viewed -

i have fragment interface tabs along bottom open different fragments in main view. i have 1 particular fragment list of items. if user selects 1 of items in list, fragment opens contains viewpager scrolls horizontally between of items in list in previous fragment. works great. the viewpager uses fragmentpageradapter display items. the problem comes when user selects item in list, views it, hits button on tab bar go list, selects item. second time item selected, blank screen appears instead of viewpager. receive no errors in logcat when happens. why viewpager appearing first time? fragmentpageradapter: public class viewpageradapter extends fragmentpageradapter { cursor mcursor; public viewpageradapter(fragmentmanager fm, cursor c) { super(fm); mcursor = c; } public void changecursor(cursor c) { mcursor = c; this.notifydatasetchanged(); } @override public int getcount() { if (mcursor == null) retur...

activerecord - Is COMB GUID a good idea with Rails 3.1 if I use GUIDs for primary keys? -

i'm using rails 3.1 postgresql 8.4. let's assume want/need use guid primary keys. 1 potential drawback index fragmentation. in ms sql, recommended solution use special sequential guids. 1 approach sequential guids combination guid substitutes 6-byte timestamp mac address portion @ end of guid. has mainstream adoption: combs available natively in nhibernate ( nhibernate/id/guidcombgenerator.cs ). i think i've figured out how create comb guids in rails (with of uuidtools 2.1.2 gem), leaves unanswered questions: does postgresql suffer index fragmentation when primary key type uuid? is fragmentation avoided if low-order 6 bytes of guid sequential? is comb guid implemented below acceptable, reliable way create sequential guids in rails? thanks thoughts. create_contacts.rb migration class createcontacts < activerecord::migration def create_table :contacts, :id => false |t| t.column :id, :uuid, :null => false # manually create :id under...

android - i am using ContactsContract is shows error that mean it creates another class -

how can phone numbers, email_ids , names contact list when using contactscontract shows error how can avoid problems may missing permission. check android contacts api

encryption - Publishing encrypted files with Visual Studio 2010 ClickOnce -

my project solution located under encrypted folder , when publish project files encrypted. trying publish them server gives me error failed copy file 'c:...' '\server...'. unable add 'application files/...' web site. unable add file 'application files...'. specified file not encrypted. is there way remove encryption autmatically before publishing or other way solve this. don't want remove encryption of solution directory. you can disable encryption typing commands promt fsutil behavior set disableencryption 1 or if want keep encrpytion on, think need need make common encryption certificate , import both pc , server, able publish encrypted files across network. make new certificate import on both machines, then goto encryption certificate manager , select certificate, prompted select drives, select drives , wait till updates files. on both machines.

Ruby on Rails, find by two conditions -

i trying find values of given model combination of 2 fields. i have following model: create_table "users", :force => true |t| t.string "name" t.string "url" t.integer "clicks_given" t.integer "clicks_received" t.datetime "created_at" t.datetime "updated_at" end and have defined method model: def credits credits = self.clicks_given - self.clicks_received end i trying find users above given credits: @users = user.find(:all, :conditions => { "credits >= ?", -5 }) and: @users = user.find(:all, :conditions => { "clicks_given - clicks_received >= ?", -5 }) fail. should correct statement to find right users? pass condition array instead of hash: @users = user.find(:all, :conditions => [ "clicks_given - clicks_received >= ?", -5 ]) the first version not work since "credits" not databas...

Why doesn't this JavaScript code work as expected? -

this tiny javascript, along css supposed prevent duplicate entries database freezing screen after submit has been clicked. so far, out of on 200 people have used app submit entries, 6 of them have managed submit duplicate entries. we suspecting older browsers may responsible double entries. we still investigating. could assumption correct? if yes, there way improve code work on browsers? i keep code, rather go because of pleasant , feel open better. <script type="text/javascript"> function freezescreen(msg) { scroll(0, 0); var outerpane = document.getelementbyid('freezepane'); var innerpane = document.getelementbyid('innerfreezepane'); if (outerpane) outerpane.classname = 'freezepaneon'; if (innerpane) innerpane.innerhtml = msg; } </script> --css <style type="text/css"> .freezepaneoff { visibility: hidden; display: none; position: a...

jquery - How can I use JavaScript to limit a number between a min/max value? -

i want limit number between 2 values, know in php can this: $number = min(max(intval($number), 1), 20); // make $number 1 if it's lower 1, , 20 if it's higher 20 how can in javascript, without having write multiple if statements , stuff that? thanks. like var number = math.min(math.max(parseint(number), 1), 20);

MySQL distinct on one column with other max column -

let's have query: select report_id, time_sent report_submissions report_id in (1,2,3,4,5,6) order report_id asc, time_sent desc with result: report_id time_sent 1 2 1 1 2 4 2 3 3 4 and want change query distinct report_id max(time_sent), example: report_id time_sent 1 2 2 4 3 4 how do in efficient way? thanks. select report_id, max(time_sent) report_submissions report_id in (1,2,3,4,5,6) group report_id order report_id asc

iphone - NSFileManager Can't retrieve files -

in method transmitdata, nsarray files coming nil. problem in code? save file (we hit [file writetourl: fileurl atomically: yes]) , call transmitdata, cannot retrieve files. #import "filemanagerservice.h" #import "synthesizesingleton.h" @implementation filemanagerservice synthesize_singleton_for_class(filemanagerservice); #define savevoter @"sv" #define savescript @"ss" - (nsurl *)applicationdocumentsdirectory { return [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; } -(void)savefile:(nsdata*)file:(nsstring*)datatype { nsfilemanager *manager = [nsfilemanager defaultmanager]; nsurl *fileurl; nsstring *filename; if (datatype == data_save_voter) { filename = [nsstring stringwithformat:@"%@01",savevoter]; fileurl = [[self applicationdocumentsdirectory]urlbyappendingpathcomponent:filename]; int fid = 0; while ([manager fileexistsatpath:[fileurl abs...

xcode - Buttons and input field into "top" bar -

safari on ipad has bar @ top (it isn't called "toolbar" on ios, right?), icons , input searching. how put such buttons , input field navigation bar? navigation bar? read navigation bar has 1 button on left, 1 on right , 1 label in middle. how create "top" bar safari? if i'm in xcode 4.0 , choose "view-based app", should set in viewcontroller > simulated metrics > top bar > navigation bar? , how add buttons it? edit sorry confusion - don't know if proper way add navigation bar. i'm asking general overview how such "top "bar" made. kind of view such items belong under? you don't want use navigation bar. limited in controls can put in them. try using uitoolbar instead.

java - AppEngine Approximate Partial String Matching Algorithm -

so, realize covers wide array of topics , pieces of them have been covered before on stackoverflow, such this question . similarly, partial string matching , approximate string matching popular algorithmic discussions, seems. however, using these ideas in conjunction suit problems both need discussed seems highly inefficient. i'm looking way combine 2 problems in 1 solution, efficiently. right now, i'm using appengine java , persistent datastore. annoying, since doesn't seem have arithmetic usage in queries make things easier, i'm considering doing precalculation , storing field in database. essentially, idea friend , having on how possibly implement system matching , more or less hoping suggestions on how make more efficient. if needs scrapped in favor of better exists, can handle that, well. let's start off basic example of i'd search for. consider following nonsense sentence: the isolating layer rackets principal beneath hypocritical r...

c# - Problem with HttpOnly Cookies -

have problem creating httponly cookies , use following code creat new cookie: //a.aspx httpcookie ht = new httpcookie("www"); ht.value = "www"; ht.name = "www"; ht.httponly = true; ht.expires = datetime.now.adddays(1); response.appendcookie(ht); response.redirect("b.aspx"); //b.aspx httpcookie cookie = request.cookies["allowed"]; httpcookie htt = request.cookies["www"]; if (cookie != null) { response.write(cookie.httponly); response.write(htt.httponly); } else { cookie = new httpcookie("allowed"); cookie.httponly = true; cookie.value = "ping"; cookie.expires = datetime.now.addminutes(2); response.cookies.add(cookie); response.write(cookie.httponly); response.write(htt.httponly); } the problem final result : false , although httponly property set true . c...

thread safety - File IO within an ASP.NET MVC Action -

is possible use kind of 'critical section' safe following within action... public actionresult generatetasks() { string somedir = .... if (!directory.exists(somedir)) { directory.createdirectory(somedir); } ... } you can using system-wide mutex. process or app-domain locking primitives fail work under conditions (for instance when application pool recycled). however, specific case here that's not necessary: directory.createdirectory implement existence check on own, shouldn't need in regard.

Keep silverlight video in full screen in a dual monitor configuration -

i have silverlight video playing in second monitor attached laptop. want work on laptop screen , want silverlight video remain in full screen mode. is there configuration change need on laptop make work? simple answer: need upgrade silverlight 4: new features in silverlight 4 full-screen support silverlight 4 enables applications remain in full-screen mode when application active. update programmers looking check/enable this: application.current.host.content.fullscreenoptions = system.windows.interop.fullscreenoptions.staysfullscreenwhenunfocused;

How to Export Java Project in Eclipse with Image Library as a jar file -

Image
i want export java project jar file, images on it. i followed these instructions :http://www.cs.utexas.edu/~scottm/cs307/handouts/eclipse%20help/jarineclipse.htm but after try run jar file gives "invalid or corrupt jarfile" error. what more when export runnable jar file, icons added code not shown. how should import them in jar file ? try export runnable jar file time to answer second query choose followin option

php - Alphabet border in transparent background image is unwanted? -

Image
i using code creating images text written in transparent backgrounds. <?php // set content-type header('content-type: image/gif'); // create image $im = imagecreatetruecolor(400, 150); // create colors $black = imagecolorallocate($im, 0, 0, 0); $acolor = imagecolorallocate($im, 153, 204, 153); imagecolortransparent($im, $black); // text draw $text = 'testing...'; // replace path own font path $font = 'arial.ttf'; // add text imagettftext($im, 50, 0, 10, 100, $acolor, $font, $text); // using imagegif() imagegif($im,"img.gif"); imagedestroy($im); ?> but text written in img.gif has unwanted color(black) on borders of alphabets('e,s,n,g'). how can finish color.the generated image arial font download site http://code.google.com/p/ireader/downloads/detail?name=arial.ttf the gif format cannot handle alpha transparency. can have 100% transparent (= invisible), or 100% opaque (= visible) pixels. your t...