Posts

Showing posts from January, 2010

php - preg_match a hyperlink -

i looked everywhere answer, seems cannot head around preg_match functionality. want preg_match link below numbers part (the id) dynamic. link: http://video.cnbc.com/gallery/?video=3000024508 here goes have come until now: preg_match( '/^http://video.cnbc.com/gallery/?video=([0-9_-]/', $content ) but won't work. preg_match('#^http://video\.cnbc\.com/gallery/\?video=([0-9_-]+)$#', $content); regexr demo besides problems others mentioned (escaping ? , . , using # instead of / ) missing + after number group ( [0-9_-] ), means group can repeated. if need check if string includes kind of link or not, remove ^ , $ : preg_match('#http://video\.cnbc\.com/gallery/\?video=([0-9_-]+)#', $content);

Can I embed HTML into an HTML5 SVG fragment? -

html5 supports <svg> tag, allowing embed svg html. digging little deeper, can nest html inside <svg> fragment? example, i'd put css'ed <table> in part of svg graphics. i made small test , chrome12 didn't html <p> inside <svg> . there technique make work (such maybe html container tag?)? yes, <foreignobject> element, see this question examples. alternatively, if have html5 document can use css positioning , z-index make parts of html visible want laid out on top of svg. if don't need nest html inside svg fragment. give consistent behaviour across browsers in experience.

css - Whitespace is being added to an overlay in IE9, but not in Fx5 -

i'm trying overlay "search box" on google maps api v3. overlay works fine in fx5, in ie9 not work quite right. white space added ie9 between map , gray div . see difference, go to: http://www.trailheadfinder.com/trail_search/trail_map the "search box" should aligned map / sattelite / mytopo buttons. html <div id="maplayers"> select information shown: trails: <input type="checkbox" id="trailsbox" onclick="boxclick(this,'trails')" /> campgrounds: <input type="checkbox" id="campgroundsbox" onclick="boxclick(this,'campgrounds')" /> panoramio: <input type="checkbox" id="panoramiobox" /> </div> <div> <div id="mapsearchbar"> <input id="searchtextfield" type="text" size="50"> </div> <div id="map" style="width: 100%; height: 500px...

lua - LuaJIT and Rocks? -

just small question "lua newbie"...i have been using luajit , awesome, no question since luajit lua 5.1 compatible mean can use "luarocks" standard lua uses in luajit? for instance if wanted install 1 of sqlite libraries (e.g. http://luaforge.net/projects/luasqlite/ ) - how install in luajit? do available "luarocks" work out box luajit? luajit designed drop-in compatible lua stand-alone. there no reason why purely lua-based rocks shouldn't work. dll-based rocks ought work well, since luajit stand-alone dll compatible original dll.

linux - Detect if an open file/device has been replaced/deleted -

assume following situation under linux: a process continuously reading usb-serial converter device ( /dev/ttyusb0 ). device suddenly unplugged , plugged in again (or resetting reason). process continues have valid file handle /dev/ttyusb0 won't receive data device unless process re-opens device (because udev has deleted , re-created device node). is there direct way detect such situation (ie. not indirectly detecting timeout in data flow) process knows has re-open device? reliable monitor modification time of /dev/ttyusb0 using stat() ? additional details: the process opens device file using standard open() function. /dev tmpfs controlled udev . note: not want use udev rules , prefer solution implemented directly in process. if usb device hot-unplugged, operations on device begin failing -eio ; can detect , take appropriate action.

entity framework - stored procedure with EF 4.1 -

i have parameterized stored procedure executing view , return results. view showing results of join of 2 tables. need pass parameters stored procedure , call mvc3 controller action using ef 4.1 code first approach , return results. how can this. please suggest step step. thanks. i don't know part of "code first doesn't support stored procedures" people don't understand, keeps coming , shouldn't. can muddle way around (kind of), if need execute stored procedures shouldn't using code first @ point.

How to upload to FTP server in Java? -

i have following method upload_files ftp server, not receiving errors yet file not appearing on server after run. problem? public static void upload_files(string un, string pw, string ip, string dir, string fn){ ftpclient client = new ftpclient(); fileinputstream fis = null; try { client.connect(ip); client.login(un, pw); string filename = dir+"/"+fn; fis = new fileinputstream(filename); client.storefile(filename, fis); client.logout(); } catch (ioexception e) { e.printstacktrace(); } { try { if (fis != null) { fis.close(); } client.disconnect(); system.out.println("uploaded"); } catch (ioexception e) { e.printstacktrace(); } } } there number of possible issues. assumption using ftpclient 3.x apache commons-net. if using else, should indicate in question. ideas: che...

html - Characters entered from foreign users showing as? -

i'm working on site has users other countries. part english text people use special characters chinese symbols or e accent. these symbols displaying "?" when shown on site. the site has utf-8 charset declaration , sql server database field nvarchar. did test going google translate , having translate "good morning" japanese. when copied resulting kanji site , saved myself worked fine. what causing issue? i'm guessing it's because text being entered in charset not utf-8. accept-charset="utf-8" resolve issue? if not can do? if there no way fix existing bad data can prevent issue in future? sql server 7.0 , sql server 2000 use different unicode encoding (ucs-2) , not recognize utf-8 valid character data. see following knowledge base article dealign storing/retreieving utf-8 data in ms sql server database: http://support.microsoft.com/kb/232580

extjs form record didn't updating -

i have simple form - var form = new ext.widget('form', ... , want after pressing save button save form data model - currentuserrec . ext.regmodel('user', { fields: [ {name: 'usrid', type: 'int'}, .. }); var currentuserrec = new user({ .. }); var form1 = form.getform(); form1.updaterecord(currentuserrec); but nothing happens, currentuserrec empty before updaterecord call. what wrong? thank you.

Proper syntax for updating a row in Android with SQLite -

ok, have 2 android projects both running same api level. in one, update sqlite row using: db.update(database_table, updatevalues, key_rowid + "=" + rowid, null); in other using: db.update(database_table, updatevalues, field_collection_id + "=?", new string[] {collectionid}); they both work. except in second project, if change syntax match first one, (i.e. remove question mark clause , set whereargs null), returns 0 rows affected. there reason this? im thinking of sticking second syntax because apparently reduces possibility of sql injection thought throw 1 out there , see if had similar experience. also interesting documentation doesn't specify whereargs for, there: sqlitedatabase:update() when remove question mark, replacing value of collectionid ? the second syntax means sqlite can reuse same cached copy of query number of different values of rowid or collectionid , rather having different query each time it's invoked. saves lots...

iphone - Rotating UILabels from any position to upright -

i have label rotate using pieceblack.transform = cgaffinetransformmakerotation((m_pi * (180) / 180.0)); and works perfectly, except: i rotate label during game either right side or upside down. how say, " whatever angle at, go upright." i'm thinking maybe an: int previousangle = ?; pieceblack.transform = cgaffinetransformmakerotation(degreestoradian(0-previousangle)); so guess i'm asking how ask rotation angle. or, alternately, maybe there sort of pieceblack.transform = cgaffinetransformmakerotation(rotatetoupright); from remember transform relative upright position (original), 0.0f ? can pieceblack.transform = cgaffinetransformidentity

c# - Make vertical ScrollViewer invisible -

Image
i have scrollviewer control in window , hide when user cannot scroll down page. horizontal scroll viewer. here example: so here both scrollers visible because scrolling enabled: if collapse of columns of listview note how horizontal scroller disappears: now note happens vertical scroller: so far visible , that's ok because not content fits in page. let me maximize page , co-lapse group boxes content fits in page: why visible if not possible scroll? set group boxes height = 0 except last 1 , vertical scroller still shoes up? horizontal scroller disappeared when not possible scroll more. why vertical scroller not behave same way? what can make invisible when not possible scroll? make sure scrollviewer's verticalscrollbarvisibility = scrollbarvisibility.auto;

java - Android How to Save states of my listview -

is there listviewobject.saveviewstates(view) function can use? have listviews, have other listviews custom adapters, neither of these save states of view. there lot of dynamically generated content in these listviews, of course, when row goes outside of view, data reset. i understand concept behind viewholder, yet having great difficulty retroactively fitting listviews them. (nullexceptions, illegalstateexceptions) since common way of holding view pass view, wouldn't make sense listview had built in function accepted view variable? understand listview created limited memory in mind, seems negligent there wouldn't way save states built in, in contrast webview - built limited memory in mind - user can force enable/disable caching, own memory management etc. insight appreciated the whole idea of list is dynamic , can potentially long - have lots of rows invisible. therefore aim of adapter approach keep many views visible on screen , fill them data running getvi...

php - Receive "Internal Server Error" When Trying to Connect to FTP With Curl -

okay, kinda driving me nuts... keep receiving "internal server error" trying connect external ftp connection curl. can access ftp fine normally, not through curl. i'm using codeigniter wrapper, don't think cause such issue. i've tried increasing memory/timeout, still can't in. 500 internal server error on page; can't figure out if curl returning anything, know normal error through curl (not internal server error) if disable 'username' or trying add 'password' (there no password ftp login). here main scripts: function ftpscrape() { parent::controller(); $this->load->model("curl_m"); } function index() { ini_set('memory_limit', '70000000m'); set_time_limit(0); define('cookies_dir', 'cookies'); define('random', cookies_dir . '/' . md5(uniqid(mt_rand(), true))); $this->curl_m->init(true, random . '.txt'); $this->curl_m-...

css - Use CSS3 transitions with gradient backgrounds -

i'm trying transition on hover css on thumbnail on hover, background gradient fades in. transition isn't working, if change rgba() value, works fine. gradients not supported? tried using image too, won't transition image either. i know it's possible, in post did it, can't figure out how exactly. help> here's css work with: #container div { -webkit-transition: background 0.2s linear; -moz-transition: background 0.2s linear; -o-transition: background 0.2s linear; transition: background 0.2s linear; position:absolute; width:200px; height:150px;border: 1px #000 solid; margin:30px;z-index:2 } #container div a:hover { background:-webkit-gradient(radial, 100 75, 100, 100 75, 0, from(rgba(0,0,0,.7)), to(rgba(0,0,0,.4))) } gradients don't support transitions yet (although current spec says should support gradient gradient transitions via interpolation.). if want fade-in effect background gradient, have set opacity on container...

mysql - Excluding everything above denormalized date in query -

i denormalized data (so date split in year, month, day , hour column) wonder how query before date. this not work: select * `impression_stat_hour` doneforday =0 , ( year <=2011 , month <=6 , day <=30 , hour <=1 ) this won't "group" records want them too, resulting in date (for example) hour 0 , hour 1. select ... year < 2011 or (year = 2011 , month < 6) or (year = 2011 , month = 6 , day < 30) or (year = 2011 , month = 6 , day = 30 , hour <= 1) or: select ... str_to_date(concat(year,'-',month,'-',day,' ',hour,':00:00')) <= '2011-06-30 01:00:00'; the latter lot slower (since can't use indexes on various date columns. it's untested, since (ancient) version of mysql have access doesn't support str_to_date().

qt - C++ Taglib Cover Art from MPEG 4 files -

as side/fun project i'm building audio player (qt application), , 1 of hurdles displaying embedded cover art. *.mp3 files ended not being of issue, example provided here : static qimage imagefortag(taglib::id3v2::tag *tag) { taglib::id3v2::framelist l = tag->framelist("apic"); qimage image; if(l.isempty()) return image; taglib::id3v2::attachedpictureframe *f = static_cast<taglib::id3v2::attachedpictureframe *>(l.front()); image.loadfromdata((const uchar *) f->picture().data(), f->picture().size()); return image; } however, how can embedded cover arts extracted mpeg 4 files (particularly *.m4a)? here how it: taglib::mp4::file f(file); taglib::mp4::tag* tag = f.tag(); taglib::mp4::itemlistmap itemslistmap = tag->itemlistmap(); taglib::mp4::item coveritem = itemslistmap["covr"]; taglib::mp4::coverartlist coverartlist = coveritem.tocoverartlist(); if (!coverartlist.isempty()) { ta...

expressionEngine php parsing str_replace not working -

Image
i have template php enabled on output. can't str_replace work. see below code. if put {title} without php works. when include php , place {title} inside str_replace function, nothing displayed. tried php simple echo 'test'; , worked. it's not parsing {title} or other field tags. {exp:channel:entries channel="one" url_title="{segment_2}"} <?php echo str_replace('old', 'new', '{title}'); ?> {/exp:channel:entries} this may sound preposterous, have tried removing url_title parameter {exp:channel:entries} tag ensure rest of code , logic working properly? the following code should output entry title of "old test" (without quotes): {exp:channel:entries channel="channel_name" entry_id="xx" dynamic="off"} {title} {/exp:channel:entries} given same entry title of "old test", should output: "new test" (again, without quotes): {exp:chann...

android display image on specific row of listview -

i have listview containing 25 different items. when click on item, corresponding sound file gets added array, starting index 0 of course, , more items selected, each corresponding sound file gets added next index of array. so, when play button pressed, sound file associated index 0 plays, sound index 1, , on until there no more indexes. little bit of (possibly unnecessary) background info, how add image listview of item playing? ipod, want display icon on right hand side on row of playing sound. have icon, , can display it, i'm not sure how tell on row display, based on sound/array index playing. have read different tutorials on adding images listviews, nothing adding 1 image specific row. to solve problem, think may need implement own subclass of baseadapter overriding abstract methods. simpleadapter , simplecursoradapter, new adapter bind data( sound file in case) list, baseadpater should capable of finding kind of view should appear in each position of list, , capa...

VBscript scheduled task error -

i have vbscript number of tasks, including moving files 1 place another. lots of copy/move/create folder/delete folder/delete files this set filesys = createobject("scripting.filesystemobject") filesys.copyfile "d:\test now\test.txt", "w:\test_2\test.txt" i'm able entire script work when run manually double clicking , no errors come up. however, when run scheduled task error shown "path not found". found error writing error db. if on error resume next is off script stuck in error. set on, script skip operations not carry out function. i've quadruple checked paths make sure right. there should aware of when running scripts scheduled tasks? are d:\ , w:\ local drives, or mapped network drives? if they're mapped, user running process might not have drives available. sure run task privileged local account. it's best log in account , run command manually. once verify works, can tighten security if that...

Detect nearest location from Array of Locations by using Google Map APIs -

i've array of locations: {' place1 ', ' place2 ', ' place3 '} * // these addresses now assume there new location: ' place4 '. i want detect 1 nearest ' place4 '....comparing above array of locations.... i.e. tracking nearest location of point array of locations...(by using google map apis).. psuedo code: foreach(var item in array) { var = tracknearestlocationbygooglemapapis(item); if(i nerest) { print(i); , go out of loop... } } there no api-call want. have calculate distance haversine formula seen here: http://www.movable-type.co.uk/scripts/latlong.html

jquery - Problem regarding database in webos 3.0 ENYO Sqlite -

i new develop touch pad applications. using enyo framework , sqlite database. have tried example given in doc seems data stored temporarily. refresh browser or recompile app data lost. have following queries regarding database: i want create database separately, not in application opendatabase() method. want use database in application, locate database in app , how connect database? i not able locate database created in app? i want create connection database , access data tables on load of application. know there application on load event still not able that.. it basic things should known create application on platform. if have knowledge on above things please help. better if can provide example. waiting... for interested on so, answered question on @ palm developer centre. create db on app launch, can override kind's ready method. ready: function(){ // open db var db = opendatabase("ext:somedb", "1.0", "somedb...

expandablelistview - Expandable list-view android, set custom drawables -

ok, have simple question here. how can change group arrow on expandable listview drawables? y know, i'm gonna use + , - expandable group list... thanks please check this link more helpful you or <expandablelistview android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:groupindicator="@drawable/group_indicator" > group_indicator.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_empty="true" android:drawable="@drawable/arrowright"></item> <item android:state_expanded="true" android:drawable="@drawable/arrowdown"></item> <item android:drawable="@drawable/arrowright"></item> </selector>

c# - How can I set sort of "Start in"-path for a Windows Service -

i have following class, used windows installer project, install service: [runinstaller(true)] public sealed class installer : system.configuration.install.installer { private readonly string _installdir; public installer() { var locatedassembly = this.gettype().assembly.location; this._installdir = path.getdirectoryname(locatedassembly); var serviceprocessinstaller = new serviceprocessinstaller { account = serviceaccount.localsystem }; var serviceinstaller = new serviceinstaller { servicename = settings.service.name, starttype = servicestartmode.automatic }; this.installers.add(serviceprocessinstaller); this.installers.add(serviceinstaller); this.context = new installcontext(this._installdir + @"\install.log", new[] { string.format("/assemlypath={0}", locatedassembly) }); } public overri...

ant - What's the difference between a nested path and fileset? -

i have been googling "differences between fileset , path" article time, have found nothing useful. example, difference between following (say, there somedir directory, contains .jar files , has no subdirectories): <path id="somepathid"> <pathelement path="somedir"/> </path> <path id="someid"> <path refid="somepathid" /> </path> and <path id="someid"> <fileset dir="somedir"> <include name="*.*"> </fileset> </path> ? they used in different situations. fileset used specify group of files. can use selector s , patternset s files want. classpath used specify classpath references. classpath can specified single jar ( location="..." ), ; or : separated list of jars ( path="..." ) or nested resource collections (like fileset ). also if want debug them, different: <echo message=...

Read issue in MongoDB asynchronous replication -

i'm new mongodb. created java app using mongodb database. configured 3 servers in replica set. pseudo code: { createuser getuser updateuser } here createuser creates user getuser fails return user in somtimes. when analysed due data replication latency. how can overcome issue? is there anyway replicate data when created? is there other way user without fail? thx in advance! if issue due replication latency, 1 thing can make sure writes safe , using w flag. way, mongodb wait until data replicated @ least n nodes before returning. can client driver well. mongodb getlasterror are reading slaveok=true ? if read replicaset primary, shouldn't issue either.

CSS missing from django admin pages on development server after execution of drop database -

i have been messing around simple django 1.3 toy project using mysql, , decided change lot of models around. after doing so, needed clear database , "start afresh" used "drop database db" in mysql prompt. however, after re-running python manage.py syncdb which correctly populated database new tables, prompted me make superuser, etc... admin pages no longer find css files linked (base.css instance) i did not change settings, , still using built-in server python manage.py runserver from googling around, seems there problem permissions, every other discussion have been able find has said problem when using apache or rather "automagical" django server. as additional information, running ubuntu 11.04 on virtualbox virtual machine under windows 7. attempted try , switch sqlite3 in case had somehow broken mysql database, did not resolve issue. thanks help! try include the context processors in settings.py

mouseover - jquery mouseenter proper implrmentation? -

i have navigation menu in menu "hotels", slide down panel implemented. script: $(document).ready(function(){ $(".hotelpaneltrigger").mouseenter(function(){ $(".panel").slidedown("slow"); //$(this).toggleclass("active"); return false; }); $(".panel").mouseleave(function(){ $(this).slideup("slow"); }); }); now, have 2 problems: .hotelpaneltrigger fires panel (.panel) slide down panel slides mouse leaves .panel area 1st problem: hovering between "hotelpaneltrigger" & ".panel" result panel slides , down multiple times, both functions executed long user hovers between both elements. 2nd problem: panel defined slide user leaves ".panel" area what solution recommend to: slide down panel on "hotelpaneltrigger" , stay open long user in "hotelpaneltrigger" + ".panel" area.. , closes when hovering away them...

sql - mysql ignore any distinct values -

i trying run sql query not show distinct/duplicate values. for example if using distinct option display 1 unique result, skip detected distinct values i.e dont display distinct values is possible? select col1 d tb_col col1 = '123'; col1 ------ 123 123 (2 rows) select distinct col1 d tb_col col1 = '123'; col1 ------ 123 (1 row) not showing duplicates @ all: select col1 d tb_col group col1 having count(*) = 1 --- or perhaps having count(*) > 1 --- it's not clear want.

Git svn workflow with two clients -

i use git-svn 'better' svn client. work home on laptop, has ip connectivity main pc. whats best way move changes between laptop , main pc? for example half way though fixing bug , have commited changes in local branch. i'd able pick these changes , continue working on bug on laptop, , commit changes make them. i'd able move these changes main pc , continue working on bug when return office. i assuming, using svn, because have commit to, @ office, @ end of day. between home pc , work pc, treat repo pure git repo. work in branches not directly "dcommitted" svn branch. because of problems between git , svn , have careful merges svn-talking branches. might deal , mirror these branches @ home , office. cherry-pick or merge svn branches dcommit them.

Inno Setup Windows DLL function call with pointer to structure -

i trying set service's failure actions using inno setup's pascal scripting language. receive classic "access violation @ address..." error. seems impossible because language don't have support pointers. ideas? here code snippet: type tscaction = record atype1 : longword; delay1 : longword; atype2 : longword; delay2 : longword; atype3 : longword; delay3 : longword; end; type tservicefailureactionsa = record dwresetperiod : dword; prebootmsg : string; pcommand : string; cactions : dword; saactions : tscaction; end; function changeserviceconfig2(hservice: longword; dwinfolevel: longword; lpinfo: tservicefailureactionsa): bool; external 'changeserviceconfig2a@advapi32.dll stdcall'; procedure simplechangeserviceconfig(aservice: string); var scmhandle: longword; servicehandle: longword; sfactions: tservicefailureactionsa; sactions: tscaction; begin try scmhandle := openscmanager('...

objective c - help with isEquals and hash in iphone -

so i'm overriding isequals , hash compare custom objects able remove duplicates nsarray . problem i'm missing values in list contains no duplicated items, , seems hash or isequals implementation wrong. custom object course object has variables like: id , name i'll put code here: - (bool)isequal:(id)object { if ([object iskindofclass:[course self]]) { return yes; } if(self == object){ return yes; } else { return no; } } - (unsigned)hash { nsstring *idhash = [nsstring stringwithformat: @"%d", self._id]; return [idhash hash]; } then, after querying database put values in array , in set should remove duplicated items this: nsmutableset *noduplicates = [[nsmutableset alloc] initwitharray:tempresults]; can see i'm doing wrong in isequals or hash implementation? thanks lot. this how implement hash , isequal (at-least 1 working me purpose of identifying duplicates) hash functio...

javascript - How to update href ID using AJAX -

i have following link in code: <li onclick="loadnewpage('test')"><a href="#">link</a></li> when user click link, use xmlhttprequest update content in div on webpage. but @ same time, when user click link, want add id, state of button can changed using css. (note "id" being added link) <li onclick="loadnewpage('test')"><a href="#" id="current">link</a></li> at same time, if these other link on page id "current" want remove id. is possible? how this? it practice every element want handle in html has own, fixed id. i suggest put id when creating page. if want change something, may change class of element instead of id. initial: <li onclick="loadnewpage('test')"><a href="#" id="section_1">link</a></li> after clicking: <li onclick="loadnewpage('test...

svn - Subversion (Eclipse/Flash Builder) - After Team>Update to HEAD - where does one view what was updated? -

Image
subversion (eclipse/flash builder) - after team>update head - view updated? i persume there log or something. remember seeing output of update in console window once, when looking it, can seem see update info brian update: answered below, others see where, see screenshot: show view console → press toolbar button open console → choose svn console

php - Curl - Does not work on Windows CLI -

curl not work on windows command prompt working fine on browser (localhost) error: c:\wamp\www\site>c:\wamp\bin\php\php5.3.0\php.exe -f index.php php fatal error: call undefined function curl_init() in c:\wamp\www\site\index.php on line 111 fatal error: call undefined function curl_init() in c:\wamp\www\site\index.php on line 111 yes php curl enabled, said work fine on browser. run php -r "echo php_ini_loaded_file();" in command line see ini file being loaded. then remove ; before extension=php_curl.dll around line 656 restart apache for work, make sure php set global variable, if not got d:\wamp\bin\php\php5.2.5 ( path can change on ur computer ) command line & run code

sql - Warehouse and SSIS -

i develop application has database wery generic can't use reporting. need solution how create reporting. i'm developer knowledge in dba domain bounded. have ideo create database i'll pu denormalized data original db. saw use ssis , woul glad if give me advice how attack problem. should sync data once day , run reports way. there solution sync data allways reports date? please advice.. thanks! damir, what message getting close build datawarehouse using star schema pattern. you have 2 databases, 1 normalized data , other 1 star schema pattern (your dw), , create script use normalized data , put them in datawarehouse. frequency of script : after each transaction, every hour, once day, etc... the advantage of having datawarehouse able use olap cubes , mdx language reports. it's plus ! hope help,

php - mvc design question -

Image
i using zend framework , doctrine in app in web application have various individual modules events, conferences, case studies.. making controller design @ moment. in below image regulatory document controller , sub actions. regulatory doc, videos, podcasts having same kind of functionality. design appropriate...? in mvc each action having separate view. , on user type may have put access levels on modules. have kept separate controller can control module each user type. resulting in duplicate code. now thinking make 1 parent class , in have common methods. eg. have common class resources , in keep list, search, suggest, addfavorite etc. , parent above given controllers. so how manage view these different modules if go approach..? if go code bit messy..? if understand correctly have set of common behaviors among regulatory documents, videos , podcasts. in case should try abstract commonalities out parent class these 3 areas inherit. as example, have own mvc fram...

filter - Wild card usage in XML -

need filter values containing b in db2 table. (we use tool links xml db2) when use "b*" filters values has b first character when give "*b*" takes values in database <desc value ="*b*"> not working is there other way prefix wildcard character searching elements. i second peter, use '%b%' see wildcards in db2 sql ofcourse db2 supports wildcard chars, use % clause in case char datatype for eg. select * your_table your_column '%1234%' this search matches substring 1234 anywhere in string & result desired: 1234 1234ab 1234abcd ab1234cd also basic sql coding db2 universal database os/390 (under 'searching string patterns); sql has powerful predicate allows search patterns in character string columns. predicate. suppose want generate list of candidates first name starts letter g. select fname,lname,wphone,hphone candidate fname 'g%' order lname,fname ...

jquery - hover on a button to get options in a modal box like google plus -

for of have seen google plus must have noticed when hover on "add circles" button, automatically presented modal box type of div contains circles in checkboxes , can click 1 want. is there example of how using css/jquery...or perhaps similar it? or in explanation, how done? here example on how do: <!doctype html> <html> <head> <!-- jquery --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script> var aa; $(document).ready(function() { $(".addcontainer").mouseenter(function() { $(".addcircles").animate({height : 200}); }); $(".addcontainer").mouseleave(function() { $(".addcircles").animate({height : 0}); }); $(".addcircles input[type=checkbox]").change(function(e){ alert($(this...

listview - android how to put heading for an BaseAdpater -

Image
i wanna put heading baseadapter. like attached screenshot this android app pulse news reader. want know how made front page. how put headings every image adapter. concept used here. plz tell me sample example. thank you there 2 things think about, data , layouts. the list that's being displayed array of items each item represents feed. feed represents array of articles. think of objects this feed title ( string ) articles ( list<article> ) article thumbnail ( image ) headline ( string ) your adapter going bound list<feed> , , layout file use display "feed" item going have vertical linearlayout displays title , below horizontal linearlayout containing articles array (using layout_weight make each item hold equal amount of horizontal space)

solr - Problem facing while querying for wild card queries -

i using solr indexing , searching in application. facing strange problem while querying wild card when search di?mo?d , results diamond when search diamo?? no results.what reason please tell. edit: <fieldtype name="text" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt"/> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall...

c# - how to change some listview item backcolor in WPF? -

when double click or whatever how change listview item backcolor or foregcolor in wpf ? want 1 @ run time. code not work listview_name.selecteditems[listview_name.selectedindex].foreground=brushes.yellow; please me..... try following http://www.codeproject.com/kb/wpf/hilitelistviewitemsinwpf.aspx

Is it possible to clone git config from remote location? -

i have bare repo on remote location configs i'd share clones it. possible? every time clone, seems revert in .git/config defaults , add information remote repo. i confirm local config (the 1 within .git/config ) never shared amongst repo (for various security reasons, like, instance,: a git alias define commands valid in particular environment (or git commands themselves : no , jan hudec comments, , detailed in question " is possible override git command git alias? ") some github directive ( github.token ) supposed secret , incorrectly entered in local config instead of global one personal config user.name , user.email (which can set on local level if differs other repos): wouldn't make sense propagate name , email when other clone repo. ... ). the closest way version actual file config in it, , invite users copy in .git/config file

android - Restore APNs when app uninstalled -

afaik there absolutely no way detect moment when app gets uninstalled. i writing app should among else toggle on/off 3g data. went ok before 2.3 itelephony reflection calls, android 2.3 not possible. so had resort apndroid-style way of adding suffixes apns in content://telephony/carriers . seems work, stumble on same problem apndroid has: since can't detect when app removed, suffixes remain if user first turns off 3g app , uninstalls app. this ugly , dangerous solution, because end user may left apns broken. it's possible detect uninstallation application, how 1 force user install application monitor first one? seems there no way 2.3 on write 3g-managing app. any ideas? afaik there absolutely no way detect moment when app gets uninstalled. correct. i writing app should among else toggle on/off 3g data. went ok before 2.3 itelephony reflection calls, android 2.3 not possible. which means should not implementing app sdk application. should ha...

c# - OpenCover generates an empty report -

i using opencover determine code coverage simple c# project. the problem although can see mstest running unit tests (and succeeding) generated report empty. details this command using: opencover.console.exe -register -arch:32 -target:"%vsinstalldir%\common7\ide\mstest.exe" -targetargs:"/testcontainer:calculatortest.dll" -filter:+[calculator.dll]* -output:coverage.xml the output microsoft (r) test execution command line tool version 10.0.30319.1 copyright (c) microsoft corporation. rights reserved. loading calculatortest.dll... starting execution... results top level tests ------- --------------- passed calculatortest.statisticstest.addoccurrencetest passed calculatortest.statisticstest.avgtest 2/2 test(s) passed summary ------- test run completed. passed 2 --------- total 2 results file: e:\users\erno\documents\...

java - unable to validate directory loaded from property file -

i trying load directory properties file. have following defined in property file: image.src.dir = "c:\\temp\\foo\\" yes, directory name ... mixed case. have tried referring directory "/temp/foo" same outcome. i have following code fails despite directory existing. string srcdir = prop.getproperty("image.src.dir"); file folder = new file(srcdir); if (!folder.isdirectory()) { system.err.println("directory: " + srcdir + " doesn't exist"); } thanks hint ... the problem & solution: solution: image.src.dir=c:\\temp\\foo\\ problem: image.src.dir = "c:\\temp\\foo\\" that problem ..! did try system.println(srcdir) if string gets loaded properties file? directory accessible (are rights superdirectories correct?).

aspectj - Which are the most suitable languages to apply Aspect's Theme approach? -

i thinking reading aspect-oriented analysis , design: theme approach , yet hesitant. possible use what's taught in book aspectj (for java) or post# in c#? maybe aquarium in ruby? what perfect language suit design process that's made book? more interested in symmetrical approach aspects. thanks just every language can take advantage of aop. actionscript. java , c# have nice frameworks. postsharp works c# , vb.net. should definatly read book. thete no perfect language suggest try both java , c# using aspectj , spring java , postsharp , spring.net c# since seems on educational adventure. i have not read book application of aspect oriented design can done in language. start know

asp.net - Hiding the Null Fields -

i have data repeater reading few different fields. however, information being pulled empty. hide these fields in case. i not sure how best go this. have tried following methods: <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:db %>" selectcommand="select grname, grroom [group] grname 'a%' order grname && * not null"> </asp:sqldatasource> <!-- output page --> <div data-role="collapsible-set"> <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1"> <itemtemplate> <div data-role="collapsible" data-collapsed="true"> <p>room: <%# eval("grroom")%></p>...

How To know status of a file whether it is in processing or not in java which is platform independent? -

in file monitoring process if 1 file came , processed not check if file open , writing something..then how prevent moving of file without closing file. do have control on program that's putting files in directory? put ".partial" on end of filename while file still being written, , rename remove ".partial" when writing done. if make java file-monitoring program ignore files names end in ".partial", it'll see files after they've been written out.

jquery - let child dom element out of bounds of the parent div with html and javascript on hover -

it hard summarize in title question more info here... i have image-gallery consisting of list element images (and span display text label). html layout looks this: <div class="caracteristics_list gallery"> <ul class="thumb"> <li><a href="#"><span class="video">play</span><img src="images/gallery1.jpg" alt="" /></a></li> <li><a href="#"><img src="images/gallery1.jpg" alt="" /></a></li> <li><a href="#"><img src="images/gallery1.jpg" alt="" /></a></li> <li><a href="#"><img src="images/gallery2.jpg" alt="" /></a></li> <li><a href="#"><img sr...

.net - Protocol error resistant socket server -

i'm developing server on c# (using *async methods). works fine, until 1 side violates protocol (e.g. attack on server). the client , server interchange messages of following structure: first 4 bytes define length (n) of message body in bytes the following n bytes define message body if transmits wrong length - comunication between client , server becomes unpredictable. so idea create self-synchronizing protocol easy way. i'm using tcp protocol, idea break message packets , no 2 messages should share same packet - way i'll able ignore protocol violations , restore communication, if goes wrong. i want use tcp that, packet same tcp segment. there few catches: the mtu (which defines mss) differ , there no predefined value buffer size use (correct me if i'm wrong) i couldn't find way manupulate tcp segments directly (without "stream" abstraction) yet i'm new socket server programming, need help. maybe can share common solution prob...

arcgis - Writing Lon,Lat coordinates to a shapefile in Matlab with projection -

i have list of longitude , latitude points plot object moving on time on map; sort of forms line curves around bit. using matlab generate these points , export them polyline shapefile load in arcgis. after looking @ this example mathworks website, able create line geostruct object: [tracks(1:length(mylon)-1).geometry] = deal('line'); tracktype = 'gc'; [tracks.type] = deal(tracktype); = 1:(length(mylon)-1) [tracks(i).lon tracks(i).lat] = track2(tracktype, mylon(i, 1), mylat(i, 1), mylon(i+1, 1), mylat(i+1, 1)); end shapewrite(tracks, 'path_line'); this works fine geostruct not contain type of projection, although documentation claims mapstruct does. unfortunately don't see examples or functions on how create mapstruct. know how go doing that? also, tried create point geostruct instead of line using mathworks example, doesn't generate .dbf file, .shp , .shx files. there explanation this? suggestions! you need use "defi...

testing - How to test chained methods in Ruby on Rails using Rspec -

i'm trying decide how test method calculates average of values on associated records. i'm concerned testing implementation vs actual result returned. say have following models... class user has_many :interviews def interview_grade interviews.average(:score).round unless interviews.empty? end end class interview belongs_to :user end and in user_spec.rb have... describe "interview_grade" let(:user) {user.new} context "when user has interviews" before { user.stub_chain(:interviews, :empty?){false} } "should return average of appraisal ratings" user.interviews.should_receive(:average).with(:score).and_return(3.2) user.work_history_grade.should == 3 end end context "when user has no interviews" before {interview.destroy_all} "should return nil" user.interview_grade.should be_nil end end end these tests pass feels fragile me. if interview_grade should ...

javascript - Is there any way to force Internet Explorer to break on alert()? -

i'm trying debug error message in large , complicated frames based web/asp.net app using ie8 , visual studio 2010. specifically, getting "member not found" message box appears straightforward javascript alert(). unfortunately don't know in code problem happening, , fiddler2 wasn't in case. my question is, using ie option, tool, or other approach, can ie break @ alert() call can debug it? string search "member not found" add 1 / 0; before line. turn on break on errors. (i assumed knew developer tool existed. hit f12 , navigate script tab) edit: thanks @dmitriynaumov var aalert = window.alert; window.alert = function() { aalert.apply(this, arguments); 1 / 0; }

mercurial - Repo cloned twice in multi-config job -

we have jenkins set build on number of slave nodes. on each node, seems clone repository twice (using mercurial). first clones directly top-level workspace/[jobname] directory (this seems happen before master hands off slave) , slave starts , creates clone in workspace/[jobname]/label/[nodename]. our repo quite large (over 250mb) cloning twice major resource drain in time , disk space. there reason this, considering first clone doesn't seem used build? can behavior changed?

cursor - Call log in Android -

is there way 1 can log call history(only duration of call) particular contact in android. there "x" person in contact list, want find out duration of call both talked( both incoming , outgoing) in past days (it user given, can day, week, month etc.) . i got across code while searching think might give last talk details. please correct if wrong. string[] strfields = { android.provider.calllog.calls.number, android.provider.calllog.calls.type, android.provider.calllog.calls.cached_name, android.provider.calllog.calls.cached_number_type }; string strorder = android.provider.calllog.calls.date + " desc"; cursor mcallcursor = getcontentresolver().query( android.provider.calllog.calls.content_uri, strfields, null, null,strorder); any great :) there 2 approach, put right filter in cursor. iterate cursor collect data.

javascript - Counter code loading small image -

i've found website statistics counter runs code: <a title='counter' target='_blank' href='http://www.example.com/tracker/'> <img src='http://www.example.com/transparent.gif' border='0'> </a> <script type='text/javascript' src='http://www.example.com/tracker/example.js.php?id=11111'> </script> <noscript> <a href='http://www.example.com/'>counter</a> </noscript> i think main part seo, right? counter still work same way using part of it? <script type="text/javascript" src="http://www.example.com/tracker/example.js.php?id=111111"> </script> i'm wondering why free services loading small image , such things. feedback. the image might part of tracking , assume fallback people javascript disabled. in case tracking service can still track incoming request ip/browser image (which blank , not interferring design). ...

xml - How to populate a spinner in android with file names in a directory? -

i trying create spinner or similar drop down/selector in android. similar opening file, want spinner list of files found in specified directory path. i.e. --> have directory example1.txt, example2.txt, mymp3.mp3, otheraudio.3pg @ c://path/mystuff i want spinner populate based on files in directory have option pick of files in directory. the spinner "display only" functionality. need file names of files in directory. there button contain functionality open selected file spinner. not sure how go setting up... best file names through java, store in string array in xml spinner read, or other way? assuming you're talking directory on phone (your reference c://path/mystuff has confused me isn't linux path) don't see there benefits creating xml file list files. can use arrayadapter.createfromresource(...)? you can following: .... list<string> filenames = new arraylist<string>(); // populate above list desired path spinner spinner...

html - 100% width background only filling to the right -

update: reason wasn't working because element width: 100% inside div class="container" element. removing fixed problem! (don't have enough rep answer question myself yet, wanted let viewers know it's been solved though.) i teaching myself blueprint css framework, , i'm having trouble following html/css. can't seem class bigbox fill 100% of page's width (it fills 100% right, it's aligned other content on left.) how can work way intended? thanks! <head> <title>hello</title> <!-- screen default blueprint framework file --> <link rel="stylesheet" href="screen.css" type="text/css" media="screen, projection" /> <!-- import custom styles --> <style> #topmenu {float:right; margin-top: 50px; /*margin-right: -30px;*/} #topmenu ul {list-style: none outside none; } #topmenu ul li { display: inline; } #topmenu u...

android - ArrayAdapter's getView() method getting called automatically on EditText focus event -

i creating custom list activity. there 2 classes 1 having extended listactivity , other having arrayadapter list activity. problem 1: problem while opening listactivity screen have search box on top of it. when start listactivity automatically opens keyboard current focus on edittext . want stop that. problem 2: when focus goes on edittext arrayadapter's getview() method getting called automatically generating rows again. not getting why happens so. not calling notifydatasetchanged() method also. still when focus on edittext getview() called automatically. how prevent it? storelistview.xml: <?xml version="1.0" encoding="utf-8"?><linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/black" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:focusable="true" android:focusableint...