Posts

Showing posts from May, 2014

javascript - asp.net json displaying weird results -

i having trouble displaying results recieved asp.net webmethod. have html template , fill in results json response. problem first response being displayed once, second displayed 2 times, third 4 times, fourth 8 times , on . here jquery (i need reference "d" first because response comming asp.net , put there automatically) function fngetcontent(keyword) { var newkeyword = keyword.tag; var type = keyword.type var oldresults = $("#fillresultsdiv").html() $('#hidquerytype').val('tagsearch'); $.ajax({ type: "post", //getevents(itype integer, ssearch string) url: "default.aspx/getevents", data: "{'itype':'" + type + "','ssearch' : '" + newkeyword + "' }", contenttype: "application/json; charset=utf-8", datatype: ...

validation - Validate form with hidden fields -

in page there few hidden field filled correct value script. these fields validated server side against code injection , others malicius attacks i'd put code validate fields client-side. aim request field name = "name1" , "name2" contain string of 2 (not more not less) letters (not numbers) submit form. problem others fields using jquery validation plugin 1.9.0 if field hidden script doesn't work on it. i'm using following code tell validation roles follow: $(document).ready(function(){ $("#myform").validate({ rules:{ my_hidden_field:{ required: true, minlength: 2, } }, messages:{ my_hidden_field: "this field not valid" }, errorlabelcontainer: "#boxvalidator", wrapper: "li", }); }); use ignore: [] validate hidden fields: $("#myform").validate({ rul...

java - Centering image in a JFrame? -

i'm creating jframe program. have icon used program , have show first thing on jframe, i'm having issues trying center image. if kind of centering screws whole alignment of else. i'm trying have jlabels, other icon, left aligned. have icon aligned center. i had remove personal information, whatever did remove put them between "[]". import java.awt.dimension; import java.awt.font; import javax.swing.borderfactory; import javax.swing.box; import javax.swing.boxlayout; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; public class extends jframe { public about() { super("about [program]"); seticonimage([program].getinstance().seticon()); jpanel main = new jpanel(); main.setlayout(new boxlayout(main, boxlayout.y_axis)); main.setborder(borderfactory.createemptyborder(10,10,10,10)); jlabel icon = new jlabel("", new imageico...

sql server 2008 r2 - c# date time format for SQL_Latin1_General_CP1_CI_AS -

how format insert statement date time collation... currently: string sqlst = "update [lastupdate] set last_update = '" + datetime.now.tostring("yyyy-mm-dd") + "'"; this works latin1_general_ci_as on different server need statment work server set collation sql_latin1_general_cp1_ci_as this error get: the conversion of char data type datetime data type resulted in out-of-range datetime value would great if @jon skeet said, if cant, use convert string sqlst = "update [lastupdate] set last_update = convert(datetime, '"+datetime.now.tostring("yyyy-mm-dd")+"', 120)

Android : Activity Stacking Issue or System Launching Issue -

Image
the main/launcher activity in app login page (activity a). once user authenticated, taken main area of application, e.g. activity b. current activity stack of task > b. i press home button on phone , taken android home screen. re-launch app via short cut key in htc desire z(see image after space there 2 short cuts 1 , 2), , taken activity a, instead of activity b. either activity stack > b > a, or there 2 separate tasks activity stacks > b, , respectively. want taken activity b when relaunch app.. i followed link the above solution worked 2.3.3 in ics 4.0.3 has issue not taken activity b. how resolve this,in ics not able see intent flag system using launch activity when short cut pressed,is system bug? please nitz the pattern tend use login this. i'll use a mean login , b mean main application. i make b launcher activity , , in oncreate() check if login needed , if so, launch activity a . once a done, finish() it, i'm b . this way act...

Getting mount type information in python on OSX -

is there way in can information mounts have in folder /volumes in osx? i want able tell difference between disk images dmgs , other types, hard disks or network mounts. i tried parsing output of mount -v , looking if read-only in line doubt that's particularly accurate way of telling, , not method either. is there module or method give me information? have @ diskutil(8) , hdiutil(1) tools.

asp.net - Losing Session Variables during internet reconnection -

i have looked on problem, not found quite it. i have asp.net web site 1 user (that know of) getting problems being logged out (forms auth) , losing session variables. i think happening user using mobile internet connection, flaky , drops connection , reconnects, not new ip address. think destroying values stored in session state. is problem has had, , if so, how round it? guess worse if more people connect internet in way. often error view state mac error, not always. of course, may not related internet connection issues. many thanks

ios - what is difference between AVCapture and camera default of iPhone -

my app use avcapture capture image, supervisor's ideal. research in internet , can't information difference between avcapture , default camera of iphone or ipop (tab focus or camera quality...). please tell me advance of avfoundation framework ... with avcapturesession can give recorder lot more functionality. can customize every aspect of recording session. , can ever raw data straight camera. code can quite complex however, , nothing taken care of you. with ios default image capture controller stuck few presets, , have little bit of camera functionality. simple implement. updated link apple code if want see how use avfoundation camera recording app apple. like said, have manually. prepared handful of work. avcam demo app apple

Wordpress plugins not updating/installing -

since yesterday, i've tried numerous times upgrade/install plugins on website built wordpress (not mine, first time i'm on it). i following message while installing new plugin: downloading install package http://downloads.wordpress.org/plugin/[plugin-name].zip… unpacking package… and stops there. i tried updating akismet too. didn't upgrade , webite hanged maintenance mode. website again , message on dashboard: an automated wordpress update has failed complete - please attempt update again now. any suggestions? here few possibilities incorrect permissions. prombelmatic plugin. configuration in .htaccess not allowing files large enough perform action. try adding addtype x-mapp-php5 .php top of .htaccess file. try deleting .maintenance file.

substr_replace encoding in PHP -

i want write text file. when use substr_replace in php encoding changes. doesn't print greek characters correctly. if don't fine. suggestions? <?php $file = "test.txt"; $writefile = fopen($file, "w+");//read/write $myarray = array("δφδφ","δφδσφδσ","δφδφδ"); $myarray[0] = substr_replace($myarray[0],"ε", 0,1); foreach ($myarray $data){ fwrite($writefile, $data."\n"); } ?> outcome ε�φδφ δφδσφδσ δφδφδ outcome no substr_replace δφδφ δφδσφδσ δφδφδ assuming you're encoding greek in multi-byte encoding (like utf-8), won't work because core php string functions, including substr_replace , not multi-byte aware. treat 1 character equal 1 byte, means you'll end slicing multi-byte characters in half if replace first byte. need use more manual approach involving multi-byte aware string function mb_substr : mb_internal_encoding('utf-8'); echo 'ε' . mb_subs...

Need to set ListView in multiple tabs in my android screen -

hi need multiple tabs in android screen, got tabhost view referring to in android, how can put tabs in view containing image on top? but need set listviews in each of tab's layout...so can nyone me code plzz.. thanks in advance. each of tab layout nothing activity combined tabhost, things in activity , if want show list tabs have use tabgroupactivity class.

PHP, Zend Framwork Errors getting consumed by Apache -

i installed apache2, php5 in fresh ubuntu system, have uploaded zend framework project, see zend , php errors getting consumed apache , getting internal server error 500 on browser. when looked error log of apache2 find php errors logged in there. i have error_reporting e_all | e_strict, display_errors on in php.ini. by default zf shows errors in development mode hides them in production mode (this thing). can change these settings in application.ini. if having problem in dev mode, ensure application_env being set correctly.

jsf - Applying request values to entity bean loaded with id from inputHidden before other fields -

i have facelet template with: <f:metadata> <o:viewparam name="id" value="#{homebean.id}" /> </f:metadata> <h:form> <h:inputhidden value="#{homebean.id}" /> <h:inputtext value="#{homebean.user.firstname}" /> <h:commandbutton value="submit" action="#{homebean.onsave()}" /> </h:form> and request scoped bean with: @named @requestscoped public class homebean { private integer id; private user user; public void setid(integer id) { system.out.println("setid called"); user = // code loading user entity bean supplied id } // other accessors id , user } initial page load works well, entity loaded , displayed in form, inputhidden set entity id. problem submit throws: javax.el.propertynotfoundexception - target unreachable, base expression '. user' resolved null probably because getuser calle...

python - building scrapy spiders into my own program, i don't want to call scrapy from command line) -

in similar vein question: stackoverflow: running-multiple-spiders-in-scrapy i wondering, can run entire scrapy project within python program? lets wanted build entire program required scraping several different sites, , build entire scrapy projects each site. instead of running command line 1 of, want run these spiders , acquire information them. i can use mongodb in python ok, , can build scrapy projects contain spiders, merging 1 application. i want run application once, , have ability control multiple spiders own program why this? application may connect other sites using api , needs compare results api site scraped site in real time. don't want ever have call scrapy command line, meant self contained. (i have been asking lots of questions scraping recently, because trying find right solution build in) thanks :) yep, of course can ;) the idea (inspired blog post) create worker , use in own python script: from scrapy import project, signals scrapy...

php - jquery Autocomplete click event -

<div id="display"> <div align="left" class="display_box"> <a class="test" href="#"> <img style="width:25px; float:left; margin-right:6px" src="user_img/gow.jpg"> </a> <input type="hidden" id="uid" value="3"> <b>b</b>ack&nbsp;<b>b</b>ack<br> <span style="font-size:9px; color:#999999">back</span> </div> <div align="left" class="display_box"> <a class="test" href="#"> <img style="width:25px; float:left; margin-right:6px" src="user_img/gow.jpg"> </a> <input type="hidden" id="uid" value="3"> <b>b</b>ack&nbsp;<b>b</b>ack<br> ...

Android ksoap2 webs service returning false -

im trying consume dot net web service on android using ksoap. seems fine response false. internet permission set in manifest file. what wrong? package com.bible; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.propertyinfo; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapprimitive; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse; //import com.bible.r.string; import android.app.activity; import android.os.bundle; import android.util.log; import android.widget.textview; public class bibleactivity extends activity { private final string namespace = "http://www.webservicex.net/"; private final string url = "http://www.webservicex.net/biblewebservice.asmx"; private final string soap_action = "http://www.webservicex.net/getbiblewordsbykeyword "; private final string method_name = "getbiblewordsbykeyword "; /...

python - Gdata Export Document----Conflict Error -

so rather worrying--i hope can give me hand one. i using python script download google doc spreadsheets , them our servers. of time, works well, every error looks this: gdata.service.requesterror: {'status': 409, 'body': '', 'reason': 'conflict'} here of code using. know if export function has strange behavior causing this? qc_googledoc_spreadsheet_autolog author: christopher james johnson date: may 22, 2012 try: xml.etree import elementtree except importerror: elementtree import elementtree import gdata.spreadsheet.service import gdata.service import atom.service import gdata.spreadsheet import gdata.docs.service import atom import getopt import sys import string import time import shutil import os import getpass import tempfile import csv import time import datetime import glob def main(): archiver = backupper() class backupper(): def __init__(self): gd = gdata.docs.service.docsservice() self.gd_client =...

Two languages in sqlite database - Android -

i have simple database - 1 table 6 collumns. 3 of them want have in 2 languages. is possible automatically ? add language prefix collumn , choose language(_en,_pl) user use ? work ? i must have in 1 database, because copy users device. i can' t find information it, help. no, isn't how sqlite dbs work android's localization features. can strings.xml (for example) creating... /res/values/strings.xml /res/values-pl/strings.xml ...and on databases , queries work on absolute column names. the best way of doing can think of identify local language , use abbreviation suffix or prefix when building queries etc.

sql server - SQL - Dynamically generated Insert or Select statement based on some condition -

lets have table following data customer table: name amount date_created invoice_number -------------------------------------------------- john 50 11april2012 12 bob 150 15april2012 32 david 506 10may2012 52 paul 80 12aug2012 12 mark 10 11jan2012 52 summary table: name amount --------------------- sally 250 darren-32 150 i select rows date_created between start_date , end_date of current_quarter. if date_created within current quarter append invoice_number name before doing insert statement (see example in summary table above). insert summary(name, amount) select name|| '-' || invoice_number, date_created, invoice_number customer; how can modify above use either "decode" function or "case" function (or other "if statement" type function) check value of date_created , append invoice_number if da...

Android OnlocationChanged storage -

i know best way of saving latitude , longitude onlocationchanged() method. is using sharedpreferences , or i* ntent/broadcastreceiver *? thanks. i store in public static (class) variable of activities can access it. think sharedpreferences overkill (unless value needs survive when application killed , later restarted).

osx - Mac CoreLocation Services does not ask for permissions -

i'm writing mac app needs use corelocation services. code , location works fine, long manually authenticate service inside security preference pane. framework not automatically popping permission dialog. documentation states: important user has option of denying application’s access location service data. during initial uses application, core location framework prompts user confirm using location service acceptable. if user denies request, cllocationmanager object reports appropriate error delegate during future requests. i error delegate, , value of +locationservicesenabled correct on cllocationmanager. part missing prompt user permissions. occurs on development mpb , friends mbp. neither of can figure out whats wrong. has run this? relevant code: _locationmanager = [cllocationmanager new]; [_locationmanager setdelegate:self]; [_locationmanager setdesiredaccuracy:kcllocationaccuracykilometer]; ... [_locationmanager startupdatinglocation]; i...

javascript - Find the child DIV's and setting their style -

<div class="pm-dialog"> <div class="pm-dialog-close"> <div class="colors-main-content"><span>&times;</span></div> </div> <div class="pm-dialog-inner colors-main-content" style="margin: 12px 15px 0px 15px;"> <div> <div class="pm-dialog-content"> <div id="selectlocationprofilepopup"> </div> </div> <div class="pm-dialog-footer"> <div> <div class="pm-dialog-footer-background"></div> <div class="pm-dialog-buttonpane"></div> </div> </div> </div> </div> </div> i have class defined pm-dialog-inner has display:table-row. can 1 line : $(".pm-dialog-inner > div").css("display...

mysqli - Sql : How to calculate table values using formula -

here original query :, generates o/p 2 columns name (label, count) : label count fails 1 pass 3 and here query wrote generates above data select r.pname resolution ,lb.label ,count(r.pname) occurences issuelink inner join jiraissue p on issuelink.source = p.id inner join jiraissue c on issuelink.destination = c.id inner join issuelinktype t on issuelink.linktype = t.id inner join resolution r on c.resolution = r.id inner join issuestatus istat on p.issuestatus = istat.sequence inner join label lb on c.id = lb.issue t.linkname = 'jira_subtask_link' , p.pkey in (@pkey) , c.issuetype in ('13') , r.pname not in ('fails smoke test - general failure', 'fails smoke test - new firmware available') , label in ('smoketest', 'fullcert', 'bfv', 'papercert') group r.pname; as per suggestion tried using cross function, throwing error of "please check syntax": select 100.0 * fail.cnt / (fail.cnt ...

selenium doesn't run when web page is loading -

i running tests have restart server clicking "restart" button. there small text being displayed near show status of server. before clicking "restart" button, text shows "running" , after clicking it, whole web page keeps loading , text shows "restarting". after page stops loading, server starts running again , text shows "running". i have write test case checks if text shows "restarting" when "restart" button clicked. unfortunately not able find way make selenium check if text showing "restarting" unable since webpage loading @ time. can me out showing me way how make selenium run when webpage loading? not getting replies in google search this. great if can me out. thanks usually can drive browser webpage still loading. suggest find element "restarting" , keeps checking until 60 secs in ruby, like wait = selenium::webdriver::wait.new(:timeout => x) wait.until {driver.f...

Glib GIOChannel -

i'm trying tutorial on glib uses giochannel. i'm using ubuntu 11.04 (natty narwhal) glib-2.30.2 (gtk+-3.2.3) , c code. the code here: http://library.developer.nokia.com/index.jsp?topic=/guid-e35887bb-7e58-438c-aa27-97b2cde7e069/guid-817c43e8-9169-4750-818b-b431d138d71a.html the program runs contents of source test file not copied destination file. i'm not receiving error or warning messages. program nothing. what's wrong here? works now, changed line: g_print("usage:<cp source> <destination>\n"); to: g_print("usage: %s <source> <destination>\n", argv[0]); then compiled using: gcc -wall $(pkg-config --cflags gio-2.0) -c io.c gcc -wall $(pkg-config --libs gio-20) -o io io.o run program using: ./io io.c new_io.c

apache - localhost/drupal/drupal/mysite to localhost/mysite or mysite.com? -

how change localhost/htdocs/drupal-vn/drupal-vn/mysite1; ...mysite2 www.mysite1.com , www.mysite2.com , localhost/mysite? don't use httpd.conf or something? i'm on xp xampp. also, process called? changes made in apache configuration. please follow instruction here - article if follow step step - http://www.debian-administration.org/articles/412

print scrollable vb.net form -

i have tried printform, printdocument visual studio power packs not able print complete scrollable form. using visual studio 2010. can me? thank in advance. set printform.printoption . printform1.print(me, scrollable)

vb.net - Display a DAO table in a form -

i'm upgrading old vb6 application vb.net uses dao connect access database. know hopelessly outdated technology, considering amount of work changing ado, i've decided stay dao, despite frustration trying find documentation. my problem i'd have datagridview reflect table database. of course make own routine manually setting columns , fill datagridview, if way, i'd use datasource property or other built-in function. found forum post looked promising, unfortunately couldn't find attachment referred to. also, if there other controls better suited datagridview, please let me know. thanks one option use method found in code complete. put nice, clean layer between vb.net user interface , legacy data access code (your dao code). layer take data fetched via dao , transfer datatable object. then, send datatable ui , use .datasource property of datagridview. honestly, however, since involves writing code each dao function returns data display, refactor dat...

Problems with Compiling C program on Ubuntu -

i using ubuntu 10.10 vm , new it. until compile c programs terminal. however, try compile them gives message as: /usr/bin/ld: cannot find -lc collect2: ld returned 1 exit status i have searched on net not figure out going wrong. know answer must simple appreciated. thanks! installing necessary tools should solve problem. try: sudo apt-get install build-essential

java - "SocketException: Unexpected end of file from server" from servlet but not from standalone application -

i call servlet servlet. can call remote servlet standalone application cannot call servlet (it on glassfish). use same code call (i error @ last code line): url serveraddress = new url(endpoint); //set initial connection httpurlconnection connection = (httpurlconnection) serveraddress.openconnection(); connection.setrequestmethod("post"); connection.setdooutput(true); connection.setdoinput(true); connection.setreadtimeout(timeout); connection.setrequestproperty("content-type", "text/xml; charset=iso-8859-1"); connection.connect(); outputstreamwriter wr = new outputstreamwriter(connection.getoutputstream()); wr.write(requestbody); wr.flush(); bufferedreader rd = new bufferedreader(new inputstreamreader(connection.getinputstream())); it suspicious code can't read response of remote servlet servlet doesn't reply @ all. why reply when call standlone app? don't understand... got exception: java.net.socketexception: unexpected end of file s...

c# - Constant in EF causes exception -

i have following code. causes exception. using (var context = new blogentities()) { var listofcomments = context.comments .orderbydescending(c => c.createdate) .where(c => c.createdate > fromdate) .select(c => new newsfeeddata() { articleid = c.articleid, commentid = c.commentid, text = c.commenttext, author = c.author, createdate = c.createdate, type = 'c' }).tolist(); } than tried enum there problems. best way achieve want? want assign constant type one simple approach fetch values database anonymous type, use asenumerable switch linq objects before final projection: using (var context = new bl...

Update offspring in nested tree mongoDB, node.js -

is there way update nested documents id or other field? i use " full tree in single document " , don't know beforehand how deep nesting can go. need update, example, answer {id:'104'}. can via 'dot notation', since don't know level (depth) of nesting can't predict how long 'comment.answers.answers....answers.' can go. is there way directly find , update id:'104', or still need pass kind of depth mark? { title:'some title', comment: { id:'101' author:'joe', text:'some comment', answers: [ { id:'102' author:'joe', text:'first answer comment', answers: [ { id:'103' author:'done', text:'first answer first answer comm...

android - sms filter using broadcast receiver -

i trying hide messages inbox,and turned , that's placed in new database....my code smsfilter.java follows public class smsfilter extends broadcastreceiver{ sqlitedatabase mydb,messagedb; string number; arraylist<string> private_num = new arraylist<string>(); @override public void onreceive(context context, intent intent) { //private named database contains numbers wish hide mydb=context.openorcreatedatabase("private", 0,null); mydb.execsql("create table if not exists tab1(num int(13))"); cursor cur=mydb.rawquery("select * tab1", null); while(cur.movetonext()) { number=cur.getstring(cur.getcolumnindex("num")); private_num.add(number); } if (intent.getaction().equals("android.provider.telephony.sms_received")) { bundle extras = intent.getextras(); if (extras != null) { object[] pdus = (object[])extras.get("pdus"); ...

sorting - jQuery TinySort mixed literal and numeral not working -

trying sort comments on metafilter favorites. doing using tinysort , grabbing title attribute in favorites' link: $('div.comments').tsort('span.smallcopy>span>span>a',{attr:'title',order:'desc'}); but mixed literal , numeral not working correctly i'm getting (5, 58, 4, 3, 39, 32, 2...) ex: http://i.imgur.com/7n1ln.jpg instead of (58, 39, 32, 5, 4, 3, 2...) i using latest tinysort version 1.3.27 i have tried removing space title attribute, no luck: $('span.smallcopy>span>span>a').attr('title', function() { return this.title.replace(/\s/g, ''); }); hmmm... sounds bug i'll have tomorrow afternoon , update source if indeed bug. -edit- the @title string, since says '4 people marked favorite'. sort technically correct. if have been number tinysort have parsed such , sorted differently. so solution here first use jquery set attribute using title , sort on that. i...

dojo - How to put Serial Number in dojox grid rows -

how can insert row number serial number in each dojo grid rows?? must not change grid filtered or sorted.. idea?? the solution found use 'get' in grid structure add function siformatter(index){ return index + 1; } and add structure of grid - {field: "si", name: "#", : siformatter, filterable: false} disable sort column using cansort function in grid donno if there other better solutions..

transparency - How to make a background 20% transparent on Android -

how make background of textview 20% transparent (not transparent), there color in background (i.e. white)? make color have 80% in alpha channel. example, red use #ccff0000 : <textview ... android:background="#ccff0000" /> in example, cc hexadecimal number 255 * 0.8 = 204 . note first 2 hexadecimal digits alpha channel. format #aarrggbb , aa alpha channel, rr red channel, gg green channel , bb blue channel. i'm assuming 20% transparent means 80% opaque. if meant other way, instead of cc use 33 hexadecimal 255 * 0.2 = 51 . in order calculate proper value alpha transparency value can follow procedure: given transparency percentage, example 20%, know opaque percentage value 80% (this 100-20=80 ) the range alpha channel 8 bits ( 2^8=256 ), meaning range goes 0 255. project opaque percentage alpha range, is, multiply range (255) percentage. in example 255 * 0.8 = 204 . round nearest integer if needed. convert value obtained in 3., ...

c++ - Embedding javascript into an application (like Lua) -

i lot of web-related work javascript (some mundane web app stuff, bleeding-edge software renderer/webgl stuff), , have game-related projects code in c++. i have intended c++ bits use lua accomplish dynamic scripting functionality, starting wonder if may serve me somehow embed javascript engine codebase minimize amount of context-switching do, because going make me cringe if time comes find myself needing port lua code js or port js code lua. the v8 javascript engine embeddable , desktop c++ application , that'd end of monkey wrench in situation here problem of never being able v8 submission ios app store. this leads me down quite different path. wonder whether possible use javascriptcore replace use lua for. just side note old question: apple has made javascriptcore public api in ios 7 used dynamic scripting or other application logic.

javascript - Nested function: am I creating 10 functions here? -

i'm working on function complicated (processor) embedded part of functionality in nested "utility function" inside (print). simplified version of looks this: var out = document.getelementbyid( "output" ); function processor ( n ) { function print( msg ) { out.innerhtml += msg; } while ( n > 0 ) { print( n-- ); print( ", " ); } print( "<br/>" ); } ( var = 0; < 10; i++ ) { processor( ); } you can see in action in this jsfiddle . the question is: creating 10 instances of utility function print() ? if yes, more efficient way write code without putting utility function outside processor() function? want print() function accessible in processor() , else. 1 solution namespace. i've read question , though it's related it's not directly answer: efficiency of creating event handler in nested loop: creating 1440 functions here? in short, yes are. since fun...

android pay - Generating a jwt in Google Wallet -

i don't understand how generating jwt in tutorial #1 . is call javascript function? the tutorial says it's generating jwt server side , has link server libraries (in multiple languages) can generation you.

performance - Copy Chart & Print Very Slow VBA -

i have performance problem , google doesn't me. person has same problem : http://excel.bigresource.com/copy-chart-print-very-slow-1eesa883.html when copy excel chart vba : slooooow. dim mychart chartobject each mychart in consopdc.chartobjects mychart.copy ... next any idea makes faster ? information objective paste them in powerpoint. the weird thing making manually isn't slow @ all thanks. nico. because making copy powerpoint, i'll suggest try out code: mychart.copypicture appearance:=xlscreen, format:=xlbitmap found in ms-help , here also found nice hint here , according to, following code should faster mychart.chartarea.copy testet on small scale demo, excited hear big scale results :) nice have comparision in seconds, when try out. edit: thing watch out - memory leaks if extensive copy clipboard should watch out clean afterwards, otherwise might fill memory quite fast ;) result in weak performance, many s...

r - Avoiding `foreach` by using `data.table`: error "Combining := in j with by is not yet implemented" -

i had created function couple of weeks ago using library foreach . function finds previous month's market capitalisation companies in dataset. since dataset large, trying rewrite function using data.table (getting rid of foreach altogether), have been unsuccessful far. here have: data.table object contains (among others columns) column integer specifying current month (tm), company number (permno), market capitalisation @ end of month (mktcap) , column integer previous month (pm). here summary of table year 1962: > summary(results62) tm permno mktcap pm min. :196201 min. :10006 min. : 41 min. :196112 1st qu.:196205 1st qu.:18382 1st qu.: 11462 1st qu.:196204 median :196208 median :24328 median : 37367 median :196207 mean :196207 mean :24349 mean : 215224 mean :196201 3rd qu.:196210 3rd qu.:29866 3rd qu.: 132181 3rd qu.:196209 max. :196212 max...

ruby - Defining elements and locators with interpolation in site-prism? -

do happen know if there way define both elements , locators using string or symbol interpolation while using site-prism gem? i'm trying this: 0.upto(@adults) { element :"adult#{index}", "#passenger-first-name-#{index}" element :"adult#{index}", "#passenger-last-name-#{index}" index+=1 } but i'm getting following syntax error @ executing: syntax error, unexpected tsymbeg, expecting keyword_do or '{' or '(' (syntaxerror) element :"adult#{index}" , "#passenger-first-name-#{index}" i reading here symbols allow interpolation: http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings/ maybe missing something? lot! i haven't tried symbol interpolation, string interpolation should work. but, many not need that... usually, sort of thing can solved more closely modelling website using sections. instead of dynamically creating elements, use element...

android - Center four buttons in screen quarters -

i want this: button 1 centered in top left part of screen button 2 in top right button 3 in bottom left and 3 or 4 buttons in bottom right. i'm new can't post picture. tried different layouts 0 results. thanks help. what want relativelayout: http://developer.android.com/reference/android/widget/relativelayout.html something along lines of: <relativelayout> <button android:layout_alignparenttop="true" android:layout_alignparentleft="true" /> <button android:layout_alignparenttop="true" android:layout_alignparentright="true" /> <button android:layout_alignparentbottom="true" android:layout_alignparentleft="true" /> </relativelayout> from should able figure out rest. suggest reading on relativelayout , alignment parameters edit- after explained in comments, try like: <linearlayout android:orientation="vertical"> <linearlayou...

malloc and constructors in c++ -

is possible pass parameters constructor of class inside constructor of class using malloc ? can new . need same thing malloc : (if not make sense, consider using custom allocator instead of malloc) class a_class ... { public: b_class *b; ... a_class: ... { b = new b_class (c1, c2, c3); } // end of constructor } now malloc: class a_class ... { public: b_class *b; ... a_class: ... { b = (b_class*) malloc (sizeof(*b)); ??????????????? } } malloc allocates raw memory. there's no point in trying pass constructor arguments because doesn't call constructors. if have work raw memory, construct object in allocated raw memory using " placement new " syntax ... void *raw_b = malloc(sizeof *b); b = new(raw_b) b_class(c1, c2, c3); // <- placement new ... numerically, value of b same raw_b , i.e. possible without raw_b pointer. prefer way, intermediate void * pointer, avoid ugly casts....

iphone - black background when overriding drawRect in UIScrollView -

so trying override drawrect in uiscrollview, gives me black background instead of background color i've specified uiscrollview. why this? if remove drawrect code fine: - (void)drawrect:(cgrect)rect { [super drawrect:rect]; if (shoulddrawverticallineforprofile){ cgcontextref context = uigraphicsgetcurrentcontext(); cgcolorref separatorcolor = [uicolor colorwithred:47.0/255.0 green:47.0/255.0 blue:47.0/255.0 alpha:1.0].cgcolor; // add @ bottom cgpoint startpoint = cgpointmake(60, 0); cgpoint endpoint = cgpointmake(60, 10000); cgcontextsavegstate(context); cgcontextsetlinecap(context, kcglinecapsquare); cgcontextsetstrokecolorwithcolor(context, separatorcolor); cgcontextsetlinewidth(context, 5.0); cgcontextmovetopoint(context, startpoint.x + 0.5, startpoint.y + 0.5); cgcontextaddlinetopoint(context, endpoint.x + 0.5, endpoint.y ...

css - How to make a:hover images scroll with div box -

alite used tutorial site: http://www.webreference.com/programming/css_gallery/index.html the problem is, when added more images, gallery on right fell out of div margins. fix used overflow:auto. when there lot more images, allowed scroll down div. problem image shown when hover positioned @ top part of div. when scroll down much, image either gets cut out top or doesnt appear @ all. kinda on page right here. if scroll down page far enough wont see post more unless scroll up. there css code can use fix this. want position:fixed effect in div box hover thing. how edit tutorial code that? the issue step 9 in tutorial #container li { float:left; } an important concept know floats clear property. because space of images exceed of containing div, images fall out of div. there several ways resolve issue. read here more http://css-tricks.com/all-about-floats/ 1. overflow: auto; have implemented 2.define class .clear { clear:both; } and put <div...

json - Why response from my WCF Service is empty when I call it from javascript on phonegap android? -

i've wcf service response json. want json string wcf service javascript on phonegap android. when call wcf service javascript, response wcf service empty. i've test call wcf service , works. javascript wrong? here javascript: <script type="text/javascript"> function displaytext() { $.ajax( { type: "get", contenttype: "application/json; charset=utf-8", url: "http://10.80.3.73/webservice/service1.svc/json/weeklyflash/id", datatype: "json", success:function(data){ alert(data); }, error: function () { alert("error"); } }); } </script> the alert message shows [object object] , ...

android - Why can't I find a reference to the StatusBarManager class directly? -

to dynamically drag down notification area in android, solution this object sbservice = getsystemservice( "statusbar" ); class<?> statusbarmanager = class.forname( "android.app.statusbarmanager" ); method showsb = statusbarmanager.getmethod( "expand" ); showsb.invoke( sbservice ); this works wonderfully, why nastiness reflection? why can't find reference statusbarmanager class directly? why there not constant in context class "statusbar" service? why nastiness reflection? because not part of android sdk. people interested in creating unreliable apps try interact statusbarmanager outside of android source code itself, since core android team , device manufacturers welcome change outside of sdk whenever wish. why can't find reference statusbarmanager class directly? because not part of android sdk. there great many classes , methods in android framework classes marked @hide annotation, ...

CSS Validator library for Java -

i looking out css validator library can use in java application. have checked out this. http://jigsaw.w3.org/css-validator/manual.html . according understanding needs run on server locally or used command line tool. correct me if wrong here. thanks in advance behind link have posted there webservice can use validate css files. have online doing this. there offline version available: http://jigsaw.w3.org/css-validator/download.html might can embed in application.

android - LinearLayout onclick does not translate after TranslateAnimation -

here problem. have linearlayout has clickable=true ontouch event when linearlayout touched, slides screen. works, afterward when ontouch event fired new location nothing happens. steps: i touch linearlayout , moves should. i touch again , nothing happens i touch part of screen linearlayout linearlayout toggle should. it appears if view has moved new location in reality has not. below xml & code. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/julycontainer" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:id="@+id/rel01"/> <imageview /> </relativelayout> <imageview android:id="@+id/shadow" android:paddingtop="6dip...

ruby on rails - Rake aborted! when locally Precompiling Assets -

when running bundle exec rake assets:precompile on dev machine rake aborted error: cannot load such file -- rack/google_analytics this in gemfile in production group isn't installed on dev machine: group :production gem 'rack-google_analytics', :require => "rack/google_analytics" end any ideas how fix this? running rake 0.9.2.2 , rails 3.2.1. if required, can provide more info. when changed following value true false (in config/environments/production.rb), rid of above error config.assets.compile = true

How to retrieve multiple aggregate columns from SQL Server in a SQL View/Access Query (pref SQL View) -

i have table tblrecords , table inserted 3500 records each day. tblrecords has foreign key linking tblupload . each row identified, apart generic id column, ref (ie: xydg74g) , foreign key column (ie: 345) links tblupload . the circa 3500 rows uploaded each day same rows uploaded previous day (with updates) additional, new entries last 24 hrs. each tblrecord row can flagged (bit column) misscustname , misscustnamefixed . view tblrecord rows tblupload , “show me (3500+) records uploaded today”. want, along actual columns in tblrecord see 2 columns, countofprevmisscustname , countofprevmisscustnamefixed id - ref - custname - countofprevmisscustname- countofprevmisscustnameok 1 - aasd001 - <null> - 14 - 12 2 - zrfg789 - joe bloggs - 10 - 8 3 - yerf777 - mary blyge - 0 - 0 missing customer name counts total records (historical) transaction missing customer name flagged true. `missnamefixed same. record 1 has had 14 missing customer name flags , 12 missna...

C++ - SDL: Limiting framerate issue -

although following code power saving, fps not capped properly. when supposed lock framerate @ 60 fps, 82. same 30, 49 fps. calculating fps: previoustime = currenttime; currenttime = sdl_getticks(); fps_++; if (currenttime - lastoutput >= 1000) { lastoutput = currenttime; fps = fps_; // variable 'fps' displayed fps_ = 0; } limiting fps: if (currenttime - previoustime < 1000 / maxfps) { sdl_delay(1000 / maxfps - currenttime + previoustime); } what did mess up? i'm defo not expert, can try this! sdl_delay(1000 / maxfps - sdl_getticks() + previoustime); using newly calculated current time might help