Posts

Showing posts from August, 2012

grails - Bidirectional One-To-One -

grails - Bidirectional One-To-One - i have 2 domain classes: class contract { string refno } class attachment { byte[] info string mimetype string filename } how can set relationships have both contractinstance.attachment , attachmentinstance.contract ? think bidirectional one-to-one i'm not sure (one contract has have 1 attachment )... class contract { attachment attachment } class attachment { static belongsto = [contract: contract] } this define 1-to-1 relationship between two, contract beingness owner of relationship. means if save/delete contract save/delete cascade attachment, inverse not true. grails

.net - How to get mail event like read,delete,reply,forward for a mail in outlook in c# -

.net - How to get mail event like read,delete,reply,forward for a mail in outlook in c# - i have create addin outlook using c#. maintain track of mail service events new mail, read, reply,forward , delete etc. i know how create add together in not getting thought how can track event fired outlook these operations. any thought appreciated. thanks in advance. you need research application events, folder events, , item events on msdn. here msdn illustration on how attach event fires when new messages received in outlook 2007. events vary outlook version, need determine minimum supported version , stick eventing api. events have special restrictions, need inquire more specific questions after you've researched events. c# .net outlook add-in

SQL to Return Dates for Selected Week Only -

SQL to Return Dates for Selected Week Only - i'm writing sql query on timesheet report. need study homecoming details week of selected date. e.g., if pick 02/01/2012 (dd/mm/yyyy), should homecoming results between 02/01/2012 , 08/01/2012. thanks select * yourtable datefield >= @yourdate , datefield < @yourdate + 7 some variations of sql may have specific ways of adding 7 days datevalue. such as... - dateadd(day, 7, @date) - date_add(@date, interval 7 days) - etc, etc this alternative both index friendly, , resilient database fields have time parts date parts. sql date

ruby on rails 3 - How to DRY (these) RSpec tests using custom matcher -

ruby on rails 3 - How to DRY (these) RSpec tests using custom matcher - i have next tests, candidates little dry treatment: describe league context 'attributes validation' before(:each) @league = league.new end 'should invalid without short_name' @league.attributes = valid_league_attributes.except(:short_name) @league.should_not be_valid @league.should have(1).error_on(:short_name) @league.errors[:short_name].should == ["can't blank"] @league.short_name = 'nfl' @league.should be_valid end 'should invalid without long_name' @league.attributes = valid_league_attributes.except(:long_name) @league.should_not be_valid @league.should have(2).error_on(:long_name) @league.errors[:long_name].should == ["can't blank", 'is not included in list'] @league.long_name = 'national football game league' @league.should...

python - How does len function actually work for files? -

python - How does len function actually work for files? - the python docs say: homecoming length (the number of items) of object. argument may sequence (string, tuple or list) or mapping (dictionary). code: from sys import argv script, from_file = argv input = open(from_file) indata = input.read() print "the input file %d bytes long" % len(indata) contents of file: 1 2 three upon running simple programme output: input file 14 bytes long qutestion: i don't understand, if file has written in 11 characters(one 2 three) how can len homecoming me 14 bytes , not 11?(what's bytes way?) in python interpreter if type s = "one 2 three" , len(s) 13, confused. "one 2 three" indeed 13 chars (11 letters + 2 spaces). >>> open("file.txt", 'w').write("one 2 three") >>> len(open("file.txt").read()) 13 most have char endline, explains 14. python function

javascript - jQuery drag and draw -

javascript - jQuery drag and draw - i'm trying build jquery plugin allows drag , draw rectangle (or div border) i'm not sure how it. don't know of have ability don't know illustration of how this. how can implement drag , draw in jquery? the basics quite simple, when think it: listen mousedown events on container (possible entire document); place absolutely positioned element @ position of mouse, using mouse coordinates event object ( e.pagex , e.pagey ); start listening mousemove events alter width , height object (based on mouse coordinates); listen mouseup event detach mousemove event listener. the aforementioned absolute placed element is, e.g., <div> border , background: transparent . update: here example: $(function() { var $container = $('#container'); var $selection = $('<div>').addclass('selection-box'); $container.on('mousedown', function(e) { var click_y = e....

java - Remove entries from the list using iterator -

java - Remove entries from the list using iterator - i need write simple function delete entries in list contains objects of class elem . wrote function removeallelements , not work if size of list<elem> greater 1. public class test { public static void main(string[] args) { work w = new work(); w.addelement(new elem("a",new integer[]{1,2,3})); w.addelement(new elem("b",new integer[]{4,5,6})); w.removeallelements(); // not work me. } } public class work { private list<elem> elements = new arraylist<elem>(); public void addelement(elem e) { this.elements.add(e); } public void removeallelements() { iterator itr = this.elements.iterator(); while(itr.hasnext()) { object e = itr.next(); this.elements.remove(e); } } } public class elem { private string title; private integer[] values; public elem(string t,in...

java - Hibernate Exception entity class not found -

java - Hibernate Exception entity class not found - i have application uses hibernate database transactions, have mapped tables in database , when tried info 1 table next error, please help, jan 18, 2012 1:19:57 pm org.hibernate.impl.sessionfactoryimpl <init> info: building session mill initial sessionfactory creation failed.org.hibernate.mappingexception: entity class not found: mappings.log exception in thread "awt-eventqueue-0" java.lang.exceptionininitializererror @ org.ofm.mnu.persistence.hibernateutil.buildsessionfactory(hibernateutil.java:25) @ org.ofm.mnu.persistence.hibernateutil.<clinit>(hibernateutil.java:14) @ org.ofm.mnu.crud.grnmaincrud.retrive(grnmaincrud.java:15) @ org.ofm.mnu.views.functions.grn.fillgrntable(grn.java:224) @ org.ofm.mnu.views.functions.grn.<init>(grn.java:36) @ org.ofm.mnu.views.home.main.mainframe.btnsample_2actionperformed(mainframe.java:233) @ org.ofm.mnu.views.home.main.mainframe.ac...

iphone - xcode conditions on view -

iphone - xcode conditions on view - i have complicated controller xib interface view. alter 2 labels' positions(a slight shift) on condition. don't want hardcode new coordinates of labels in code, because it's not flexible solution (in future can alter labels' positions in xib , hardcoded positions incorrect). so, can problem? should duplicate xib , pick 1 of them on condition? or may there more elegant solution? thank you! you should shift them relative current position cgrect labelframe = mylabel.frame ; labelframe.origin.x +=something ; mylabel.frame = labelframe; this create shift in x direction something. you can in uiview animation block animate shift iphone xcode interface-builder

date - LotusScript Function Doesn't Update Field -

date - LotusScript Function Doesn't Update Field - i'm trying document created each instance of string of dates. this doesn't work i'd hoped - field doesn't update , debugger doesn't show me @ all. can point me in right direction code? public sub co_multidates() 'basic error handler function 'on error goto errorhandler 'errorhandler: msgbox("error " & cstr(err) & ": " & error$ & " on line " & cstr(erl)) 'everything below designed populate field populates column multiple date values 'this designed when creating location record multiple days, there multiple entries in employee's view dim w new notesuiworkspace dim multistartdate notesdatetime dim multienddate notesdatetime dim tempdate notesdatetime dim datearray() notesdatetime dim datecounter integer dim adjustday integer dim source notesuidocument set source = w.currentdocument dim thisdoc notesdocument set thisdoc =...

Dealing with lack of floating point precision in OpenCL particle system -

Dealing with lack of floating point precision in OpenCL particle system - i'm writing opencl based particle scheme speed visualizations of big scale networks. in essence, 2 phase problem phase 1 applies negative gravity each particle (typical n-bodies problem) repel , phase 2 attracts particles based on edges (or springs) between particles. during each iteration of gravity algorithm each particle's location, represented pair of floats, impacted distance each other particle (classical physics model, no drag, keeping simple). in situation 1 has spaced out square array of particles application of gravity should result in symmetry across both x , y axes. true @ origin of gravity application, on time lack of precision inherent in adding lots of floating point numbers results in little non-uniform deviations. this, in turn propagates through entire n-body scheme , loss of symmetry occurs. one simple way avoid utilize double precision numbers, geforce 9600m gt on macb...

regex - Optimize this horrible regular expression -

regex - Optimize this horrible regular expression - the thought allow 4 instances of 'a' , 2 instances of 'b' in string of arbitrary length. now, other characters don't matter, care about, 4 'a's , 2 'b's. came with, this: m{ ^[^ab]* ( (b[^ab]*b[^ab]*a[^ab]*a[^ab]*a[^ab]*a)| (b[^ab]*a[^ab]*b[^ab]*a[^ab]*a[^ab]*a)| (b[^ab]*a[^ab]*a[^ab]*b[^ab]*a[^ab]*a)| (b[^ab]*a[^ab]*a[^ab]*a[^ab]*b[^ab]*a)| (b[^ab]*a[^ab]*a[^ab]*a[^ab]*a[^ab]*b)| (a[^ab]*b[^ab]*b[^ab]*a[^ab]*a[^ab]*a)| (a[^ab]*b[^ab]*a[^ab]*b[^ab]*a[^ab]*a)| (a[^ab]*b[^ab]*a[^ab]*a[^ab]*b[^ab]*a)| (a[^ab]*b[^ab]*a[^ab]*a[^ab]*a[^ab]*b)| (a[^ab]*a[^ab]*b[^ab]*b[^ab]*a[^ab]*a)| (a[^ab]*a[^ab]*b[^ab]*a[^ab]*b[^ab]*a)| (a[^ab]*a[^ab]*b[^ab]*a[^ab]*a[^ab]*b)| (a[^ab]*a[^ab]*a[^ab]*b[^ab]*b[^ab]*a)| (a[^ab]*a[^ab]*a[^ab]*b[^ab]*a[^ab]*b)| (a[^ab]*a[^ab]*a[^ab]*a[^ab]*b[^ab]*b) ) [^ab]*$ }x; (as always, perl regex) is ther...

Foursquare Real-Time API (Push) - Time out issue -

Foursquare Real-Time API (Push) - Time out issue - it seems there time-out issue foursquare real-time api (push). i have 4sq app uses real-time api , lately have lots of errors this: the request timed out (or force address invalid) these errors displayed on foursquare consumer administration. app deployed few months ago , issue start more intensive in few past weeks. server 15% usage , in cloud there no lack of resources or overloads. it's not easy troubleshoot issue because foursquare not provide error log or error log api. foursquare devs, please expand time-out time? :) is there similar issues? thanks :) foursquare

How to properly cast when using generics in java methods? -

How to properly cast when using generics in java methods? - i have assignment implement own version of collections.fill() , collections.reverse(). algorithms simple enough, i'm getting little bit lost in generics involved, when need casting. my original thought like: public static void reverse(list<?> a_list) { int list_size = a_list.size(); listiterator<?> left_to_right = a_list.listiterator(); listiterator<?> right_to_left = a_list.listiterator(list_size); ? temp_variable; // ..doing stuff right_to_left.set(temp_variable); } but of course of study can't declare temp type "?". declaring "object temp_variable" makes sense, phone call set(temp_variable) @ end won't work (since listiterator won't take object -- because list not type list<object>). it makes sense me, declare temp object, , cast listiterators: listiterator<object> left_to_right = (listiterator<object...

php - Query is not getting all mysql_fetch_assocs's -

php - Query is not getting all mysql_fetch_assocs's - could tell me why next bit of code gets images in query except last? $userquery = mysql_query("select * acceptedfriends profilename='$profilename' order rand() limit 4"); while ($userrun = mysql_fetch_assoc($userquery)) { $users = $userrun['username']; $imagequery = mysql_query("select * users2 username='$users'"); while ($imagefetch = mysql_fetch_assoc($imagequery)) { $location = $imagefetch['imagelocation']; $image = "<img src='$location' width='60' height='40'>"; if ($profilename==$username) { echo '<div id="hovercolor2" style="width:294px; float:left;"><table><tr> <td>'.$image.'</td><td><div style="margin-bottom:5px;"><a hr...

android - need help in getting and putting data from RadioGroup -

android - need help in getting and putting data from RadioGroup - rgroup = (radiogroup)findviewbyid(r.id.radiogroup); rgroup.setoncheckedchangelistener(new oncheckedchangelistener() { public void oncheckedchanged(radiogroup group, int checkedid) { toast.maketext(cont, checkedid, toast.length_short).show(); } }); in these code above, i'm trying user clicks on radio group, i shouldn't utilize onclicklistener right? you checkedid parameter. the id of checked radio button. can pass value findviewbyid radiobutton object. android

jquery - How to NOT-click a href while dragging in iScroll -

jquery - How to NOT-click a href while dragging in iScroll - i have iscroll enabled on my page. notice images in scroller links (so popup opens bigger image, y'know deal). 1 of lovely features of iscroll can drag mouse scroll. now, when drags it, automatically opens image instead of scrolling bar. there workaround? i append class each anchor while scroller beingness dragged. illustration append class name of "dragging" each anchor while beingness dragged remove class when dragging stops. that means can add together preventdefault link has "dragging" class. along lines of: myscroll1 = new iscroll('scroll1', { snap: 'li', momentum: false, hscrollbar: false, onscrollstart: function () { $('div#iscroll1 a').addclass("dragging"); }, onscrollend: function () { $('div#iscroll1 a').removeclass("dragging"); doc...

latex doesn't display carriage returns from mysql query -

latex doesn't display carriage returns from mysql query - in textarea of html form allow multi line inputs such as: hello goodbye this string set mysql database mysql_real_escape_string. want take string , pass straight tex document, empty lines (carriage returns suppose) not beingness output string. hence when compiled latex output hellornrngoodbye what need string retain carriage returns? after our give-and-take in chat, here's figured out: you used shell_exec("cat ".$path."/latextemplate.tex | sed -e 's/latexcode/$latexcode/' > ".$path."/texfiles/q$id.tex"); inside php script insert latex input stored in db template file , save that. somewhere in process, newlines got dropped. the best solution replace shell exec php equivalent loads file string, performs string replacement (unescaped) input string , stores in file. mysql latex

pattern matching - How to use Regex \A? -

pattern matching - How to use Regex \A? - 4.6.5.7 - - [date] if \a4 above string can 4, if \adate , not match. misread regex docs. can help? if need specific , particular string in square brackets, utilize '\[date\]'. if query more general, other posters have mentioned \a means 'start of string' rather 'start of word'. (this site test out different regex commands instant feedback: http://rubular.com/) regex pattern-matching

java - calendar serialization deserialization -

java - calendar serialization deserialization - when serialize date on 1 pc1 , deserialize on pc2 local date of pc2. when same calendar instance? situation same or not? date represents point in time (number of milliseconds 1st of jan 1970). not confused time zone in date.tostring() , serializing long value wrapped in class. calendar on other hand represents date , time in given time zone. means if source computer in gmt+1 , target 1 in gmt+2, sending calendar set gmt-6, gmt-6 way on both sides. that beingness said much safer (and uses less bandwidth) send date , allow every computer display using local time zone. java datetime

php - How to get jquery ui tab to display updated data upon updating the value in a ui dialog? -

php - How to get jquery ui tab to display updated data upon updating the value in a ui dialog? - i trying update value within jquery ui tab via ui dialog. the expected process such: from tab display, user clicks on edit link. prompts ui dialog box form user input value. user input value , save changes. after saving, user brought tab updated value. i have issues on point 4, , here codes far. html: <div id="acc"> <input type="text" id="edit_acc" value=""> </div> <div id="tabs"> <ul> <li><a href="#one" title="one">tab one</a></li> <li><a href="#account" title="account">tab account</a></li> <li><a href="#three" title="three">tab three</a></li> </ul> </div> <div id="one"> <p>tab 1 listing...

jailbreak - Build iPhone toolchain on iOS 5 and Mac OS X 10.7 -

jailbreak - Build iPhone toolchain on iOS 5 and Mac OS X 10.7 - is there tutorials on how build toolchain on current ios , os x versions? i can find ones ios 2 , 3. alternatively, possible compile sbsettings toggle without toolchain? i highly recommend utilize theos jailbreak development, rather toolchain. see this guide set up. ios jailbreak toolchain

c# - WCF DataContract - unable to return complex type -

c# - WCF DataContract - unable to return complex type - i have wcf service has methods homecoming ienumerable<t> collections of objects, , complex type, organizationcollection , has few properties, each ienumerable<t> of different types. believe i've set service contract correctly, , defined types datacontract / datamember correctly. method returns organizationcollection fails exception. know method functions since have unit , integration tests test it. it's when running live , deployed service fails. i've specified type serviceknowntype , no avail. need configure service able homecoming complex types organizationcollection ? note: wcf service running basichttpbinding , , housed in servicehost in windows service. [system.servicemodel.communicationexception] {"an error occurred while receiving http response http://localhost:8799/myservice. due service endpoint binding not using http protocol. due http request context beingness aborted ...

Gtk treeview to fit contents -

Gtk treeview to fit contents - i have such gui situation: window1>vbox1>vbox2>scrolledvindow1>treeview1>treestore1. program takes info database through mysql c-api. depending on query here may info 0 rows on one thousand show in treeview1. constructing gui in glade set 'width request' window1 , 'height request' treeview1 able see info in rows. is possible create window1 (or vbox2) automatically resizes amount of info in treeview1 avoid blank window on screen when have row or two. mean window should able 'hold' 1-24 rows resizing , after 24-th row scrollbars should come treeview1. is possible in c language , how can accomplish that? i suppose can't size gtktreeview based on contents, can utilize gtk-widget-set-size-request on own. gtk

c++ - opencv_highgui230.dll was not found -

c++ - opencv_highgui230.dll was not found - i creating application using opencv2.3 in vc++2010 express addition. build successful while compiling says 'opencv_highgui230.dll not found.reinstalling application may prepare problem.' though have added necessary include , lib files. it's dll can found in bin or named directory under installed opencv library. windows binary distributions of various libraries, dll included. for programme load it, either has in same directory executable, in scheme directory, c:\windows\system32\ , or think possible specify location programmatically, in code. msdn article can tell more. quick and, more not, right solution re-create dll executable's directory. c++ visual-studio visual-c++ opencv

how to allocate code in specific section for C++ program developed in MS VC++ -

how to allocate code in specific section for C++ program developed in MS VC++ - i trying utilize code allocate piece of code independent section: #ifdef _msc_ver #pragma section(".evil",execute) #pragma code_seg(".evil") #endif #ifdef __gnuc__ static __attribute__((section (".evil"))) #elif defined _msc_ver static __declspec(allocate(".evil")) #endif void __invoke__start() {//... but not work , compiler says the __declspec( allocate()) syntax can used static info only. i because have write code new file ,and file executable file. actually can not find way exact address of function in memory when programme running,if programme compiled ms vc++ debug mode total example,please see code : full example now, above problem has been solved, still want create clear if possible set code independent section. there's other benefit when possible work, after all. when link 2 object file (coff format), how can create sur...

restkit - Rails way to change current json output -

restkit - Rails way to change current json output - i'm working json below. outer label missing. [{ "id":1, "updated_at":"2012-01-13t17:13:47z", "created_at":"2012-01-13t17:13:47z", "name":"dave"}, { "id":2, "updated_at":"2012-01-13t17:13:55z", "created_at":"2012-01-13t17:13:55z", "name":"steve" }] i think restkit expects {***people:*** [{ "id":1, "updated_at":"2012-01-13t17:13:47z", "created_at":"2012-01-13t17:13:47z", "name":"dave"}, { "id":2, "updated_at":"2012-01-13t17:13:55z", "created_at":"2012-01-13t17:13:55z", "name":"steve" }] } @interface info : nsobject { person *person; nsarray *dogs; } @property (nonatomic ,...

android frame over image positioning -

android frame over image positioning - in application want have frame (with hole in middle) , set on image have captured photographic camera or taken image library. i want show frame on top, , have user able move hand image position @ right place within frame , merge 2 images users sees . any suggestions? you can framelayouthttp://developer.android.com/reference/android/widget/framelayout.html in layout set imageview/surfaceview or ever, on top (as lastly frame) set mask in it. to move mask, need implement gesture or hand , overwrite functions ontouch/ontouchintercept implement move functions. android image image-processing frame drag

migration - migrating hibernate to noSQL? -

migration - migrating hibernate to noSQL? - i'm faced task create our software stack scalable. it's not scalable because lumped huge central oracle database. accesses it, it's busy, what's more, because of concerns of losing data, database file straight written onto netapp, disk access slow. we've had success nosql solutions other tasks, considering them. 1 problem is, current code relies heavily on hibernate simplicity, because can traverse business object graph without worrying loading referenced objects. for nosql there not such hibernate driver available; if there were, problem nosql none of them supports join, efficient bring together fetch impossible, , have spend several trips store fetch related objects. result, i'm inclined think nosql projects independent objects, instead of complex object graphs. any ideas? i recommend trying infinispan distributed sec level cache. allow cluster application servers , still cache info in read h...

Why does `"%c"` exist in `printf` if `char` is converted to `int`? -

Why does `"%c"` exist in `printf` if `char` is converted to `int`? - in c have "%c" , "%f" formats flags printf - , scanf -like functions. both of these function utilize variable length arguments ... , convert floats doubles , chars ints . my question is, if conversion occurs, why separate flags char , float exist? why not utilize same flags int , double ? related question: why scanf() need "%lf" doubles, when printf() okay "%f"? because way gets printed out different. printf("%d \n",100); //prints 100 printf("%c \n",100); //prints d - ascii character represented 100 c printf varargs

php - How to avoid getting contents of the same file by separate script instances? -

php - How to avoid getting contents of the same file by separate script instances? - let's we've got: files: a.txt, b.txt , c.txt script: script.php we want allow script file's name (any of them), contents , delete same script runs separately can't same file. so far: $scan = scandir('dir'); unset($scan[0], $scan[1]); shuffle($scan); $file = $scan[0]; $contents = file_get_contents($file); if(unlink($file) !== false) homecoming $contents; use file locking flock . i think algorithm be: open file get lock flock check file still exists. if has disappeared, go 7 read file delete it unlock close file, ignoring failure step 3 required because process waiting lock 1 bound lose file, have been deleted time lock acquired. i think deleting file when open quite safe; subsequent file operations fail. there nil wrong deleting file locked because locks not associated files, they're maintained table of file descriptors. i think should c...

asp.net - session state timeout vs idle timeout -

asp.net - session state timeout vs idle timeout - is session state timeout setting in web.config same iis 7 idle timeout setting? if not, 1 takes priority? increment users sessions couple of hours. idle timeout application pool whole. kicks in if applications linked pool have had no activity within set time. session state per session. single user session. can have many sessions occurring @ single time. asp.net session iis-7 web-config

javascript - My Array holds previous values too every time i use. -

javascript - My Array holds previous values too every time i use. - var transactionobject = { arr1: [], arr2: [] }; my array holds previous values every time utilize model class. var info = update(transactionobject.arr1); jsonclient.send(data ); the first time array holds value, , next time when create request... adds previous info too... array not getting cleared @ all. if want clear info each time before adding new data, somewhere code needs clear array. this: transactionobject.arr1 = []; var info = update(transactionobject.arr1); jsonclient.send(data ); or, within update() function before putting info passed array: var info = update(transactionobject.arr1); jsonclient.send(data ); function update(results) { results = []; // set info results } javascript

c# - Image added to WPF canvas changes size -

c# - Image added to WPF canvas changes size - as part of application, have canvas object <canvas name="canvas"/> trying insert components of clock follows // add together background image bg = new image(); bg.setvalue(canvas.zindexproperty, 0); bg.source = new bitmapimage(new uri("images/background.png", urikind.relative)); canvas.width = bg.source.width; canvas.height = bg.source.height; canvas.children.add(bg); // add together sec hand image hand = new image(); hand.setvalue(canvas.zindexproperty, 10); hand.source = new bitmapimage(new uri("images/hand.png", urikind.relative)); canvas.children.add(hand); the first image (bg) appears correctly sec 1 (hand) appears scaled (original size 5 x 61 pixels, interrogating image size after creation shows has become 6.66 x 84.02 display units) (bg original 130 x 130 pixels , shows 130.4 in display units) all answers query can find (stackoverflow , google) suggest dpi setting of image both i...

jpa 2.0 - Difference in where clause beetwen JPQL and CriteriaBuilder -

jpa 2.0 - Difference in where clause beetwen JPQL and CriteriaBuilder - i have 2 separate entity class: job , joborgunitcfg below set 2 pieces of code create same select on objects. first query in jpql: query joborgunitcfgquery = entitymanager.createquery( "select c joborgunitcfg c c.orgid = :orgid , c.schedulernextactivation < current_timestamp , c.active = :active , " + " not exists (select j job j j.orderid = c.orderid , j.orgid = c.orgid , j.status <> :jobstatus)"); joborgunitcfgquery.setparameter("orgid", orgid); joborgunitcfgquery.setparameter("jobstatus", jobstatusenum.end); joborgunitcfgquery.setparameter("active", boolean.true); homecoming joborgunitcfgquery.getresultlist(); and sec query build criteriabuilder: criteriabuilder cb = entitymanager.getcriteriabuilder(); criteriaquery<joborgunitcfg> criteria = cb.createquery(joborgunitcfg.class...

codeigniter - PHP use foreach multidimensional data outside it -

codeigniter - PHP use foreach multidimensional data outside it - having php code: $data['items'] = array('cars', 'bikes', 'trains'); $data['title'] = $parameters['title']; foreach ($searchresults $key => $value) { switch ($key) { case "_cars": foreach ($searchresults['_cars']['items'] $car) { preg_match('@video/([^_]+)_([^/]+)@', $car['url'], $match); $url = $match[1].'/'.$match[2]; $url = base_url().'video/'.substr($url,0,1).'d'.substr($url,1); $data['data']['car']['url'] = $url; $data['data']['car']['title'] = $car['title']; $data['data']['car']['img'] = $car['thumbnail_medium_url']; } break; // ................ how can prepare this, or...

Auto playing vimeo videos in Android webview -

Auto playing vimeo videos in Android webview - i've managed vimeo video load , play, using following. autoplay=1 indicated in vimeo oembed docs doesn't auto play on load. found way auto play (also need grab event when video finishes) mwebview.getsettings().setjavascriptenabled(true); mwebview.getsettings().setappcacheenabled(true); mwebview.getsettings().setdomstorageenabled(true); // how plugin enabled alter in api 8 if (build.version.sdk_int < 8) { mwebview.getsettings().setpluginsenabled(true); } else { mwebview.getsettings().setpluginstate(pluginstate.on); } mwebview.loadurl("http://player.vimeo.com/video/24577973?player_id=player&autoplay=1&title=0&byline=0&portrait=0&api=1&maxheight=480&maxwidth=800"); this reply specific vimeo only. after dozen failed attempts, here's have working. perhaps help else. one thousand apologies original authors of other answers. have 'borrowed' number of patterns...

c# - Why Masked Textbox Not Working 00-00-1900? -

c# - Why Masked Textbox Not Working 00-00-1900? - i new winforms. when trying implement masked text box, got 1 error. i want mask of 00-00-1900 00 handle number, 19 fixed , cannot overwritten user. how do that? examples of valid input 19-12-1988 , 12-01-1958 . 00-00-1900 in mask take --1___ because 0 , 9 masked text refers, numeric. 0 - digit, required. element take single digit between 0 , 9. 9 - digit or space, optional. you right click masked text box, , go property. click , alter mask 00-00-1\900. you want. 1900 1999 in 1900. c# winforms maskedtextbox

licensing - A license free for free software but a fee for commercial software? -

licensing - A license free for free software but a fee for commercial software? - i looking license allows developers release software freely/non-commercially utilize software without cost, releases commercial software needs purchase license. i've been looking @ gnu licenses seem free both commercial , non-commercial use. what commonly used licenses in case? there can no general reply question, either creating own software license (which can not free in the free software definition because restrict commercial use) or can seek accomplish similar dual licensing following: the public , freely available software available under free software license strong copyleft gnu affero general public license (agpl). entity making utilize of software must publish source , changes it's users under same license (reciprocal, asp loophole closed). you can create software practicable incompatible open source software choosing open software license (osl). it's incompati...

replace - cloning elements with jquery -

replace - cloning elements with jquery - i working on form user can add together rows wants to. there link named "add row", when clicked, want clone hidden table , alter it's name values, of class names. help me this? <table class="montaj montaj-satir"> <tr> <td width="62px"><input type="text" name="oper[--number--][kodu]" size="4" maxlength="4" /></td> <td width="38px"> <input type="checkbox" name="oper[--number--][onay]" value="1" /> <input type="hidden" name="oper[--number--][terminal_hatasi]" value="0" /> <input type="hidden" name="oper[--number--][soket_hatasi]" value="0" /> <input type="hidden" name="oper[--number--][montaj_hatasi]" value="0" /...

java - How to configure and use DailyRollingFileAppender for logging in Android -

java - How to configure and use DailyRollingFileAppender for logging in Android - i'm using android-logging-log4j-1.0.2.jar , log4j-1.2.16.jar doing logging in android. requirement creating new log files dependent on date on daily basis. figured out thing can achieved using dailyrollingfileappender but i'm unable configure logging purpose. what standard methods logging in android, , how configure android-logging-log4j-1.0.2.jar , log4j-1.2.16.jar libraries use-case. java android log4j

winforms - C# How to change Data type of a Datagridview Column? -

winforms - C# How to change Data type of a Datagridview Column? - i have datagridview containing 5 columns. out of these columns 1 contains date values. it shows date in mm/dd/yyyy format, want in dd/mmm/yyyy or dd/mm/yyyy format. in database datatype of column smalldatetime , using sql 2008. you can seek setting defaultcellstyle.format dd/mmm/yyyy particular column c# winforms sql-server-2008 datetime

wpf - Storing Image paths in XML and then returning image with query results -

wpf - Storing Image paths in XML and then returning image with query results - i'm new development , so, i'm trying build little programme allow users search employee name , homecoming other info including staff photo. building in wpf, c# code behind , staff details stored in xml file. i can staff details xml searching need image returned can displayed in datatemplate results. how best store info in xml , retrieve along search results? thanks in advance. mark <window.resources> <datatemplate x:key="searchresultstemplate"> <grid margin="4,0,4,8" width="446" height="68"> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <border verticalalignment=...

c++ - GetCurrentConsoleFont not declared in scope, what I do wrong? -

c++ - GetCurrentConsoleFont not declared in scope, what I do wrong? - at origin have: #include <sstream> #include <iostream> #include <stdio.h> #include <iomanip> #include <string> #define _win32_winnt 0x500 //tells win 2000 or higher, without getconsolewindow not work #include <windows.h> using namespace std; int main() { pconsole_font_info lpconsolecurrentfont; getcurrentconsolefont(getstdhandle(std_output_handle), false, lpconsolecurrentfont); homecoming 0; } and undocumented function setconsolefont works, getcurrentconsolefont fails @ compilation saying not declared in scope. -- edit: changed self sustained code. getcurrentconsolefont exported on nt4+ @ least, mingw headers must wrong. try adding code after #include's: #ifdef __cplusplus extern "c" { #endif bool winapi getcurrentconsolefont(handle hconsoleoutput,bool bmaximumwindow,pconsole_font_info lpconsolecurrentfont); #ifdef __cplusplus } #...

python - Modify db parameter group in AWS RDS using boto -

python - Modify db parameter group in AWS RDS using boto - trying modify database parameter grouping on aws rds boto, nail upon error below: from boto import rds conn = rds.connect_to_region('eu-west-1', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) pg = conn.get_all_dbparameters('mygroup') pg.add_param('slow_query_log', true, 'immediate') typeerror "unknown type (<type 'str'>)" file: /usr/local/lib/python2.6/dist-packages/boto/rds/parametergroup.py, line: 175 any help appreciated try this: pg = conn.get_all_dbparameters('mygroup') pg2 = conn.get_all_dbparameters('mygroup', marker = pg.marker) pg2['slow_query_log'].value = true pg2['slow_query_log'].apply(true) the conn.get_all_dbparameters() method returns max. 100 rows. there 180 db parameters can modified. hence have query in 2 steps. first method phone call returns marker ca...

jQuery append different text each click -

jQuery append different text each click - i have basic jquery function going on: $("#selector").click(function(){ $("#target").append("some text added..."); }); that works fine, except want append different text on each sequential click. example: first click appends text "message 1" second click appends text "message 2" third click appends text "message 3" and on , forth... also, set limit, say, 4 after 4 clicks, nil else happens. any help appreciated. var messages = [ 'first click appends text "message 1"', 'second click appends text "message 2"', 'third click appends text "message 3"' ]; var = -1; var target = $("#target"); $("#selector").click(function(){ target.append(messages[i = ++i % messages.length]); }); this "append" them. if wanted replace each message each time, you'd utilize .te...

avr gcc - How to know the final program size after compilation on avr32 -

avr gcc - How to know the final program size after compilation on avr32 - i using avr studio 5. controller at32uc3a0512. want know final programme size occupied on flash before burning program. please allow me know how know this? hi command avr32-size.exe [option(s)] [file(s)]. utilize this: navigate output directory avr32-size.exe -project.elf the latest studio build should default when rebuilding finish project. show in output tab.(open view->output or alt+2 size avr-gcc

api - facebook fanpage my application permissions likes users -

api - facebook fanpage my application permissions likes users - myname tolga have problem :( i have facebook aplication. users likes fan page sample https://api.facebook.com/method/stream.addlike?uid=".$user."&post_id=".$post."&access_token=".$tokken."&format=json like user post id. access_token have automatically it i want to.like lastly visit, page . thanks. waiting help :( the rest api deprecated. see: https://developers.facebook.com/docs/reference/rest/ i suggest recoding newer api , see if issue still exists. facebook api like

ruby on rails - can I serve assets from inside of a gem -

ruby on rails - can I serve assets from inside of a gem - i bundle mutual assets css, js, , icon images gem personal use. can utilize assets within of gem directly, or have have generator move them main app? what need is: make railtie: module mygemname module rails class engine < ::rails::engine end end end put them in directory otherwise proper asset path, lib/assets/stylesheets . use sprockets include javascripts: //= require "foobar" use sass include stylesheets: @import "foobar"; use sass function image-url if refer images within stylesheets: .widget { background-image: image-url("widget-icon.png"); } the assets directory should behave same if within own application. you can find illustration in formalize-rails, has stylesheets, javascripts , images. ruby-on-rails ruby-on-rails-3 asset-pipeline

iphone - Why is my ScrollView code not displaying? -

iphone - Why is my ScrollView code not displaying? - i have copied files across 1 project another. code displays view can scroll horizontally between items, , scroll downwards each item. the code in project mainwindow.xib , relevant name in plist file. i'm putting code empty opengl es project has no nib info in plist file, , 2 nib files called "projectnameviewcontroller_iphone.xib" , "projectnameviewcontroller_ipad.xib" when run program, none of code displays. have feeling problem lies adding subviews view controller, , calling line: - (id)initwithpagenumber:(int)page { if (self = [super initwithnibname:@"myview" bundle:nil]) { pagenumber = page; [self.view addsubview:newsitem]; } homecoming self; } first of all, it's odd me string here "myview" , not "mainwindow" there nil in project called "myview" (i've searched project directory , code beingness called) bu...