Posts

Showing posts from January, 2012

javascript - header custom background color with mobile -

i'm new jquery mobile , want change background css of header of jquery mobile header. help? <div data-role="page"> <div data-role="header"> <h1>header</h1> </div> <div data-role="content"> </div> <div data-role="footer"> </div> to change background color of header use code this .ui-header{ background: red; } the link code demo code

scala - What do Futures and Agents in Akka offer over Clojure's counterparts? -

having watched presentation composable futures akka 2.0 , curious know additional features akka implementation of futures , agents bring on clojure's ones. "agents in akka inspired agents in clojure." first line in agent documentation on akka , clears agents part of question. far futures concerned, both same conceptually (i.e invoking operation on separate thread). underlying implementation based on java.util.concurrent , both using same underlying infrastructure. scala part: important part how composable word come play (both agents , futures). if go akka docs find can use higher-order functions map , filter etc. on akka futures, i.e. map operation on future returns future (and filter ). allows compose/chain futures , wait on final future final value. now, possible because map , filter , for comprehension etc. based on scala (monadic) api allows new type provide specific implementations of these functions. clojure part: on clojure side of things, kn

java - serialize object for unit testing -

assuming in unit test need have object of 50 fields of set values. don't want manually set fields, takes time , annoying... somehow need instance fields initialized not-null values. and had idea - if debug code, @ point working instance of object data set - , serialize disk. then put file test-resources folder, , in unit tests deserialize location. sounds feasible.. , reasonable? there other idea, or how that? upd: agree serialization not in case. 1) saved object not human readable 2) version change (highly unlikely) , not big problem believe... so, maybe there readable easy-for-serialization formats? ideally have source code generated. because java bean, getters/setters there. why not generate set of setters calls on given object in runtime? this problem has been solved: https://code.google.com/p/dummycreator/

Is it any reason why 'map' in jQuery works differently as static and instance method? -

i'm learning jquery right , surprised map method has different order same parameters in callback if it's called on jquery object or on generic iterable. if call map on jquery object, callback passed object index first , object value second: $( 'div:lt(5)' ).map( function( i, j ) { console.log( index, object ); } ); but if call map list or dict, callback arguments reversed! object goes first , index second: $.map( [ 'a', 'b', 'c' ], function( i, j ) { console.log( object, index ); } ); is architectural reason such inconsistency, or random hacking , no 1 cares? the jquery.map() function available in version 1.0, whereas .map() function added in jquery 1.2. assume 1 order chosen jquery.map() (value, index), , when .map() added in jquery 1.2 made consistent .each() - , other similar functions - which available in 1.0 , used (index, value) order. this purely speculation, though, , there may not have been decision behi

installer - Inserting Custom Action between Dialogs (InstallUISequence) in WiX -

i have 2 custom dialog boxes (plus required ones exitdlg , fatalerrordlg , etc.), first 1 sets property using edit control , second 1 shows property using text control. here meaningful code: <dialog id="dialoga" ...> <control id="controledit" type="edit" property="my_property" .../> <control id="controlnext" type="pushbutton" ...> <publish event="enddialog" value="return" /></control> </dialog> and second dialog: <dialog id="dialogb" ...> <control id="controltext" type="text" text="[my_property]" .../> <control id="controlback" type="pushbutton" ...> <publish event="enddialog" value="return" /></control> <control id="controlnext" type="pushbutton" ...> <publish event="enddialog" value="r

browser - PHP get_browser() returns strange values -

i want use: public function browsercheck() { static $browser; if(!isset($browser)){ $browser = get_browser($_server['http_user_agent'],true); } return $browser; } as suggested on http://de3.php.net/manual/de/function.get-browser.php , somehow var_dump($result); output strange values: array(30) { ["browser_name_regex"]=> string(6) "§^.*$§" ["browser_name_pattern"]=> string(1) "*" ["browser"]=> string(15) "default browser" ["version"]=> string(1) "0" ["majorver"]=> string(1) "0" ["minorver"]=> string(1) "0" ["platform"]=> string(7) "unknown" ["alpha"]=> string(0) "" ["beta"]=> string(0) "" ["win16"]=> string(0) "" ["win32"]=> string(0) "" ["win64"]=> string(0) "

php - How to login using OSCommerce customers database? -

i have website , i'm using oscommerce shoppig cart. need make user login site using oscommerce email , password. i know there function tep_validate_password($plain, $encrypted) but when tried this: require('market/catalog/includes/functions/password_funcs.php'); $x = tep_validate_password('0123272502','$p$dhxb6skb3xydesvygfvbpnq62urxpb.'); if($x == true){echo 'true';} else {echo 'false';} it returns nothing @ all. am using wrong? your encrypted password oscommerce 2.2 should 19f1a88bdf871623e92cd12d29718d01:83 not $p$dhxb6skb3xydesvygfvbpnq62urxpb. if using oscommerce 2.3.x u have define dir_ws_classes , used inside included function.

scala - How to stop play 2.0.4 throwing java.lang.NoSuchMethodError: org.sbtidea.SbtIdeaPlugin -

when running play console (2.0.4) returns: [info] loading global plugins /home/matt/.sbt/plugins [info] loading project definition /home/matt/src/app/project [error] java.lang.nosuchmethoderror: org.sbtidea.sbtideaplugin$.ideasettings()lscala/collection/seq; the exception thrown @ playcommands.scala:214 , looks known bug . the workaround doesn't seem apparent (short of upgrading). first, have temporarily disable global sbt-idea plugin. can commenting out ( // ) line: addsbtplugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0") which should exist in 1 of these files: /home/matt/.sbt/plugins/build.sbt or /home/matt/.sbt/plugins/plugins.sbt second, have remove ( rm -rf ) these directories: /home/matt/.sbt/plugins/project /home/matt/.sbt/plugins/target

iphone - Perform a segue between two UIViewControllers from third UIViewController -

i have segue between 2 uiviewcontrollers example b. in uiviewcontroller (say c), have uitableview subview , when click on 1 of rows in c, want perform segue between b. possible? i presenting c uiviewcontrollers left-side slide menu using mfsidemenu . when, trying [uiviewcontroller performseguewithidentifier:sender:] in didselectrowatindexpath , segue not performed , throwing error. please suggest. if in uiviewcontroller c, have reference uiviewcontroller *vca , can try : [vca performseguewithidentifier:@"identifier" sender:self]; i'm not sure work, it's better [uiviewcontroller performseguewithidentifier:sender:] , because can't call performseguewithidentifier: directly on class.

android - SMS scheduler not accepting multiple alarms -

i'm developing sms scheduler app. here user can set time, number , msg. code works fine if there 1 message need schedule. if want have multiple schedules, wont possible new 1 replaces old. the technique i'm using creating array of pending intents different request codes suggested other posts read, new schedule replaces old one. below code: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_zax_sms_scheduler); button dateset=(button) findviewbyid(r.id.datesetbtn); button timeset=(button) findviewbyid(r.id.timesetbtn); dateset.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { datepickerdialog.ondatesetlistener d=new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker view, int year, int monthodyear, int

html - Chrome redraw issue -

Image
i'm getting odd redraw issue in chrome: see broken right side? div single background img . html <div id="resultssortfilter> <!-- ... --> </div> css #resultssortfilter { float: left; width: 712px; height: 109px; margin: 7px 0 0 8px; background: url('../images/search_sortfilter_bg.png') no-repeat; } no issues in other browser happens on newer versions only, blocked update prevent causing issues internally. seems triggered scrolling , down before rendering finished. same issues on multiple sites has else seen this? knows what's causing or chrome intends it? chrome version 26.0.1410.64 m update the issue on windows , mac os. in fact seems worse on mac. i might have pinned down further. error on page contains lots of large images. i'm wondering if has size of data chrome has download? this appears make issue go away (not going call fix): "it might newer version of chrome not gpu.

Delphi custom component destructor -

i not sure if coding correct, please correct if wrong. have custom component image. custompic = class(tpanel) private image : timage; public constructor create(aowner: tcomponent); override; .... end; in constructor following: constructor custompic.create(aowner: tcomponent); begin image := timage.create(self); image.parent := self; addobject(image); end this works fine. however, when put custom component on form , hit alt+f12 , alt+f12 form, have image on form. should implement in destructor? offhand, don't see wrong code showed (what addobject(), though?). timage owned component freed automatically when component freed. if seeing multiple images there must multiple components being created.

r - Specifying column classes in read.csv.sql -

when reading in .csv using read.csv.sql sqldf package, possible specify column classes rather having function guess @ them contents? supposing have .csv file large read using base read.csv , column know character class contains numeric values. no positive value of nrows guaranteed catch non-numeric values , assign correct class, , nrows=-1 load entire colum vecotr r, avoiding doing reason i'm using read.csv.sql . this example sqldf home page. library(sqldf) # example example 8a - file.format attribute on file.object numstr <- as.character(1:100) df <- data.frame(a = c(numstr, "hello")) write.table(df, file = "~/tmp.csv", quote = false, sep = ",") ff <- file("~/tmp.csv") attr(ff, "file.format") <- list(colclasses = c(a = "character")) tail(sqldf("select * ff")) # example 8b - using file.format argument numstr <- as.character(1:100) df <- data.frame(a = c(numstr, "

mysql - GROUP BY grouping multiple values as the same group -

i have table similar this: id week 1 1 2 1 3 1 4 2 5 2 6 3 7 3 8 3 this current query: select count(*), `week` data group `week` here's sqlfiddle http://sqlfiddle.com/#!2/bfdb6/2/0 what need group rows every 2 weeks same count. so instead of this: count(*) week 3 1 2 2 3 3 3 4 i'd get: count(*) week 5 1 5 2 6 3 3 4 where every week has next weeks count added it. question amended: i should have been clear needed. rather grouping weeks 1 , 3, need grouping every 2 weeks . so group weeks 1 , 2, 2 , 3, 3 , 4, 4 , 5, etc automatically if possible, sql generated outside query week groupings. thanks. i think have you... first, distinct weeks available data... then, join data on either week or week +1 i applied existing sqlfiddle , appeared work. select justweeks.`week`, count(*) twowe

html - Why my CSS is not overridden? -

<style type="text/css"> .x-container img { float: left; margin-right: 15px; } .content img{ clear:both; } </style> <div class="x-container span-18"> <div class="content"> <img src="image.jpg" id="disneland-img"> </div> <h2>hello</h2> </div> i have html above. expecting clear:both in .content img override float:left of .x-container img , not. how can achieve please? float , clear 2 distinct css declarations. don't override each other. (although relating to/influencing each other of course.) if want override float:left of first class can write: .content img{ float:none; } clearing float thing, need use clear on sibling element, or put overflow:auto|hidden on parent element or apply called "clear-fix" method. .clearfix:after { content:""; display:table; clear:both; }

Storing Input buffer from COM1 into Mysql through Java -

so building rfid tracking system, consists of rfid reader , tags. have programmed tags , connected reader through rs-232 port of computer.i open hyper terminal or console serial communication. whenever tag detected id shows in hyper terminal. means fine. now achieve same in java, i.e serial communication. using javax.comm api serial communication achieved code. import java.io.*; import java.util.*; import javax.comm.*; public class simpleread implements runnable, serialporteventlistener { static commportidentifier portid; static enumeration portlist; inputstream inputstream; serialport serialport; thread readthread; public static void main(string[] args) { portlist = commportidentifier.getportidentifiers(); while (portlist.hasmoreelements()) { portid = (commportidentifier) portlist.nextelement(); if (portid.getporttype() == commportidentifier.port_serial) { if (portid.getname().equals("com1")) { // if (p

Python script for SVG to PNG conversion with Extjs -

i'm trying save chart converting svg png python script. start storing svg data in variable : var svgdata = ext.draw.engine.svgexporter.generate(chart.surface); when alert(svgdata) , can see output correct. but when send server : ext.draw.engine.imageexporter.defaulturl = "data/svg_to_png.py?svgdata="+svgdata; the svgdata has been sent looks : <?xml version= i'm new extjs, please me on one. right way send svg data python script , render png image ? this python script : import cairo import cgi import rsvg print "content-type: image/png\n\n" arguments = cgi.fieldstorage() img = cairo.imagesurface(cairo.format_argb32, 640,480) ctx = cairo.context(img) handler= rsvg.handle(none, str(arguments["svgdata"])) handler.render_cairo(ctx) img.write_to_png("svg.png") help me please! <div style="display:none;"> <iframe id="file_download_iframe" src="blank.html"></ifr

clearcase - OpenGrok: ClearCaseRepository not working (missing binaries?) -

when starting catalina run, following warning: warning: clearcaserepository not working (missing binaries?): any idea, anyone? thanks, avi this similar this thread (i adapt following extract case): as far can see code, warning can happen if command "git --help" [in case cleartool -version] exits non-zero exit code. what see if log in tomcat user, set path in startup.sh , , execute following commands cleartool -version echo $? check logs ( catalina.out ) after adding following line tomcat's conf/logging.properties : org.opensolaris.opengrok.level=all

javascript - Joomla YJK2Slider Fx issue -

i've bought extension joomla! youjoomla , since supportforum worst thing ever created man, thought ask guys instead. the main issue have fx problem, or possibly javascript conflict. im trying add image slider k2 objects in joomla via plugin called yjk2slider. thing im supposed have install plugin, activate , should work fine. yeah, no. gets stuck on loading , renders images 0x0 pixels. when remove code console tells me conflict loads images , can scroll left right, cant use thumbnails pretty key feature. this complete js code slider... var yjk2simpleslide = new class({ implements: [options], options: { outercontainer: null, innercontainer: null, elements: null, navigation: { forward: null, back: null, container: null, elements: null, outer: null, visibleitems: 0 }, slidetype: 0, orient

jquery - How to load ISO-8859-1 content via AJAX in jQueryMobile 1.3.1 with correct character encoding? -

i have got php script (cms) generates iso-8859-1 content (in background there database latin1 data). visualize data on mobile devices use jquery mobile 1.3.1. in general there no problem character encoding if use correct meta tag in html: <meta charset="iso-8859-1" /> however jquery mobile has got default setting: $.mobile.ajaxenabled = true; so jquery mobile automatically handle link clicks , form submissions through ajax, when possible. this smart feature, destroys special characters german umlaute , nasty characters: � the problem jquery mobile 1.3.1 uses on default utf-8 on ajax requests. there different solutions solve problem: disable ajax specific links, redirect content special characters: data-ajax="false" turn off ajax preloading feature: $.mobile.ajaxenabled = false; follow recommendation , manually set correct content type , override mime type: $.ajaxsetup({ contenttype: 'application/x-www-form-urlencoded; c

internet explorer - IE10 extjs compatibility app view issue -

i have application write in extjs2.3, , when test ie10 can see several issue, node don't expand, form don't rendering etc...with ie9 or in other browser mode compatibile view rendering well.. i use solution find google use <!docktype html> or <meta http-equiv="x-ua-compatible" content="ie=edge"> i start porting app new version of extjs need find solution change have compatibility view. any type of usefull. re-edit: know put in first line after declare <meta http-equiv="x-ua-compatible" content="ie=emulateie8" > , going well. if have solution say..

transformation - How to link two scene nodes in Ogre? -

i know it's unusual way search kind of feature, is possible set automatic transformations link 1 scenenode other ? for example, if link scenenode scenenode b, , if apply translation on scenenode a, scenenode b has receive same translation. if scenenode b child of scenenode a. it's not. ? the general idea this: ::ogre::scenenode* childscenenode = parentnode.createchildscenenode() then child scene node inherits transformations parent. move parent , child moves too.

clojure - How to add multiple licenses to project.clj? -

how add more 1 license leiningen's project.clj (my project dually licensed)? i know overdue, summary benefit of readers. bug appears fixed, see https://github.com/technomancy/leiningen/issues/1166 the following project.clj works me on leiningen 2.2.0 on java 1.7.0_09 java hotspot(tm) 64-bit server vm: (defproject justatest "0.1.0-snapshot" :description "fixme: write description" :url "http://example.com/fixme" :licenses [{:name "eclipse public license" :url "http://www.eclipse.org/legal/epl-v10.html"} {:name "example license" :url "http://example.com"}] ...

sql - Cannot a select query fields in Report Builder 3.0 -

the following query have entered in report builder dataset. however, can see variables first select * #temp , not variables second select statement. reporting services ever expects , can handle 1 resultset populate dataset - accept first resultset returned query , discard else. some options can think of: use 2 datasets separate queries. use 1 detail dataset , apply required aggregation @ report level. use union all or similar coalesce 2 resultsets @ query level.

java - How to post multiple types of parameter together in Apache HttpPost -

i facing weird issue code. using org.apache.http.entity.mime.multipartentity class submit file entity server can upload file. when trying add entity/parameter, value not been able capture through httpservletrequest . below client side working code sending successful file upload request: public class testclass { public static void main(string args[]) throws configurationexception, parseexception, clientprotocolexception, ioexception { httpclient client = new defaulthttpclient(); client.getparams().setparameter(coreprotocolpnames.protocol_version, httpversion.http_1_1); httppost post = new httppost("http://localhost:9090/hostimages/imageuploaderservlet"); multipartentity entity = new multipartentity( httpmultipartmode.browser_compatible ); entity.addpart( "file", new filebody(new file("d:/tempimage/cat_image.jpg") )); post.setentity(entity); string response = entityutils.tostri

android - DialogFragment doesn't pan with SOFT_INPUT_ADJUST_PAN -

i have dialogfragment has content in including edittext field. unfortunately when click on edittext field, softkeyboard covers dismiss button dialog. problem resolved using getdialog().getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_adjust_resize); unfortunately, when this, dialog shrinks , other items in covered. tried using soft_input_adjust_pan instead, containing activity adjusted in case, dialogfragment didn't move , dismiss buttons still covered. there way can make dialogfragment pan? my relevant dialogfragment code looks this: @override public void onviewcreated(view view, bundle savedinstancestate) { super.onviewcreated(view, savedinstancestate); getdialog().getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_adjust_pan); mcontactsupportview.findviewbyid(r.id.compose_message).clearfocus(); } dialog layout attr. should match_parent. when open keyboard open strech dialog layout. such sams

LINQ to SQL relationships using compact edition -

i'm having problem trying use linq sql create relationship between 2 database entities. i've been following this basic microsoft guide without getting work. i'm trying store tree-like structure. configunit class contains information category of items , stores tree name root node. storeitem contains information each node in tree. [table(name = "configunit")] public class configunit { [column(isprimarykey = true, isdbgenerated = true)] public int cuid; ... private entityset<storeitem> _rootnode; [association(storage = "_rootnode", thiskey = "cuid", otherkey = "cuid")] public entityset<storeitem> rootnode { { return _rootnode; } set { _rootnode = value; } } } and storeitem class: [table(name = "storeitem")] public class storeitem { [column(isprimarykey = true, isdbgenerated = true)] public

Objective-C access to counter from another class -

i´m new objective-c , have question. don´t understand mistake. the time counter tells me value 0. i have game class, counter. after while when game stops screen switch end class. , in end class want print out score. not work. game.h @interface game : cclayer { int counter; } @property (readwrite, nonatomic) int counter; +(int)returncounter; @end game.m @implementation game @synthesize counter; -(void)methodformycounter{ counter++; } +(int)returncounter{ return counter; } end.h end.m @implementation -(void)getcounter{ //here want print out counter } the counter property of instance of game class, either need able access instance, or move counter location accessible both game , end objects. latter. move counter app delegate , @synthesize it. can use anywhere want: appdelegate *appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate]; int countervalue = [appdelegate counter];

java - Changing the colour of slider ticks -

Image
i'm attempting change colour of ticks slider in javafx 2.2, coming bit short - can't find css properties on slider claim this, , can't find methods on slider seem either (there seems property formatting tick labels, not marks themselves.) is there way, or stuck drawing myself? use style description ticks , blue color : .slider .axis .axis-tick-mark, .slider .axis .axis-minor-tick-mark { -fx-fill: null; -fx-stroke: blue; } the first - major, second - minor.

vb.net - Obtaining Databases from SQL Server 2008 using vb in VS 2012 -

i new asp.net have knowledge vb. building web application in visual studio 2012 using vb. have drop down list populated 2 2008 sql servers. there dropdown need populated list of available databases on selected server. have button once clicked , server selected query , pull list of databases i have specified server name in globalvariables class , imported form using. i thinking need if statement need say, if server1 selected open connection , perform query on databases. here code have throwing overload resolution failed because no accesible 'open' accepts number of arguments error: protected sub getdb_click(sender object, e eventargs) handles getdb.click dim objconnection oledbconnection objconnection = createobject("oledbconnection") if dropdownlist1.text = globalvariables.servername1 objconnection.open("provider=sqloledb; data source=" & "globalvariables.servername1" & ";" & _

c++ - unresolved inclusion with any include files -

Image
i'm getting error running hello world program using eclipse. have installed mingw , cygwin, know need 1 have other editor uses 1 not other. have checked paths , symbols under gcc c++ compiler, links directories contain include files. however, still getting unresolved inclusion error on include files. i'm using windows 7. code: #include <iostream> #include <strings> using namespace std; int main() { string yourname; cout << "enter name: "; cin >> yourname; cout << "hello " << yourname << endl; return 0; } this detailed error description resource path location type symbol 'cin' not resolved test.c /hello_world/src line 17 semantic error symbol 'cout' not resolved test.c /hello_world/src line 16 semantic error symbol 'cout' not resolved test.c /hello_world/src line 18 semantic error symbol 'endl' not r

javascript - Angular js, call module controller's method in the directive, which doesn't see it's scope by default -

here issue: have specified routes in application config like: when('/url', { controller: 'controller', templateurl: 'url' }); in view have only: <div ng-view my-directive="fire()"></div> the important thing there no 'ng-controller="mycontroller"' attribute. when user loads url, controller fires , template filled model data , rendered well. then have directive must following on same page: when click, 'controller' has execute function, data , add render template/add data existing. the directive is: myappmodule.directive('mydirective', function() { return { restrict: 'a', templateurl: 'url', replace: false, link: function(scope, element, attrs) { var raw = element[0]; element.bind('click', function() { console.log('loaddata'); scope.$apply(attrs.fire); }); } }; });

Executing generated commands in bash -

i want run series of bash commands generated python script. commands of form export foo="bar" , alias foo=bar . must modify environment of current process. this works great: $(./generate_commands.py) until export command contains space e.g. export x="a b" . generates error, , "a exported (quotes included). currently i'm working around outputting generate_commands temporary file , sourcing that, there more elegant solution? ./generate_commands | bash this pipe output of script input bash edit: to allow variables visible in current shell, need source output: source <(./generate_commands) or . <(./generate_commands)

Visual Studio dropping 's' off of sql server tables -

Image
when adding in tables sql server dbml, drop 's' off of table name. 1 example: when adding table 'alias' change name 'alia'. there way prevent happening? method of adding tables: 1) connect database in server explorer tab 2) open tables folder 3) select tables , drag them open dbml window if using entity framework, , adding tables via update wizard, there checkbox says "pluralize or singularize generated object names": you can uncheck , leave table names alone. update : looks drag/dropping dbml, try link: linq sql: how stop auto generated object name being renamed?

Use Excel spreadsheet from within Access -

i have excel spreadsheet calculates risk (of perioperative mortality after aneurysm repair) based on various test results. the user inputs test results spreadsheet (into cells) , out comes set of figures (about 6 results) various models predict mortality. spreadsheet acts complex function produce results 1 patient @ time. i have (separate) access database holding data on multiple patients - including data on test results go spreadsheet. @ moment have manually input data spreadsheet, results out , manually enter them onto database. is there way of doing automatically. ie can export data1, data2, data3... access spreadsheet cells data needs input , results (result1, result2, result3...) cells results displayed ported access. ideally done live. i suppose try program functionality of spreadheet complex function in access, if i'm honest, not sure how algorithm in spreadsheet works. designed anaesthetists cleverer me.... hope makes sense. appreciated. chris hammond

ios - how to alter NSMutableArray in an specific array -

i have nsmutablearray wich holds custom class of mkmapkit. mappoint *placeobject = [[mappoint alloc] initwithtitle:title subtitle:subtitle coordinate:loc description:description storeimage:storeimage]; [annotationarray addobject:placeobject]; my routine fills placeobject without image because load asynchronously , finished after couple of seconds. questions is: there way alter placeobject within annotationarray ? edit to display issue in better way here code parts: if (annotationarray == nil) { [self setannotationarray:[[nsmutablearray alloc] init]]; } (nsdictionary *locationdetails in parser.items) { __block nsdata *storeimagedata; dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_high, 0); dispatch_async(queue, ^{ storeimagedata = [nsdata datawithcontentsofurl:storeimageurl]; dispatch_sync(dispatch_get_main_queue(), ^{ uiimage *storeimagetmp = [uiimage imagewithdata:storeimagedata]; coun

ios - Positioning items in overlapping UIViews in xib file -

Image
let's have xib stack of uiviews on top of each other: bottom uiview(a) uibutton on , when button pressed, layer hidden , next 1 shown , put on top. the next uiview(b) contains clock counting down 5 0 , when 0 reached uiview hidden , 1 described above moved front , shown instead. so make more clear: the composition of xib: a b --z direction--> update: screenshot attached @ bottom of page. so problem: when (re)positioning button or clock using mouse in xcode tend stick wrong uiview. more objects , "stacked" uiviews greater problem. the question: there way to, layer "eye" in photoshop, isolate uiviews , work on them 1 one? observe! aware there o there ways of achieving swapping between view not issue. real problem here position button , clock in xcode wysiwyg editor least hassle. observe! -------- added clarification -------- screenshot isolate views visually when working on 1 of them, others hidden , not open interaction.

c++ - Best practice for creating a SDK for which also uses public available frameworks -

recently i'm having many issues customers using our sdk, uses exact public available framework/libraries use. issue duplicate symbols. for example, 1 reachability apple provides. solved adding compile time prefix class. however, library example openssl lib, i'm have hard time solving. when compiling sdk these public libraries, how can separate them own name spaces @ compile time? or how make separate public libraries? thanks

What does it mean when string 1 is "less than" string 2 in C? -

this question has answer here: how strcmp() work? 9 answers in documentation of strncmp(const char *s1, const char *s2, size_t n) function of xc8 compiler, read: the strncmp() function compares two, null terminated, string arguments, maximum of n characters, , returns signed integer indicate whether s1 less than, equal or greater s2 . comparison done standard collating sequence, of ascii character set. what mean when s1 less than s2 ? charcount lower, or sum of characters, or ...? function ever return 0 when stuff {'a',0x00} , {'a',0x00,0x00} inputted? could please explain clear example? it means s1 come before s2 in dictionary or directory listing sorted lexically, etc. more clear example might "aaa" less "bbb", "aab" less "abb".

php - Inserts wrong value to MySQL table -

i have dynamic list mysql table on php page html part below 10-20 times per page. if click submit-button insert stuff database player_id id of first record on page. need able click 1 in middle example , insert correct value mysql table. can point me right direction on how achieve this? thanks! html part: <input type="hidden" name="player_id" value="<?php echo $player_id;?>"> <input name="insert" type="submit" class="button" value="3"> js part: $(document).ready(function(){ $('[name=insert]').click(function(){ var player_id=$("[name=player_id]").val(); $.post('process.php', {player_id: player_id, points: 3}, function(data){ $("#message").html(data); $("#message").hide(); $("#message").fadein(1500); }); return false; }); }); php/mysql part (process.php): **connection stuff here $player_id=$_post['player_

ruby - Rails: ActionController::RoutingError No route matches error -

i have search controller (no model) running query against users table. works fine, once enter <%= link_to "good proceed now.", new_user_product_path, :class => "btn" %> it gives me actioncontroller::routingerror (no route matches {:action=>"new", :controller=>"products"}): i have relationship estbalished between user , product model. able access products#new when directly go link http://127.0.0.1:3000/users/3/products/new . again, when link_to snippet entered, gives above error. my search controller isnt tied db, helps me process front end. what doing wrong here? there need routes? here routes file resources :searches, only: [:index, :create] resources :users resources :products end you need pass user new_user_product_path . so like: new_user_product_path(@user) or new_user_product_path(current_user)

ruby on rails - Keeping track of data for analytics without hitting the database each visit -

i reading question/answer adding home-made analytics rails application. in answer, noted shouldn't hit database each view, didn't elaborate. i'm adding analytics user profiles on site. each time visits profile, i'm checking whether visitor registered , whether visitor viewing own profile (no need record that) , i'm saving ip, viewer's id (if registred) , viewer's role (my app users rolify) database, each time user's profile viewed. i can't think of straightforward way avoid saving db each time profile viewed. can explain how might it? the (admittedly ugly) code below current implementation show action of users_controller.rb @user = user.find(params[:id]) ip = request.ip if session['warden.user.user.key'][1] #checks if visitor registered visitor_id = session['warden.user.user.key'][1] #gets user id of visitor visitor_id = visitor_id[0] if @user.id != visitor_id #d

sql - Update multiple columns that start with a specific string -

i trying update bunch of columns in db testing purposes of feature. have table built hibernate of columns created embedded entity begin same name. i.e. contact_info_address_street1 , contact_info_address_street2 , etc. i trying figure out if there way affect of: update table set contact_info_address_* = null; if not, know can long way, looking way myself out in future if need on again different set of columns. there's no handy shortcut sorry. if have kind of thing lot, create function dynamically execute sql , achieve goal. create or replace function reset_cols() returns boolean $$ begin execute (select 'update table set ' || array_to_string(array( select column_name::text information_schema.columns table_name = 'table' , column_name::text 'contact_info_address_%' ),'

Easy and Fast Git rebase/reword -

i'm working alone on git repository months. i'd push commits public repository, however, i'd improve commit messages (mainly translate them english). i know can git rebase -i reword each message. open editor each message want edit , that's long me (hundreds of commits reword). i'd rather able edit messages @ once , apply modifications. i'm looking such tool allows me edit commit messages on single window , apply changes @ once in background. instance, have list of commit messages, double-click on message edit it, change another, go fix typo , when i'm done changes, apply them @ once. you can pass script rewrite commit messages filter-branch : git filter-branch -f --msg-filter "...script command here..." it should easy massage plain commit message output: git log --pretty=tformat:%b into perl, python or sed script replaces corrected version.

math - Intersection of two points in Ruby -

i want find intersection of 2 points in ruby. type of checks should there function works cases. pseudocode code is intersection(range1, range2) notcommonr1 = part of range1 not common common = common part between both ranges notcommonr2 = part of range2 not common for example intersection([0, 3], [2, 4]) == { :range1 => [[0, 2]], :both => [2, 3], :range2 => [[3, 4]] } this straightforward; there aren't special checks make here; special case if there no common part between ranges. def intersection(a, b) # sort a1 < a2, b1 < b2, a1 < b1 a, b = [a.sort, b.sort].sort a1, a2 = b1, b2 = b if a2 > b2 {range1: [[a1, b1], [b2, a2]], both: [[b1, b2]], range2: []} elsif a2 >= b1 {range1: [[a1, b1]], both: [[b1, a2]], range2: [[a2, b2]]} else {range1: [[a1, a2]], both: [], range2: [[b1, b2]]} end end depending on how use both, nil value may not ideal; use whatever indicates no common range.

php - My codeigniter image manipulation library isn't working the way i want it to work -

i have image. want size 500x250. want maintain image ratio. plan re-size , crop. code resizing image given below. $config['image_library'] = 'gd2'; $config['source_image'] = './pictures/'.$pic_name; $config['maintain_ratio'] = true; $config['width'] = 500; $this->load->library('image_lib', $config); $this->image_lib->resize(); after resizing it, size of image 500x768. trying crop it. code cropping given below. $config['image_library'] = 'gd2'; $config['source_image'] = './pictures/'.$pic_name; $config['x_axis'] = '0'; $config['y_axis'] = '0'; $config['height'] = 250; $config['width'] = 500; $this->image_lib->initialize($config); $this->image_lib->crop(); now size of image becoming 163x250. can't figure out wrong code. appreciated. in advance. i not sure image_lib think not accounting aspect ratio becom

ember.js - How to do a dynamic site menu? -

let me explain i'm trying do, basics so, app has top menu bar this is, various host of reasons, defined externally, , structure available via rest api: app.menu = ds.model.extend({ parent: ds.belongsto("app.menu"), children: ds.hasmany("app.menu"), link: ds.attr("string"), route: ds.attr("string"), title: ds.attr("string")}) i need something , run, when app starts up, app.menu.find(), , take collection, , iterate on in template, included in application template. controller didn't work view didn't work, can't seem figure out collectionviews even embedding right in application template isn't working there's no collection @ point actually, make more interesting, each menu item has many children , ideally call subtemplate each child, recursively when app loads, goes root state router. want start looking. http://emberjs.com/guides/routing/setting-up-a-controller/ you can setu

How do I append a specific header to an HttpResponse by default from an ASP.NET web service? -

i have web service many methods. clients accessing service domain (which means have put cross-domain magic in here , there). found header can add response enables cross-domain ajax calls work (this made things work me on chrome browser). to solve issue, paste this: httpcontext.current.response.appendheader("access-control-allow-origin", "*"); on every method in service. that's tedious , ugly, , wondering if knew more elegant way of having header in web service response default? i found embarrassingly simple solution. web service class, stuck line mentioned in question class constructor.

html - Modifiying Jquery to reset as browser window is to be re-size -

i have responsive layout similar divs , applying jquery divs match height of 1 more content. however, if browser window re-size divs remain same heigh when page loaded making text go out of div. there way somehow continue running jquery everytime user resize browser window? to more descriptive of i'm trying acomplish have divs behave (on browser window rezise)as normal div text content , attributes width: #%; height: auto; difference divs match height of 1 bigger height. here link of have: http://as.sjsu.edu/cf/vaishak/equalizetest/index.html here jquery have max height: <script> jquery(function(){ var maxheight = 0; $(".box").each(function(){ if ($(this).height() > maxheight) { maxheight = $(this).height(); } }); $(".box").height(maxheight); }); </script> here updated version still doesn't work when window resize. $(document).ready(function(){ $(window).resize(function(event) { resizediv(); }); $(documen

cocoa - Bolding part of a string in an NSAlert -

i'm creating mac os x app , have issues formatting strings on nsalert . want informative text formatted follows : something something something ------- something bold in middle --------- other things other things other things so far separate lines using \n statement don't know how make line in middle bold , centred. have idea? you should not this, , indeed cannot without subclassing nsalert , or creating generic window yourself. alert can given plain string, not include decoration information (you need nsattributedstring that); own bolding of text pass. what can , should have @ "alerts" in hig, , see there 2 strings can supply alert: "message text", displayed in bold font, , "informative text". make use of achieve result consistent platform guidelines , needs.

magento - Get Number of Orders per Product -

i'm trying build array of orders => products can use in reporting/updating attributes. format i'm going is: //$orders[<number of orders>] = <array of product ids many orders> $orders = array( 1 => array(1, 2, 3), 2 => array(4, 5) //etc ); so far best can is $productcollection = mage::getmodel('catalog/product') ->addattributetoselect("sku") ->getcollection(); $orders = array(); foreach ($productcollection $product) { $ordered = mage::getresourcemodel('reports/product_collection') ->addorderedqty() ->addattributetofilter('sku', $product->getsku()) ->setorder('ordered_qty', 'desc') ->getfirstitem(); $qtyordered = $ordered->getorderedqty(); $total = $this->_counter - (int)(!$ordered ? 0 : $qtyordered); if (!is_array($orders[$total])) { $orders[$total] = array(); } $orders[$total][] =

jquery - scrollTo is not a function -

ok, can't see anymore. i'm using the scrollto plugin , have scrollto function in website. worked , doesn't... this code: $(document).ready(function() { $('header').delay(300).fadein(750); $('#intro_text').delay(800).fadein(750); $("#jquery_jplayer_1").jplayer({ ready: function () { $(this).jplayer("setmedia", { m4v: "mi4.m4v", ogv: "mi4.ogv", webmv: "mi4.webm", poster: "mi4.png" }); }, swfpath: "js", supplied: "webmv, ogv, m4v", size: { width: "570px", height: "340px", cssclass: "jp-video-360p" } }); }); $(function(todemos) { $('h1').click(function() { $.scrollto('#intro', 800); }); }); $(function(todemos) { $('#contact&

php - Automatically query MySQL and output results with AJAX -

i have problem display gps coords automatically on google map. when implement map static works fine, try dynamically. means when new gps coord saved database, map should refresh automatically. i implemented in 1 .php file. show map coords user must select entry, link entry looks -> http://trackmyrun1.at/index.php?page=show_runs&data1=get&data2=1 <?php $result = mysql_query("select * fifa_gps run_id=".$_get['data2'].""); while ($line = mysql_fetch_array($result)) { $cords[] = "new google.maps.latlng(" . $line['lat'] . ", " . $line['longt'] . "),"; } $cord_start = explode("(", $cords[0]); $cord_pos_start = explode(")", $cord_start[1]); $cord_end = explode("(", $cords[count($cords)-1]); $cord_pos_end = explode(")", $cord_end[1]); echo $sys->overall_distance($_get['data2']); ?> <div