Posts

Showing posts from April, 2011

sql - MSSQL: Select rows with more than 2 occurrences in another table -

basically need list of campaigntitles have more 2 occurrences in staffongrade , list campaigntitle, staffno have grade rating higher 2 workson table: campaigntitle | staffno -------------------|-------- adventure world | 11 air canada | 11 carnival cruises | 3 carnival cruises | 8 carnival cruises | 9 flight centre | 7 flight centre | 10 harveyworld travel | 4 last minute | 4 princess cruises | 3 princess cruises | 5 princess cruises | 6 princess cruises | 7 princess cruises | 11 travelscene | 10 valuetours aust | 3 virgin australia | 10 staffongrade table: grade | staffno ------|-------- 1 | 2 2 | 11 3 | 3 3 | 6 3 | 7 4 | 4 4 | 8 4 | 10 5 | 5 5 | 9 the following 2 queries achieve individual parts, need returned 1 query set of results. select campaigntitle, count (campaigntitle) [count] workson group campaigntitle having count(campaigntitle) >2 select staffno, grade ...

WPF - Alternate item template in a ListView -

in custom list view, each row composed of image , of text. every row, image should on left , every odd row, should on right. being beginner @ wpf, wonder easiest way achieve , reused of xaml written. the odd/even item templates differ fact image on 1 side or other of text. i believe can use trigger in style achieve this. can place image left aligned , in trigger change right. something similar to: <style.triggers> <trigger property="itemscontrol.alternationindex" value="1"> <!-- change image position here --> </trigger> <style.triggers> more information how use alternationindex here . edit - working sample <style targettype="listviewitem"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type listviewitem}"> <dockpanel> ...

How to convert String to Integer in iMacros? -

i trying use javascript , imacros together. trying increment loop 4 everytime, that's why using javascript below javascript code iimdisplay("start loop..."); j=4; k=2; l=73; m=72; n=1; (i = 0; < 10; i++) { iimset("firstone",j); iimset("secondone",k); iimset("thirdone",l); iimset("fourthone",m); iimset("fiveone",n); retcode = iimplay("addcommerceattributes"); j = j + 4; k = k + 1; l = l + 1; m = m + 1; n = n + 1; if (retcode < 0) { report += ": "+iimgetlasterror(); alert ( report ); } } iimdisplay("complete"); below imacro version build=7311339 tab t=1 tab closeallothers url goto=https://example.com/admin/commerce tag pos=firstone type=td form=name:bmform attr=class:list-field extract=txt tag pos=secondone type=input:radio form=name:bmform attr=value:4 extract=checked tag pos=thirdone type=input:radio...

php - Reading hyperlink URL -

how read url of hyperlink within cell using phpexcel? $url = $objphpexcel->getactivesheet()->getcell('e26')->gethyperlink()->geturl(); edit you might want test whether cell has hyperlink first $objphpexcel->getactivesheet()->getcell('e26')->hashyperlink(); edit 2 note hyperlinks not loaded when setreaddataonly(true)

ajax - Passing post parameters with jQuery.post -

i have regular anchor tag bound $.post() i'm having trouble wrapping head around best way pass along parameters. here's i've got: <a href="ajax/tag_delete.php?id=<?php echo $tag->id;?>" <!-- feels "get" , don't want have parse query string --> id="<?php echo $tag->id;?>" <!-- feels wrong, shouldn't have number id --> class="delete_tag_btn"> delete </a> <script> $('.delete_tag_btn').bind('click', function(event){ event.preventdefault(); $.post( this.href, {/* best way these */}, function(reply) { log(reply); }); }); </scirpt> any appreciated. thanks. $(this).attr('href').split('=')[1] of course, that's dependent on url having single querystring parameter. if needed, can little more fancy, solves immediate problem. edit: $(document).ready(function(){ $('.delete_t...

tree - Extjs 4 set each item an id -

so i'm working new ext following mvc patterns creating controllers listen view events fire methods. have view tree loaded admin menu , want listen 'users' controller when tree item called 'list users' clicked can show grid users. logic says have set id each tree element in order make sure i'm listening right , possible one...problem is, though send , id json on each element, never gets assigned. element ids still have 'ext-gen1091' type of element ids. any idea how do assigning unique id each of tree elements? my json looks this: {"expanded":"true","text":"users","id":"users","children":[{"text":"list users","id":"userslist".... you don't need use html ids identify record handling. extjs provides apis make easy handle operations, listen events etc on tree or other components. since, have id assigned each node in tree. can...

objective c - Remove items in a for loop without side effects? -

can remove items looping through in objective-c for loop without side effects? for example, ok? for (id item in items) { if ( [item customcheck] ) { [items removeobject:item]; // ok here? } no, you'll error if mutate array while in fast enumeration loop. make copy of array, iterate on it, , remove original. nsarray *itemscopy = [items copy]; (id item in itemscopy) { if ( [item customcheck] ) [items removeobject:item]; // ok here } [itemscopy release];

dialog - DialogBox in GWT isn't draggable or centred -

i'm new gwt programming. far have dialogbox supposed collect login , password, can if required launch dialogbox allows create new account. the first of these 2 dialogboxes appears @ top left of browser screen, , can't dragged, although part of definition of dialogbox can dragged. however, second dialogbox can dragged screen without problem. what i'd first dialogbox appear in middle of screen & draggable, both of thought happen automatically, there's not. so, things can stop dialogbox being draggable? there nothing on rootpanel yet. make difference? code fragments available if help, perhaps general outline enough pointers. thanks neil use dialogbox.center() center dialogbox in middle of screen. dialogbox default draggable. just tried out , doens't matter if rootpanel empty our not. when show dialogbox on moduleload draggable , centered. problem situated somewhere else. this example of google itself: public class dialogboxexample i...

cakephp show the records from just that id -

i have table has products. in view page want show products belong customer. customer number in url @ end /12 or /45 etc how can that. new cakephp yhanks your routes should automatically pass method value $id . if baked controllers. within method run find() method following. $customer = $this->customer->find('first', array('conditions' => array('customer.id' => $id))); it's difficult providing exact code without knowing more app. check out links , put on path.

entity framework - EF1 allow separate POCO entities -

i using entity framework 1 (we must use .net 3.5 sp1 work , co-ordinate sharepoint) , using n-tier architecture: application server (hosted in iis) - data layer entity framework - service layer (wcf) presentation server (inside sharepoint 2010 webpart) - proxy layer - presentation layer now need able share entities across domain. there option use svcutil or add web reference create our proxy classes on client side. i looking though, able define simple poco entities in separate assembly share across tiers. i know in ef4 can (and have done before) using poco entity generator. is there way in ef1 - have simple class definitions separate edmx (and decoupled)? thanks efv1 doesn't have support poco entities. way around using ef poco adapter .

builtin - How to use the read command in Bash? -

when try use read command in bash this: echo hello | read str echo $str nothing echoed, while think str should contain string hello . can please me understand behavior? the read in script command fine. however, execute in pipeline, means in subshell, therefore, variables reads not visible in parent shell. can either move rest of script in subshell, too: echo hello | { read str echo $str } or use command substitution value of variable out of subshell str=$(echo hello) echo $str or more complicated example (grabbing 2nd element of ls) str=$(ls | { read a; read a; echo $a; }) echo $str

silverlight - How to make modifable worm (shape)? -

i making silverlight program user can add worms ground. worms has modifable. can have 3 or more controlpoints user can move , edit worm. worm has have maximum , minimum length. has somekind outfit looks worm. have made pretty worm canonical spline problem max , minimum lengths , outfit. not waiting ready codes new ideas how can done. example made mspaint :) http://tinypic.com/r/bgxp3m/7 you can use pen tool in expression blend create open path bezier curves. direct selection tool can modify points give desired shape. if in storyboard, expression blend expand path data uncompressed format, can animated, named, , referenced code behind. here sample worm: <grid x:name="layoutroot" background="white"> <grid.resources> <storyboard x:name="wriggle"> <pointanimation duration="0:0:0.7" to="59.4217224121094,11.1413049697876" storyboard.targetproperty="(path.data).(pathgeometry.fi...

jquery - javascript / omniture - how to clear all properties of an object (s object) -

i'm using omniture , tracking various properties "s" variable tracking. example code i'm following calls function called s.clearvars() after each tracking event. error saying clearvars not valid function. know i'm supposed call clear tracking object? or how clear properties javascript object. don't clear entire s object, contains lot of functions listening dom events , if clear those, you'll lose lot of functionality. i'm guessing want clear of custom variables populating on page (props, evars, events, products, etc). s.clearvars function "plugin" omniture consulting wrote clears of these values you. contact omniture account manager , ask him code, may or may not give you, depending on whether wants sell consulting hours or if knows talking about, or couple of simple loops: function clearvars(){ (var i=0; < 75; i++) { s['prop'+i]=''; s['evar'+i]=''; if(i<=5) s['hi...

php - How to update multiple mysql database rows with same field names? -

i'm trying update multiple rows share same field names. the structure like: +---+-------+--------+ |id | name | value | +---+-------+--------+ | 1 | color | red | | 2 | fruit | apple | | 3 | day | friday | +---+-------+--------+ so, : $config_data = "update system_config set color = '$_post[color]', fruit = '$_post[fruit]', day = '$_post[day]'"; $success = mysql_query($config_data); ... not work. how perform query? try $config_data = "update system_config set value = '$_post[color]' name = 'color';"; $success = mysql_query($config_data); $config_data = "update system_config set value = '$_post[fruit]' name = 'fruit';"; $success = mysql_query($config_data); $config_data = "update system_config set value = '$_post[day]' name = 'day'"; $success = mysql_query($config_data); instead.it's necessary put in more queries in case

php - Youtube I.D parsing for new URL formats -

this question has been asked before , found this: reg exp youtube link but i'm looking different. i need match youtube i.d compatible possible youtube link formats. not exclusively beginning youtube.com. for example: http://www.youtube.com/watch?v=-wtimtchwui http://www.youtube.com/v/-wtimtchwui?version=3&autohide=1 http://youtu.be/-wtimtchwui http://www.youtube.com/oembed?url=http%3a//www.youtube.com/watch?v%3d-wtimtchwui&format=json http://s.ytimg.com/yt/favicon-wtimtchwui.ico http://i2.ytimg.com/vi/-wtimtchwui/hqdefault.jpg is there clever strategy can use match video i.d -wtimtchwui compatible these formats. i'm thinking character counting , matching = ? / . & characters. i had deal php class wrote few weeks ago , ended regex matches kind of strings: or without url scheme, or without subdomain, youtube.com url strings, youtu.be url strings , dealing kind of parameter sorting. can check out at github or copy , paste code ...

javascript - Developing Mobile App integrated with Facebook and Twitter using phonegap -

currently i`m planning create mobile app using jqtouch , phonegap. application using facebook , twitter integration. add new status, tweet, , seeing tweet list. possibile create pure javascript this? or need server programming php handle request , bridge mobile app , facebook or twitter.. thank you.. you should able access api standard ajax-requests since same origin policy not apply phonegap-apps. if not case not access server bridge requests fb/twitter (o: from phonegap faq: q. want create application phonegap access externally deployed web services via ajax. how can resolve issue cross-domain security policy of xmlhttprequest? a. cross-domain security policy not affect phonegap applications. since html files called webkit file:// protocol, security policy not apply. (in android,you may grant android.permission.internet app edit androidmanifest.xml) http://wiki.phonegap.com/w/page/16494770/faq

Silverlight DescriptionViewer prevent Tooltip to disappear on click -

the silverlight 4 descriptionviewer control displays description in tooltip: the syntax pretty easy: add namespace xmlns:datainput="clr-namespace:system.windows.controls;assembly=system.windows.controls.data.input" , following xaml usercontrol: <datainput:descriptionviewer description="some hints on user input etc." /> unfortunately, users click on displayed icon (since hovers default) instantly closes tooltip (the actual , information). worse, when click after hovering, tooltip won't appear @ all, user might think icon has no function @ all. i'd prevent closing tooltip on click (just close on "mouse out"), better clicking should force tooltip show (skipping usual timeout before shown). it seems harder though, since there no onclick event , mouseleftbuttondown seems not fire @ all. tried override descriptionviewer control no luck finding appropriate methods override. can help? thank you! this has nothing descrip...

Delphi throbber -

Image
what best solution show application doing something? i tried showing progress indicator, did not work. update: ------------- a progress bar works fine, isn't want. i want show throbber , web browsers use, long being updated keeps turning. cursor can in crhourglass mode. try this: animateunit unit animateunit; interface uses windows, classes; type tframeproc = procedure(const theframe: shortint) of object; tframethread = class(tthread) private { private declarations } fframeproc: tframeproc; fframevalue: shortint; procedure synchedframe(); protected { protected declarations } procedure frame(const theframe: shortint); virtual; public { public declarations } constructor create(theframeproc: tframeproc; createsuspended: boolean = false); reintroduce; virtual; end; tanimatethread = class(tframethread) private { private declarations } protected { protected declarations } procedure execute(); ...

jquery - shouldn't keep textarea data? -

i have textarea inside form : <form action="#" id="container"> <textarea id="txt" cols="100" rows="5">good bye</textarea> </form> all want replace form div : $("#container").replacewith(function() { return "<div>" + $(this).html() + "</div>"; }); that works without problem, if before use replacewith method change textarea value: $("#txt").val("hello world"); the final content textarea inside div "good bye" text, not "hello world" expected. have demo here . why happening? how can replace form div preserving textarea contents? this works: $("#txt").val("hello world"); $("#container").replacewith(function() { return $('<div />').append($(this).contents()); }); the issue come serializing html .html() . it's better work in terms of dom nodes. ...

eclipse - PyDev: Undefined variable from import: __name__ -

i use regularly __name__ property of classes in code (which works in python) pydev marking error ( undefined variable import ). i tried add __name__ bulletin imports did not remove problem. when use auto completion, pydev finds __class__ property when typing . behind class wrong. if use __class__ property anyway, pydev finds __name__ property. is there bug in pydev has mixing classes instanced objects? there workaround? thanks help. it's bug in pydev. please report in pydev sf tracker. see: http://pydev.org/about.html links.

import - InDesign Paragraph Return Character from CSV file? -

i using data merge functions of id cs4 import data have exported mysql database. although can set id remove blank lines, doesn't work purpose because later lines contain data. result, there still appears whitespace in outputted data. since using php produce csv file, question this: possible me indicate indesign paragraph return character within csv file, data can in turn imported , displayed wish. for example, have tried following examples, nothing seems work: "code","description" "12345", "hardware\ntools" "code","description" "12345","hardware \z tools" any gratefully appreciated! according this pdf , in idml can specify "forced line break" using &#x2028 , or can force "paragraph break" using <br/> . i'm not sure if you're looking may able give try. hope helps!

mysql - How to run this query inside Stored Procedure when session variables are used -

i have found query calculate medians @myvar:=0; @rownum:=0; select result.readdate, avg(total_gallons) total_gallons (select middle_rows.readdate, numerated_rows.rownum, numerated_rows.total_gallons (select if(@myvar = readdate, @rownum := @rownum + 1, @rownum := 0) rownum, @myvar := readdate readdate_alias, total_gallons _temp_total_gallons order readdate, total_gallons) numerated_rows, (select readdate, count(*) / 2 median _temp_total_gallons group readdate) middle_rows numerated_rows.rownum between ( middle_rows.median - if(median = round(median), 1, 0) - 0.5 ) , ( middle_rows.median - if(median = round(median), 0, 0.5) ) , numerated_rows.readdate_alias = middle_rows.readdate)...

android - How to remove the black space between the title bar and the first element of a LinearLayout? -

Image
i have linearlayout, wich first element imageview header, , second element gridview. it works fine, have erroneal black space of 50px (more or less) between android tittle bar , header of app, wich first element of linearlayout why got space? way find remove put line: ll.setpadding(0, -50, 0, 0); this full code: public class maingrid extends activity { private gridview mygridview; private imageadapter myimageadapter; private imageview header; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title);//turn off window's title bar this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);//fullscreen linearlayout ll = new linearlayout(this); ll.setorientation(linearlayout.vertical); ll.setgravity(gravity.center); //ll.setpadding(0, -50, 0, 0); header = new imageview(getapplicationcontext()); hea...

html - How to layout follow content using CSS? -

Image
here layout make: 'input' 70% width of screen. , 'second input' 70% width of 'input'. 'button' 30% width of 'input'. 'input' in middle of screen. how can so? thank you. do not think require special skills. basic fluid layout. example markup <div id="wrapper"> <input type="text" id="firstrow_textbox" /> <input type="text" id="secondrow_textbox" /> <input type="button" id="secondrow_button" /> </div> css #wrapper { width: 70%; } #firstrow_textbox { width: 100%; } #secondrow_textbox { width: 70%; } #secondrow_button { width: 28%; } /* due border , */ demo

javascript - Variadic curried sum function -

i need js sum function work this: sum(1)(2) = 3 sum(1)(2)(3) = 6 sum(1)(2)(3)(4) = 10 etc. i heard can't done. heard if adding + in front of sum can done. +sum(1)(2)(3)(4) . any ideas of how this? not sure if understood want, but function sum (n) { var v = function (x) { return sum (n + x); }; v.valueof = v.tostring = function () { return n; }; return v; } console.log(+sum(1)(2)(3)(4)); jsfiddle

java - Android can't access a web server? -

so i've got little script set on server says whether user log in able or not. when accessing url http:server-url/username/password/ string returned called "correct" or "incorrect". what i'm doing in android app following: httpclient httpclient = new defaulthttpclient(); string url = "http://server-url/"+usernametext+"/"+passwordhash+"/"; httppost httppost = new httppost(url); responsehandler<string> handler = new basicresponsehandler(); try { string response = httpclient.execute(httppost, handler); log.e("logged in",response); } catch (clientprotocolexception e) { log.e("clientprotocolexception",e.tostring()); } catch (ioexception e) { log.e("ioexception","error"); } i'm getting error: 04-29 14:31:15.728: error/clientpro...

r - read.csv fails to read a CSV file from google docs -

i wish use read.csv read google doc spreadsheet. i try using following code: data_url <- "http://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0agmhdtvek_sddgi2yzy2r1zesdlmzs1vyuxvblq0ree&single=true&gid=0&output=csv" read.csv(data_url) which results in following error: error in file(file, "rt") : cannot open connection i'm on windows 7. , code tried on r 2.12 , 2.13 i remember trying few months ago , worked fine. suggestion might causing or how solve it? thanks. i ran same problem , found solution in forum thread . using own public csv file: library(rcurl) tt = getform("https://spreadsheets.google.com/spreadsheet/pub", hl ="en_us", key = "0aonsf4v9idjgdhrawwrfbxdqn1zvbgx0lwvcevd0t1e", output = "csv", .opts = list(followlocation = true, verbose = true, ssl.verifypeer = false)) holidays <- read.csv(textconnection(tt))

c# - ObjectContext disposal in EF + Repository ASP.NET MVC 3 application -

so, i'm getting the objectcontext instance has been disposed , can no longer used operations require connection. error when try access objectcontext through repository in onactionexecuting actionfilterattribute . my actionfilterattribute checks existence of http cookie. if exists verifies database, refreshes it's expiration, , adds controller viewdata collection can accessed actionresult 's. if doesn't exist, redirects user login page. the filter half works because when http cookie does exist , attempts grab concrete object out of database, crashes above error message. because of number of layers in place, i'm gonna go ahead , post code of them, verifycookieattribute.cs , cookierepository.cs , repository_1.cs . lastly, although not make difference, error occurs in selectsingle method of repository_1.cs . dependency injection ninject 2.2.1.0. lazy loading enabled , either setting produces same error. anyway, i'd appreciate guidance in i...

c# - MonoTouch/MonoDevelop: when setting project to target iPhone device assemblies end up missing? -

i'm running monodevelop monotouch , trying target device (i.e. debug|iphone) when building code. when compiler throws bunch of errors referring missing assemblies. if build target simulator these errors don't show up, know have assemblies included , ide 'sees' assemblies , autocompletes namespaces in these assemblies type them out. any ideas causing it? i've tried fresh rebuilds... i updated trial version of monotouch if makes difference. here of errors (they're sort of error): /users/ahmedhakeem/documents/projects/ios/mycode/engine/util/ui/menuobj.cs(31,31): error cs0234: type or namespace name `audio' not exist in namespace `microsoft.xna.framework'. missing assembly reference? (cs0234) (engine-monotouch) /users/ahmedhakeem/documents/projects/ios/mycode/engine/util/ui/menuobj.cs(31,31): error cs0234: type or namespace name `media' not exist in namespace `microsoft.xna.framework'. missing assembly reference? (cs0234) (engine-monoto...

Error calling native library in Java from .so in tomcat -

i wrote stand alone java program (that works) calls native library created c program generating libipmi_agent.so lib, running in web-app in tomcat giving following error: native library call java.lang.reflect.invocationtargetexception sun.reflect.nativemethodaccessorimpl.invoke0(native method) ... java.lang.unsatisfiedlinkerror: org.qcri.power.util.ipmiagent.ipmi_agent_init()i org.qcri.power.util.ipmiagent.ipmi_agent_init(native method) org.qcri.power.util.ipmiagent.main(ipmiagent.java:18) ... here java class: package org.qcri.power.util; public class ipmiagent { private native int ipmi_agent_init(); private native void ipmi_agent_close(); private native int ipmi_agent_read_current_value(); static { system.loadlibrary("ipmi_agent"); } // main program public static int main(string[] args) { int i, v=0; ipmiagent ipmiagent = new ipmiagent(); ipmiagent.ipmi_agent_init(); (i = 0; < 100; i++...

Java Encryption and C# Decryption Issue -

i have dll in c# encrypts , decrypts string texts (something basic), need implement same encryption method in java, applications can encrypt data , send library. i can't modify c# code, because it's in production, java don't, please, suggestion must done @ java side. basically i'm trying implement same c# encryption method in java. here c# codes: note : passphrase, salt, etc. values referential. const string passphrase = "ihdyhz6bgqys0ff1/1s="; const string saltvalue = "0a0qvv09oxd3gsyhvra="; const string hashalgorithm = "sha1"; const int passworditerations = 3; const string initvector = "gjrlrz6ingnckbqv"; const int keysize = 256; public static string encrypt(string plaintext) { byte[] initvectorbytes = encoding.ascii.getbytes(initvector); byte[] saltvaluebytes = encoding.ascii.getbytes(saltvalue); byte[] plaintextbytes...

ruby on rails - Migrate an application from 2.3.8 to 3.1 -

any advice how migrate app rails 2.3.8 rails 3.1? should go 2.3.8 3.0 , 3.1? let me know thoughts... i'm interested in approach gemfile... , bundler. resource link welcome. thanks. i'd recommend migrating latest version of 2.3 (2.3.14) before doing anything. once on 2.3.14 should run tests , check logs warnings , fix them. once issues resolved, go ahead , try upgrading 3.1.1. think largest change 3.0 3.1 asset pipeline , can ignore while upgrading. resources, both peepcode , railscasts offer great guides doing want.

How to disable word wrapping in plain text files in Chrome -

i need chrome display plain text files long lines should not wrapped. when chrome displays plain text file (text/plain) wraps lines around. how can induce exhibit firefox-like behavior (no wrapping, show scrollbars instead)? i have tried wrap text element , works takes astonishing amount of time load, relatively short text. i've been looking @ too. closest i've found use command line , launch chrome forcing create custom user style sheet. documented here : http://code.google.com/p/chromium/issues/detail?id=2393 you can edit local style sheet , update css pre tags (which how chrome renders text/plain default) remove "word-wrap: break-word" lines not broken.

Creating a Debugging Suite in ASP.Net -

i wish create debugger suite in asp.net site i'm building. 1 of main problem's i'm having interaction between plain .cs files , .aspx.cs files. there workaround allow 2 work together? should literally code entire backend asp site .aspx extension, or of frontend?

c# - how to get only file names from the directory ,not the entire path -

i using below method file names .. but returns entire path ....now dont want entire path.. i want file names not entire path... how can file names not entire path path= c:\docs\doc\backup-23444444.zip string[] filenames = directory.getfiles(targetdirectory,"backup-*.zip"); foreach (string filename in filenames) { } would 1 pls on this..... many thanks... you use getfilename method extract filename without path: string filenamewithoutpath = path.getfilename(filename);

android - Adding text view in horizontal pager -

<framelayout android:id="@+id/frame_after_gallery" android:layout_width="fill_parent" android:layout_height="wrap_content"> <com.sb.layouts.horizontalpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/imageviewswitcher" android:layout_width="fill_parent" android:layout_height="280dp" android:gravity="center" > </com.sb.layouts.horizontalpager> <button android:id="@+id/btn_previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|left" android:layout_marginbottom="5dp" android:padding="10dp" android:background="@drawable/grayleftarrow"> </button> <button android...

ios - longitude and latitude values are both 0.000000 , why? -

i use core location longitude , latitude value of current position , have displayed label, case it's 0.000000 both longitude , latitude, because work on simulator ?? //longitude , latitude // locationmanager update location locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; locationmanager.distancefilter = kcldistancefilternone; [locationmanager startupdatinglocation]; cllocation *location = [locationmanager location]; // configure new event information location cllocationcoordinate2d coordinate = [location coordinate]; nsstring *latitude = [nsstring stringwithformat:@"%f", coordinate.latitude]; nsstring *longitude = [nsstring stringwithformat:@"%f", coordinate.longitude]; just initialization location manager doesn't fetch values. you have write this [self.locationmanager startupdatinglocation]...

php - Magento - customer_save_after always fired twice -

i using customer_save_after event in magento, , working fine apart 1 annoying thing - fired twice. there no other modules rewriting , can find no other reason happening. when through of events getting fired @ time , event definately getting fired twice. anyone explain this? i writing web service hooks , turning out quite inefficient duplicate things. i've noticed double-save behaviour too. way prevent issue observer set flag in request can checked e.g. if(mage::registry('customer_save_observer_executed')){ return $this; //this method has been executed once in request (see comment below) } ...execute arbitrary code here.... /* customer addresses seem call before_save event twice, * need set variable process once, otherwise duplicates */ mage::register('customer_save_observer_executed',true);

swt - Extending a class in java but it wont inherit properties from the superclass -

ok on program have labels (which in array , stuff) anyway want add own property inbuilt label class, anyway tried extending public class labelmod extends label but whenever try change creates new type of label instead of default in createcontents() method doesn't seem inherit original label properties , stack of errors public void createcontents() { shltictactoe = new shell(); shltictactoe.setsize(450, 300); shltictactoe.settext("tictactoe"); there 9 instances of following (g1x1, g1x2, g1x3, g2x1 etc) labelmod g1x1 = new labelmod(shltictactoe, swt.none); g1x1.addmouselistener(new mouseadapter() { @override public void mousedown(mouseevent e) { changest(0); } }); g1x1.setimage(swtresourcemanager.getimage(mainform.class, "/res/blank.png")); g1x1.setbounds(10, 10, 64, 64); and place them in array createarray(g1x1, g1x2, g1x3, g2x1, g2x2, g2x3, g3x1, g3x2,...

asp.net mvc - Version as timestamp in Fluent NHibernate / SQL Server -

using fnh w/ sql server 2008, i'm trying add version timestamp, running sqldatetime overflow error because value passed 1/1/0001 12:00:00 am. found this (also referenced here ), still experiencing problem. // entity base public abstract class entitybase { public virtual int64 id { get; set; } public virtual datetime version { get; set; } } // entity base map public abstract class entitybasemap<t> : classmap<t> t : entitybase { public entitybasemap() { id(x => x.id).generatedby.identity(); optimisticlock.version(); version(x => x.version) .customtype("timestamp"); } } the sql server data type "datetime". i'm guessing small , stupid, haven't found cause yet - missing? edit: action method actual "save" code public actionresult create() { int currmaxsortorder = session.createcriteria(typeof(section)) .setproject...

java - How can I set the image to move at the given speed? -

i have image of man moves in x-axis. want move man corresponding speed of 5 meter/s delta time in nanoseconds , problem. give me idea on how it? any appreciated... here's code : public class board extends canvas { public double meter;//pixel private final java.util.list<sprite> sprites = new arraylist<sprite>(); private final java.util.list<sprite> z_sorted_sprites = new arraylist<sprite>(); private bufferstrategy strategy; int x0_pixel; int y0_pixel; int x1_pixel; int y1_pixel; double x1_world; double y1_world; public board(double meter) { this.setignorerepaint(true); this.meter = meter; init(); addcomponentlistener(new componentadapter() { @override public void componentresized(componentevent e) { render(); } }); } public void init() { humanbeing humanbeing = new humanbeing(this, 2, 2, 0); sprites.add(humanbeing); z_sorted_sprites.add(humanbein...

Error compiling Rails 3 CSS asset on Heroku -

we're getting following error on random page loads: error compiling css asset encoding::converternotfounderror: code converter not found (us-ascii utf-16be) (in /app/app/assets/stylesheets/master.css) /app/.bundle/gems/ruby/1.9.1/gems/sass-3.1.10/lib/sass/util.rb:494 in 'encode' rails 3.1 app running on bamboo stack. i've never seen error locally. if using rails 3.1 pipeline, need switch cedar. from heroku documentation : while rails 3.1 can run on bamboo stack without asset pipeline, rails 3.1 runs best on heroku’s cedar stack. your error seems related encoding error in css file. suggest open file , check encoding utf-8.

range - How to know if a number belongs to a set in PHP? -

i'll give example, it's more straight point : i'm working coordinates , want filter coordinates not belong set around picked coordinate. here latitude instance : $latitude = 4.3999291; basically, have array of latitudes, $array_latitudes , , want test each 1 know if belong range around $latitude . what i've done far : $set = range($latitude-0.2, $latitude+0.2, 0.0000001); foreach ($array_latitudes $lat){ if (in_array($lat, $set)){ echo $lat; } } so issue is, guessed it, performance... takes long time create array of values of 10^-7 range ! my question, then, : "is there simpler , more efficient way return latitudes in $array_latitudes belong set [ $latitude -0.2, $latitude +0.2] precision of 10^-7 ?" thanks :-) could not test if (abs($lat - $latitude) <= 0.2) { echo $lat; } ?

wpf - DataGrid Does Not Shows The Row For New Items -

i'm dealing wpf datagrid. need show empty row new items when start editing new row. want because user clicks outside of datagrid without completing information of row. a solution tried commiting row changes when grid lost focus event kind of wrong because loses focus control inside itself. how commit row changes when data grid lose focus? thanks! i hope below code help. private void grdemp_celleditending(object sender, datagridcelleditendingeventargs e) { if (!ismanualeditcommit) { ismanualeditcommit = true; datagrid grid = (datagrid)sender; grid.commitedit(datagrideditingunit.row, true); ismanualeditcommit = false; } }

jquery - using qtip to replace ALL title attributes on a page -

if there way have title attributes become qtips? right i'm going through , finding tags need done slow , not reliable. instead of this $(document).ready(importantfunction); function importantfunction() { sys.application.add_load(function () { $find("ctl31").add_propertychanged(viewerpropertychanged); }); } function viewerpropertychanged(sender, e) { if (e.get_propertyname() === "isloading") { var viewer = $find("ctl31"); if (!viewer.get_isloading()) { $('table[title]').qtip(); $('td[title]').qtip(); $('input[title]').qtip(); $('a[title]').qtip(); } } }//*/ i want call once if possible. pretty easy: $('[title]').qtip();

c++ - Creating Array of Classes -

i got class such as: class me362 { public: void geometry(long double xlength); void mesh(int xnode); void properties(long double h, long double d, long double k,long double q, long double dt,long double pho,long double cp, long double tinf); void drichlet(long double tleft,long double tright); void neumann(bool tlinks, bool trechts); void updatediscretization(long double**** a,long double* b, long double* tp); void printvectortofile(long double *x); private: int xdim; long double xlength; long double tleft; long double tright; long double h; long double d; long double k; long double q; long double dt; long double cp; long double rho; long double tinf; bool tlinks; bool trechts; }; and initialize using me362 domain1; me362 domain2; me362 domain3; but want determine number of domains want initialize. need dynamic array of me362 structures. how can that? can done? thank all, emre. ...