Posts

Showing posts from July, 2011

TileMill MBUtil: Tiles not loading in Openlayers -

i've exported mbtile file using mbutil wasn't generating png tiles when i'm creating overlay map using openlayers. missing? could clarify question? tilemill not generating tiles correctly (is crashing? stalling? other signs of errors?), or completing mbtiles export , problem getting layer onto page? given code posted, should check see http://localhost:8888/1.0.0/firstproject/0/0/0.png (or higher-number tile if didn't render zoom level zero) present. if you've used mbutil export tiles, it's don't have 1.0.0 part of url around - necessary tms layer work. make directory called 1.0.0 , move firstproject if that's case.

Wordpress - Multisite network and domain mapping plugin questions -

i'm open suggestions this: i've created cms on wordpress platform use of various plugins , own tweaks plan roll out several of our customers on different domains different purposes. i want run these different wordpress sites off cms if update plugins/wordpress on 1 update across board. ensure we're not running several sites several different versions of plugins or indeed different version of wordpress. how can go setting up? each client have different needs (in terms of plugins) how can manage this? please bare in mind i'm not great @ databases etc go easy on me! update: it seems wordpress multi site domain plugin way go few questions in regards that: using wordpress network along wordpress mu domain mapping plugin, impact have on seo each site? i'm guessing there 1 central place upgrade both wordpress , plugins across domains? still allow me choose different settings each domain on plugins? i.e using advanced custom fields plugin, able create ...

Getting OutOfMemory exception while working with 8900 blackberry -

i have develop 1 application on blackberry. working fine on 8520 , 9000 when test on 8900. giving out of memory exception in time. got following message on jde's debug outofmemoryerror no detail message net_rim_cldc-6(4a0cb600) bitmap <init> 0x8822 net_rim_cldc-6(4a0cb600) bitmap <init> 0x84a5 net_rim_cldc-7(4a0cb600) pngencodedimage getbitmapimpl 0x39bd net_rim_cldc-7(4a0cb600) encodedimage getbitmap 0x10f6 net_rim_cldc-7(4a0cb600) encodedimage getbitmap 0x10ce triton-5(4da2e09e) utility resizealert 0x7f9d triton-1(4da2e09e) alertscreen paintbackground 0x938 net_rim_cldc-8(4a0cb600) field applytheme 0x1071 net_rim_cldc-8(4a0cb600) field paintself 0x26f0 net_rim_cldc-8(4a0cb600) manager paintself 0x9230 net_rim_cldc-9(4a0cb600) screen dopaint0 0x41d3 net_rim_cldc-9(4a0cb600) uiengineimpl <private> 0xb576 net_rim_cldc-9(4a0cb600) uiengineimpl dopainting 0x93ab net_rim_cldc-9(4a0cb600) uiengineimpl pushmoda...

html - how to measure page speed with javascript and cookies included without browser and tools like yslow/firebug -

i'd measure page speed of 1 of projects in terminal or html comment rendered @ bottom of page results i'm getting firebug in "network" tab. if there way available i'd automate , ability monitor nagio or that. have practice? thank you! check httpunit, htmlunit, selenium.... all of can jar , execute nagios plugin - , they're pretty high level. you use wget/ab and/or curl, they're @ grabbing monolithic pages (ie no css, etc).

objective c - Is there anyway to load a bunch of images from Resources? -

hey guys, im getting little problem here. getting level 1 warning debug . so, think best solution loading every images of resource, prevent crash app doing. so, whats best way it? thanks! there several strategies reduce memory usage if you're working lots of images. warning you're getting doesn't mean main memory running out, running low on video ram. reduce image size before adding them project, both scaling them down and/or compressing image data. load images need @ particular time - avoid trying keep images in memory. load images using (uiimage)imagewithcontentsoffile: rather (uiimage)imagenamed: (the latter reads caches images immediately, former more "lazy"). be aggressive in 'release'ing images - don't wait autorelease kick in, send [image release]; simplify other aspects of code use video ram (e.g. remove layer transparency, remove views aren't visible, etc.)

Jquery get id of textbox that has had enter pressed? -

i have multiple text boxes ids manual_input_1, manual_input_2, manual_input_3. want stop form submiting when enter pressed in textboxes. the code below know whole id of textbox pressing enter can box's value. e.g. manual_input_2 pressed enter, value = 1234. $('[id^="manual_input_"]').keydown(function(e) { if(e.which == 13) { e.preventdefault(); var id = ?; <--- id of textbox pressed enter var value = ?; <--- value of textbox pressed enter alert('enter pressed '+id+'\n'+ 'value = '+value; ) return false; } }); can done? examples helpful. thanks you can "id" with var id = this.id; and value with var value = this.value; the jquery event dispatch layer ensures this refers affected element when handler called.

Is it possible to import a native method in .NET (using the P/Invoke), so that the interop throws Win32Exception automatically? -

numerous win32 methods use setlasterror indicate error. in .net use such method so: if (!somenativeboolmethod(...)) { throw new win32exception(); } or var res = somenativeintmethod(...); if (res != 0) { throw new win32exception(res); } i wondering if .net interop infrastructure can me. in case, import somenativeboolmethod , somenativeintmethod void methods. (for somenativeintmethod should optional, depending whether wish able see positive return codes or not). is possible? thanks. it sounds you're looking feature similar com interop feature whereby hresult signatures translated exception throwing methods. if i'm sorry feature doesn't exist. very due many many different ways win32 apis report failures. there no universal convention. unlike com there universal convention returning hresult. the best bet introduce helper function wraps pinvoke calls , check error code , throws appropriately.

How to store each row of the csv file to array in php -

i have data in csv file follows. mr,vinay,h s,application engineer,vinay.hs@springpeople.com,99005809800,yes mr,mahammad,hussain,application engineer,vinay.hs@springpeople.com,99005809800,yes i want store each row in each array.explain me how assuming csv file (if not, make csv match $csv , file broken down in separate lines), here simple way: $csv = file('mycsv.csv'); $result = array(); //iterate lines foreach ($csv $line) // i'd recommend more robust "csv-following" method though (fgetcsv maybe) $result[] = explode(',',$result); //show results print_r($result); though fgetcsv safer bet (as others have mentioned) (see docs). to further extend comment: //iterate lines foreach ($csv $line) // i'd recommend more robust "csv-following" method though (fgetcsv maybe) $result[] = explode(',',$result); can become: //iterate lines foreach ($csv $line) // combine current results new results $resu...

c# 4.0 - Find UK PostCodes closest to other UK Post Codes by matching the Post Code String -

here question has me awake number of days now. conclusion came far red bull not coders. i have scenario in application have couple of jobs (1 50). job has address , have following properties of address: postcode, latitude, , longitude. i have table of workers , have addresses. while jobs or workers created through screens, use google map queries make sure provided postcode valid , in uk addresses verified. i using scheduler control display workers on y-axis , timeline on x-axis. every job has date , can move vertically on scheduler on job’s date. user selects number of jobs , displayed in basket close scheduler. user can drag , drop job against workers. manual works. my task automate user not except verifying , allotting jobs. therefore, have automate process. every worker has property called willingmaximumdistancetravel integer representing miles, worker willing travel job. now here headache: have on 1500 workers. have utility function uses newtonsoft’s json convert de...

Jquery live() click is making multiple instances of uploadify, how can I stop it from doing it -

uploadify live click , toggle creating multiple instances of upload button how can stop doing that. my code: // display sub comments form $(document).find("div[id^='subreply-']").live('click', function(){ var num = this.id.split('-')[1]; $('#subboxes-' + num).toggle(); $('#file_upload1-' + num).uploadify({ 'uploader' : 'js/uploadify.swf', 'script' : 'js/uploadify.php', 'cancelimg' : 'js/cancel.png', 'folder' : 'upload', 'auto' : true, 'multi' : false, 'oncomplete' : function(event, queueid, fileobj, response, data) { $("#commentfile-" ...

asp.net - OnTextChanged event is not firing -

i have textbox inside aspx page <ajax:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <asp:textbox id="txtcity" autopostback="true" ontextchanged="txtcity_textchanged" width="90%" runat="server" ></asp:textbox> </contenttemplate> </ajax:updatepanel> code behind: protected void txtcity_textchanged(object sender, eventargs e) { lblmessage.text = "you have typed:" + txtcity.text; ; } and lblmessage [on same aspx page] <ajax:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <asp:label id="lblmessage" runat="server" text="" ></asp:label> </contenttemplate> </ajax:updatepanel> but when typing in textbox. lblmessage not updating. how rectify this? ...

ruby on rails 3 - Best way to generate bit.ly or twitpic style ids? -

for personal project i'm working on, i'd generate ids objects on website in same style sites bit.ly , twitpic. sending users example.com/4gwv9k let me item id 9gwv9k . question of auto-incrementing on base-36 scheme or there underlying, non-incrementing magic going on? this being done in rails, gem support welcome well. here's example on did in sinatra. https://github.com/chrisledet/shorty_url

How to Close a program using python? -

is there way python can close windows application? know how start app, need know how close one. # have used os comands while # program try close firefox window every ten secounds import os import time # creating forever loop while 1 : os.system("taskkill /f /im firefox.exe") time.sleep(10)

byte array to short array and back again in java -

i'm having issues taking audio data stored in byte array, converting big-endian short array, encoding it, changing byte array. here have. original audio data stored in audiobytes2. using same format decode minus on cos function instead. unfortunately, changing byte , short data types non-negotiable. short[] audiodata = null; int nlengthinsamples = audiobytes2.length / 2; audiodata = new short[nlengthinsamples]; (int = 0; < nlengthinsamples; i++) { short msb = (short) audiobytes2[2*i+1]; short lsb = (short) audiobytes2[2*i]; audiodata[i] = (short) (msb << 8 | (255 & lsb)); } int = 0; while (i < audiodata.length) { audiodata[i] = (short)(audiodata[i] + (short)5*math.cos(2*math.pi*i/(((number)encodebox.getvalue()).intvalue()))); i++; } short x = 0; = 0; while (i < audiodata.length) { x = audiodata[i]; audiobytes2[2*i+1] = (byte)(x >>> 0); audiob...

c# - Create images with Different format with Text -

Image
i want create images @ runtime different format , color, here sample images want create , text in it.. i write text format , particular format created please give me clue, solve. here running example thanks everything need should available in system.drawing namespace some example projects on codeproject create dynamic images in asp.net - codeproject another dynamic asp.net text image - codeproject aforge.net , imagemagick.net 2 other image manipulation open-source libraries additional bells , whistles

java - elements of arraylist duplicated -

i have created arraylist , added elements (string array) in while loop. use following add elements: templist.add(recordarray); //- recordarray string[] //arraylist<string[]> templist = new arraylist<string[]>();// declared in activity before oncreate method if check array within while loop using following code: astringarray = templist.get(index); log.i(tag,"astringarray[0] = " + astringarray[3]); index++; i correct string each of 3 array elements added arraylist. the problem when try using same code outside of while loop, same string displayed each of 3 iterations. so sum up, in while loop following: 1st iteration - astringarray[3] - displays "100350 2nd iteration - astringarray[3] - displays "100750 3rd iteration - astringarray[3] - displays "100800 outside of while loop following: 1st iteration - astringarray[3] - displays "100800 2nd iteration - astringarray[3] - displays "100800 3rd iteration - astringarray...

c++ - template syntax for containers -

this have now: template<template<typename t> class container, typename t> inline bool contains( const container<t> &cont, const t &element ) { if( cont.size() == 0 ) return false; return( std::find(cont.begin(), cont.end(), element) != cont.end() ); } an i'd call so: std::vector<string> stringvector; contains( stringvector, "somestring" ); i believe should possible, i've tried throws different error. appreciated. thanks! update: answers already, looking far, i'm still having problems: template<class container_type, typename t> inline bool contains(const container_type& c, const t& e) { return !(c.size() && std::find(c.begin(),c.end(),e)!=c.end()); } int main(int argc, char *argv[]) { vector<string> stringvector; stringvector.push_back("hello"); cout << contains( stringvector, string("hello") ); return 0; } fails compile, wit...

syntax - Transients in Java -

i looking @ joptionpane.java. on line 387 there transient protected object and on line 399 there protected transient object . what difference between two? none. poor coding standards. on code try use 2nd one.

VIM spelling function -

i wan't have function turns spell check on go's next misspelled word , replaces first suggestion heres i've got far: function! spell_new_word() set spell=true exe ']s' exe '1z=' set spell=false endfunction but seems set spelling true , doesn't anything.... doing wrong? update: i've tired changing exe normal, still no luck: function! spell_new_word() set spell! normal ']s' normal '1z=' set spell! endfunction update 2: i've tired , still doesn't work: function! spell_new_word() set spell normal ]s normal 1z= set nospell endfunction but don't think problem think thats not binding ,d : let mapleader = "," namp ,d spell_next_word() nnoremap ,d :call spell_next_word()^m things note: choose mode (normal mode, no remapping) include : enter command mode call function execute it! ^m normally entered c-v enter on linux, or c-q enter on windows additio...

c - How to calculate FPS in OpenGL? -

void calculateframerate() { static float framespersecond = 0.0f; // store our fps static float lasttime = 0.0f; // hold time last frame float currenttime = gettickcount() * 0.001f; ++framespersecond; if( currenttime - lasttime > 1.0f ) { lasttime = currenttime; if(show_fps == 1) fprintf(stderr, "\ncurrent frames per second: %d\n\n", (int)framespersecond); framespersecond = 0; } } should call function in void play(void) or void display(void) ? or not make difference? you should put in display loop. here's article explains intricacies of game loops should read.

php - How to create a thumbnails page in WordPress -

i'm creating wordpress photoblog theme , want create thumbnails page sits between index.php , single.php. the idea when clicks on blog post, go thumbnails page see photos attached post , click on individual image redirected blog entry. wp templating support this? wordpress loads files inside of theme's directory, aren't limited wp much. if want, why not make index.php file have section runs when receives $_get variable denoting user has requested thumbnails page? this sort of mean: single.php: <?php if (isset($_get['gallery'])) { // show gallery. } else { // show main content instead } ?> and on index.php , add gallery parameter urls: <a href="single.php?gallery=1&foo=bar">title of article</a> but that's way i'd it.

python - Using components in Javascript -

i'm relatively new javascript. wondering if supports components , objects python does. if does, syntax like? for instance, know object this: function foo(a, b) { this.a = a; this.b = b; } now, there way declare components, pick 1 of those, , add object? instance, let's have object item. declare different components, such weapon, magical, legendary, etc. , them add them object? using approach end magical weapon, or legendary item, or legendary magical weapon. i thought using parenting want do, seems rather limited. instance, heirarchy item/weapon or item/legendary, couldn't have legendary weapon. so, components possible in javascript? what describe 'component' more commonly called class. describe 'parenting' more commonly called inheritance. spot on class hierarchy :) ok, base class in item . item have basic attributes items in game world must have. objects in game world inherit item. a weapon item. magicalitem item. legen...

php - javascript issue -

how can add variables code above? need pass these 2 variables. tried code doesn't work expect (alerts doesn't working alterations). name: $('#name').val(), email: $('#email').val() <script type="text/javascript"> jquery(document).ready(function() { $.ajax("valid.php", { type: "post", datatype: "json", name: $('#name').val(), //here?? email: $('#email').val() //here?? success: function(step) { if (step.first) { alert("fdsgdfg"); } if (step.second) { alert("dfgdfg"); } } }); }); </script> thanks! add part ajax call called "data". <script type="text/javascript"> jquery(document).ready(function() { $.ajax("vali...

ios4 - UISegmentedControl from AppDelegate -

i have uisegmentedcontrol need access selected segment in app delegate. have tried wire ibaction of value changed app delegate crashes. need current selected state when changed. please refer following link http://derekneely.com/2009/11/iphone-development-global-variables/ keep common object , store value in can in delegate function.

javascript using global variables -

can't seem work. var current_times = new date(); var future_times = new date(); function time(){ current_times = current_times.setminutes(current_times.getminutes()); future_times = future_times.setminutes(future_times.getminutes() + 1); } error im getting is: current_times.getminutes not function note sure helps, time function called function initiated on body load. the problem setminutes returns number, not date object. the function work first time call it, on second call current_times , future_times numbers, , hence won't have getminutes function. since setminutes() modifies date object instead of producing new one, solution not reassign variables. furthermore, if understand intentions correctly, code can simplified to: var current_times, future_times = new date(); function time() { current_times = new date(); future_times.setminutes(current_times.getminutes() + 1); }

xcode4 - Graphical Predicate Builder in Xcode 4 with Core Data -

Image
i using xcode 4, , can't find way work graphical predicate builder. still there? how use it? documentation on this? thanks in xcode 4, highlight model, then: choose editor -> add fetch request then highlight (rename if like). predicate builder in right pane:

c# - Using AttachConsole, while the process I've attached with is running and spewing, I can still type and run other commands -

using attachconsole, while process i've attached running , spewing, can still type , run other commands. my program runs in either form, or command line. if started arguments runs in command window. use attachconsole(-1) attach process command window called from. works great, output spew process. however, console still processes user input keyboard, whatever type, instance, if type 'cls' , hit enter, output wiped. how can block user input console while process running? this may not elegant based on doing, kill() on console after attaching , continue output other process. example windows forms code below, add own bells , whistles: using system; using system.diagnostics; using system.runtime.interopservices; using system.windows.forms; namespace windowsformsapplication1 { internal static class program { [dllimport("kernel32", setlasterror = true)] private static extern bool attachconsole(int dwprocessid); [dllimport("user...

asp.net mvc 2 - Redirect action to mobile view -

public actionresult home() { return view(); } this have current site within homecontroller. how can detect if action called mobile device, , if is, re-direct mobilehome.aspx instead of home.aspx. i don't need know details of device, because implementing view in jquery mobile, should adjust correctly depending on view it's rendered in. you may find following blog post useful.

Helios Eclipse java debugger on Windows is very slow to highlight source code -

Image
i have eclipse helios sr1 installed on windows xp. writing/debugging java code using jdk 1.6. when debug , hit breakpoint, eclipse fast show me stacktrace. (see #1 in attached image.) however, source code line highlight (light green, see #2 in attached image) slow appear. oddly, when first installed eclipse, fast. slow. takes 15 seconds highlight light green. any ideas wrong eclipse install/config? fyi: fast processor + 4gb of ram. plenty of disk space. have tried "hello, world" test java project. few lines of code... still same issue when hitting vanilla breakpoint. according running-a-program-in-debug-mode-is-incredible-slow succeeded running eclipse -clean (test before setup new workspace)

iphone - How do you change the size of the components in a uipicker -

i have picker returning 3 components. told can change size of views doing following, not sure how implement this... implementing uipickerviewdelegate method pickerview:widthforcomponent: method size components (probably 150, 20, , 150, or so). i see in documentation set method this, dont know next? - (cgfloat)pickerview:(uipickerview *)pickerview widthforcomponent:(nsinteger)component { } for using have implement uipickerviewdelegate ...... , assign pickerview ..... if method being written in same class creating pickerview ...... write..... pickerview.delegate = self; and in header implement delegate... - (cgfloat)pickerview:(uipickerview *)pickerview widthforcomponent:(nsinteger)component { if(component == 0) return 150.0; else if(component == 1) return 20.0; else if(component == 2) return 150.0; else return 150.0; } components numbered left-to-right. thanks,

iphone - How to get array from FBGraph htmlResponse -

i want access array of friends facebook.so using fbgraph , string by line nsstring *str=(nsstring *)fb_graph_response.htmlresponse; so response is getmefriendsbuttonpressed: {"data":[{"name":"r.b. narain","id":"1452788"},{"name":"jon doe","id":"6564709"}]} now wanna array of friends can do. it json response...... need json parsing..... this, either can write own parser..... or can use exising 1 http://code.google.com/p/json-framework/ thanks.

css - Basics - When setting a div in line, float too? -

this may quick answer one: i typically use display: inline-block; set list of div s horizontally. noticed in ie7 it's no go, way around using float: left; lose relativity position, causing else afterwards push upwards if literally floating on top. how can achieve same display: inline-block; , doesn't "float" , works in ie7 , modern day goodness. thanks, try techniques in article. may more need particular application, should work: http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/

excel vba - Macro run time error -

i have peice of code filters column 0 values , returns rowcount. tried looping on different columns.this macro works small input. have excel sheet 160106 rows. want run macro on . getting run 1004 error.i found following link kind of explains problem http://support.microsoft.com/kb/210684 but not able resolve it. please me. pasting macro below my sample file in http://rapidshare.com/files/457005707/data1.xlsx 96mb file option explicit sub findrcn() dim wsstart worksheet dim sword string dim rowcount integer dim long dim j long dim l long dim k string dim final integer dim lastrow integer dim rng range dim obook workbook set wsstart = activesheet 'this loop check if sheet exists j = 1 worksheets.count k = worksheets(j).name if ucase(k) = ucase("analysis") lastrow = ((sheets("analysis").range("a" & rows.count).end(xlup).row) + 1) else lastrow = 0 end if next j msgbox "finished checking...

java - Edit several hundred Protocol Buffer serialized messages read from database -

for operation on application, need read database & edit several hundred protocol buffer serialized messages . in each pb message, there 4 int fields , 1 boolean field, , in new message the boolean field required changed. i in doubt best way accomplish this, , seeking & expert opinion. i guess building entire messages once again creating builder objects rather expensive.. the builder approach should cheap enough, if can execute near server minimise latency. however, if bit field has first/last field number, should single byte update in either 2nd or last byte, might possible in sql if like. in fact, long want skip ints (i.e. don't need know or change them), picking out bool in middle easy. but try route using existing client first; may faster think.

javascript - How put a Confirmation in Hyperlink DataGridView -

i want have confirmation before deleting records in datagridview. please check codes.. thanks. here's asp.net code: <itemtemplate><asp:hyperlink id="hlnk_delete" runat="server" style="width:100px; margin-left:50px; margin-right:100px" navigateurl='<%# "components/deletebook.aspx?sku=" + utility.skumask(eval("lbhc_lb_sku").tostring()) %>'>delete</asp:hyperlink></itemtemplate> sqldatasource: <asp:sqldatasource id="sds_publishedbooklistings" runat="server" connectionstring="<%$ connectionstrings:learningisfunconnectionstring %>" selectcommand="select dbo.lif_bookshascategory.lbhc_lc_id,dbo.lif_books.lb_sku, dbo.lif_bookshascategory.lbhc_lb_sku, dbo.lif_category.lc_category, dbo.lif_books.lb_title, &#13;&#10; dbo.lif_bookshascategory.lbhc_level&#13;&#10;from dbo.lif_bookshascategory inner join...

asp.net mvc - Data annotation is working on editing only -

here controller codes // // get: /department/create public actionresult create() { return view(new department()); } // // post: /department/create [httppost] public actionresult create(department dept) { try { dbcontext.addtodepartments(dept); dbcontext.savechanges(); return redirecttoaction("index"); } catch { return view(); } } // // get: /department/edit/5 public actionresult edit(int id) { return view(dbcontext.departments.single(d => d.deptid == id)); } // // post: /department/edit/5 [httppost] public actionresult edit(int id, formcollection collection) { var dept = dbcontext.departments.single(d => d.deptid == id); ...

java - For a shared resource accessed by two threads, how to arrange priority? -

is there way give 1 thread priority on when accessing resource? no, , speaking: makes no sense. unless both threads try ressource @ same time (very rare) priority wont help, unless th thread higher priority can "steal" ressource in use. basically can never have more 1 item waiting, use priority? 3+ threads makes logical sense, 2 without benefit.

.net - Scroll Position GUI with Silverlight -

i have text chat application developed in silverlight. app polling server every 2 seconds incoming data , thats when set scroll bar's position last message. there fishy scroll bar's position cannot understand. have hosted app here, http://bit.ly/h2yopt can please me work out scroll position. ps: please try entering message , move scroll bar. thank you. it looks if scrollbar moved down every 2 seconds. show code.

Server Error '/" Application C# asp.net -

parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: not load type 'safenet_webpage.admin.project'. source error: line 1: <%@ page language="c#" autoeventwireup="false" codebehind="project.aspx.cs" inherits="safenet_webpage.admin.project" %> line 2: line 3: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> this project.aspx locating in 1 folder other news.aspx , when load news s ok, make do, when load project this? as have viewed issue on teamviewer, button not added in form designer class have copied button , event handler page. what did add button toolbox , designer class. after refreshed , problem resolved.

iphone - Left swipe for delete and edit,delete -

i not able find way around this. possible have delete option using left swipe , using edit , delete. i have edit button on left of navigation bar. self.navigationitem.leftbarbuttonitem = self.editbuttonitem; and commiteditingstyle method below - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { //delete code here } else if (editingstyle == uitableviewcelleditingstyleinsert) { // create new instance of appropriate class, insert array, , add new row table view. } } after using this, left swipe not being detected @ all. way delete seems going edit mode , deleting there. appreciated. i newbie please go easy me :) you mean swiping on cell need delete option. if can try code: - (uitableviewcelleditingstyle)tableview:(uitableview *)atableview editingstyleforrowatindexpath:(nsindexpath...

c# 4.0 - How to use one column in two detail sections with Crystal Reports -

i need show 1 column backend in 2 detail sections based on condition in 1 detail section column value should second columns(particular) corresponding value , in other detail section except particular value. question how write 2 different formulas single field? eg: {abc} = "xyz" in 1 detail section , {abc} <> "xyz" in other detail section i don't quite understand exactly want do, recommend start making 2 new formulas (one each detail section). formulas this: if {abc} = "xyz" {somefield} and if {abc} <> "xyz" {somefield}

gcc - gets() problem in C -

i wrote following code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define size 128 int main () { char mychar , string [size]; int i; int const count =0 ; printf ("please enter string: \n\n"); fgets (string, size, stdin); printf ("please enter char find: "); mychar = getchar(); (i=0 ; (string[i] == '\0') ; i++ ) if ( string[i] == mychar ) count++; printf ("the char %c appears %d times" ,mychar ,count); return 0; } the problem gcc gives me error 'int const count': " increment of read-only variable ‘count’". what seems wrong ? thank ! try using fgets instead as: fgets (string, size, stdin); why gets unsafe, has been answered several times on so. can see this .

Django DB Design - Maintaining common and historical data -

this more database design question specific django one. we have small django app manage annual conference. there models common each year of conference. example, workshops repeat each year, , use same rooms (seminar or accommodation rooms) well. for these models, of fields common year year, whilst others vary. for example, each accomodationroom has name, building, , features common year year. however, other things actual bed availability vary year year. there requirement preserve historical data year year, want reduce redundant duplication if possible, , save having retype every year (e.g. names of rooms, sites, , features. likewise workshops) my initial approach create accomodationroom stored common data, have example bedavailability stored transient year-to-year information, , provided link each year's conference. example: class accommodationroom(models.model): name = models.charfield(max_length=50) site = models.foreignkey(site) features = models.ma...

android - succesive onPreviewFrame byte[] -

i capturing onpreviewframe in byte[] , saving compare next captured frame. although camera pointed area no change happening , can see on display there no change succesive frames element elemnet different. suggestion why should so? want grayscale , understand first height * width bytes grayscale data, correct> statistically, there cannot exact match. check out image comparison - fast algorithm way of comparing images.

java - Custom NavigationHandler cannot be cast to javax.faces.application.ConfigurableNavigationHandler -

following previous question , have question why exception being thrown if use <p:button> primefaces after registering redirectnavigationhandler in faces-config.xml. : severe: error rendering view[/tbrowse.xhtml] java.lang.classcastexception: my.package.redirectnavigationhandler cannot cast javax.faces.application.configurablenavigationhandler @ org.primefaces.component.button.buttonrenderer.findnavigationcase(buttonrenderer.java:114) @ org.primefaces.component.button.buttonrenderer.buildonclick(buttonrenderer.java:90) @ org.primefaces.component.button.buttonrenderer.encodemarkup(buttonrenderer.java:56) @ org.primefaces.component.button.buttonrenderer.encodeend(buttonrenderer.java:38) @ javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:883) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1659) @ javax.faces.render.renderer.encodechildren(renderer.java:168) @ javax.faces.compone...

python - Signal handling in Pylons -

i have pylons project need update in-memory structures periodically. should done on-demand. decided come signal handler this. user sends sigusr1 main pylons thread , handled project. this works except after handling signal, server crashes following exception: file "/usr/lib/python2.6/socketserver.py", line 264, in handle_request fd_sets = select.select([self], [], [], timeout) select.error: (4, 'interrupted system call') is possible fix this? tia. yes, possible, not easy using stock python libraries. due python translating os errors exceptions. however, eintr should cause retry of system call used. whenever start using signals in python see error sporadically. i have code fixes this (safesocket), forking python modules , adding functionality. needs added everywhere system calls used. it's possible, not easy. can use open-source code, may save years of work. ;-) the basic pattern (implemented system call decorator): # decorator make...

php - mysql rand with condition -

could me out correct syntax query please. i have, table1 : id, int on, tinyint - can 0 or 1 name, varchar(2000) from trying 10 random id / name have on set 1. what query should use? select id, name table1 `on` = 1 order rand() limit 0,10;

generics - Linq to SQL: Many to Many support class -

i'd have support class many many relationship. as see double generic class define in 1 or both of entity partial classes surrounding relationship. getting allow access other table without having mention relationship table should easy. adding or removing collection trickier. ahve add row relationship table aswell , commit or remove based on done. could done through function passed generic class? does class exists , if not can viably done? you can create imanytomanyset<tentity> interface can returned many many property , have manytomanyset<tsource, tcross, tdestination> implementation query insert , delete features. the interface may this: public interface imanytomanyset<tentity> : ienumerable<tentity> tentity : class { int count { get; } void add(tentity entity); bool remove(tentity entity); void addrange(ienumerable<tentity> collection); } and implementation might this: public class manytomanyset<ts...

android - How to disable setOnItemClickListener? -

i've defined setonitemclicklistener view object , need disable during calculations in application. how disable it? this should work: yourview.setonitemclicklistener(null);

flex - Custom ContextMenu not displaying in MX TextArea -

been tearing hair out ages trying custom contextmenu apply textarea, display default (copy, paste ect...). import mx.events.flexevent; public var nm:nativemenu = new nativemenu(); public var cm:contextmenu = new contextmenu(); protected function windowedapplication1_creationcompletehandler(event:flexevent):void { cm.clipboardmenu = true; var cmi:contextmenuitem = new contextmenuitem("ctest"); cm.additem(cmi); ta.contextmenu = cm; } given ta mx textarea in mxml i'm stumped! just put full set of code see: var cm:contextmenu = new contextmenu(); var menuitem:contextmenuitem = new contextmenuitem("check spelling"); menuitem.addeventlistener(contextmenuevent.menu_item_select, handlecontextmenuevent); mainmenu.additem(menuitem); textarea.contextmenu = mainmenu; var txt:textfield = textarea.mx_internal::gettextfield() textfield; txt.contextmenu = m...

ios - Using Core Data with many images per entity? -

i'm new core data , i'm working on first personal ios app. i have entity, lets call car , has thumbail gallery of other images associated it. data synced online service using asihttprequest , jsonkit . app doesn't need create new car 's, display them. the thumbnail around 100kb may store blob data within car entity. however i'm not sure how should store other multiple images? the images around 800kb 1mb each using storing them in core data store doesn't seem recommended. the options can think of are: store url of each photo within entity carimage , rely on asihttprequest 's cache. create folder structure , save each image it's corresponding car 's folder , keep references file path in carimage entity because data synced, there potential car 's deleted, images in folders have deleted well. can see getting out of hand pretty quickly. i appreciate advice. thanks. i'd take first option. regarding images have...

firefox - How to step 2 with iMacros loop? How to select every other href? -

i have imacros code fragment version build=7200328 recorder=fx tab t=1 url goto=http://feedburner.google.com/fb/a/myfeeds set !loop 1 tag pos={{!loop}} type=a attr=href:http://feedburner.google.com/fb/a/dashboard?id=* tag pos=1 type=a attr=txt:publicize tag pos=1 type=span attr=txt:socialize tag pos=1 type=select form=name:editfeedactionform attr=id:postfields content=$title<sp>and<sp>body wait seconds=2 tag pos=1 type=input:submit form=id:mainform attr=value:save tag pos=1 type=a attr=txt:feedburner the above script extract hrefs match http://feedburner.google.com/fb/a/dashboard?id=* rule, , try navigate further on page. however there 2 links on page same stuff , want loop odd values. 1,3,5,7 how set custom step value loop? ...and want loop odd values the imacros language descriptive language (similar html) , not contain conditional statements or fancy. so instead of using imacros loop button, use built-in javascript scripting support of imacr...

asp.net - how to do the validation of content page using jquery -

hii master page <%@ master language="c#" autoeventwireup="true" codefile="officeapps.master.cs" inherits="master1" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="stylesheet" type="text/css" href="styles/jquery-ui-1.8.1.custom.css" /> <link rel="stylesheet" type="text/css" href="styles/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" href="styles/ui.multiselect.css" /> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery-1.3.1.min.js...

iOS iPhone GKSession discovery in background -

i know system can close bonjour sockets while application suspended. ,will system allow me while application in background discover other devices not creating sockets them , perhaps store devices in list or ? use uiapplication 's method - (uibackgroundtaskidentifier)beginbackgroundtaskwithexpirationhandler:(void (^)(void))handler you can run code in background 600 seconds on ios 4.x , later versions.