Posts

Showing posts from February, 2015

git - Push to remote server and Github -

summary: want edit files locally, push both github , web server. i have 2 remotes set without issue, right sort of able this; however, have have branch checked out locally, , branch b on server. have ssh server , check out branch (the 1 want). don't want or need second branch, many posts suggest can't or shouldn't push non-bare repository. there must better way. using rsync easier (and did while). strangely, never happens on github. repos have 1 branch , i've never gotten warning. the warning message says can set receive.denycurrentbranch ignore, don't know how safe/sane is. i'm hoping understand vague description (which due limited knowledge of git) , know optimum solution. it easier set-up post-receive hook on bare repo on web server. way, hook can: change directory , pull new changes actual non-bare repo checkout branch want see " git post-receive hook website staging " , work in " using git manage web site ": ...

java - How can I view javadocs without adding them to the package through their generation? -

i want see javadocs in eclipse 3.7. if use "generate javadocs", javadocs added project in 'docs' folder. prefer view javadocs, without them being permanently added project. there more elegant way generating , deleting them? you can view java docs using above method mentioned in comment. if not find docs attached it, can attach source. can point source folder of java installation directory (i.e src.zip) taken care eclipse view docs irrespective of project. hope helps.

How to get multiple names in a jQuery element selector? -

i want apply script on multiple pages var should read 3 names not one; how looks now: var first; $(document).ready(function() { first = $('[name=body]').val(); }); need or " || " or , " && " how name 'body','body2' , 'body3', depends on page it. please help thanks all, you can list multiple items in selector, this: var body; $(function() { body = $('[name=body], [name=body2], [name=body3]').val(); });

php - Redirect user after session_write and setcookie -

i want redirect user after login page, "header cannot modified" error. know there should not echo or else before header() command how done in normal way. user logs in, cookies set (also session set), user gets notification things went right way , redirected page? here's php file: <?php $qry="select * user email='$email' , password='".md5($_post['password'])."'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { $member = mysql_fetch_assoc($result); $_session['sess_member_id'] = $member['id']; $_session['email'] = $member['email']; session_write_close(); if($remember_me == 1) { setcookie("user",$email,time()+(3600*24*365)); setcookie("pw",md5($_post['password']),time()+(3600*24*365)); } //header("location: logged.php"); <- doesn't work ...

javascript - Ajax & jQuery: Sending data to php script -

$("a.star").click(function(e){ e.preventdefault(); var dataid = $(this).data('id'); $.ajax({ type: "post", url: "/engine/save.php", data: "id=dataid" success: { alert("ffs work " + data); } }); return false; }); <a href="javascript:void(0)" data-id="7" class="star">test</a> how can send data-id save.php (/engine/save.php?id=7) successfully? tried , no luck. just with data: { id : dataid }, the benefit of using object (instead of string concatenation) don't need worry escape value passed along ajax call

objective c - Exception thrown on device, but not in simulator -

Image
i'm getting strange behavior when run app. in simulator, app runs fine. on device, exception thrown. i'm new ios, i'm lost on one. have breakpoints set exceptions , output prints lldb . also, i'm not sure if relevant, when first occurred yesterday, device crashed , deleted apps. had restore morning. tried restarting both mac , device. i didn't realize there "continue" button in console. when clicked, printed error.

glassfish - What is the difference in java.lang.OutOfMemory: GC Overhead limit exceeded vs. java.lang.OutOfMemory: Multicast listener -

i investigating slowness in our application , 1 of instances in cluster environment going down. few weeks came across error below: [#|2012-05-11t14:12:03.460-0400|severe|sun-appserver2.1|javax.enterprise.system.container.web|_threadid=89;_threadname=httpsslworkerthread-7311-0;_requestid=7afaee11-c970-40dd-b5fb-29498af8e512;|standardwrappervalve[loginmodule]: pwc1406: servlet.service() servlet loginmodule threw exception java.lang.outofmemoryerror: gc overhead limit exceeded i figured since gc overhead limit exceeding, had application. there report intensive on putting records in excel using poi, thought might causing it. short term fix, until next release, informed 1 user had access report not access it. however, today, 2 weeks later again 1 of instances went down , upon searching logs found error below: [#|2012-06-05t10:31:36.532-0400|severe|sun-appserver2.1|net.jxta.impl.endpoint.mcast.mcasttransport|_threadid=141;_threadname=ip multicast listener mcast://228.8.10.93:3167...

css - Positioning context on table-cell element in Firefox -

usually, can set parent element context child's absolute positioning, follows: #parent { position: relative; } #child { position: absolute; top: 0; left: 0; } this works fine, when parent has display property set table-cell , doesn't work in firefox. positioning context child element closest positioned ancestor above parent. of note, works everywhere else. tested in ie8, ie9, safari, chrome & opera. see fiddle here: http://jsfiddle.net/rz5vx/ also, see this fiddle parent's display set inline-block , work in firefox. so, bug? if so, there anyway work around it? a table-cell meant inside table , so: see working fiddle! div { display: table; /* line */ line-height: 28px; padding: 0 20px; background: #ddd; position: relative; } note: since don't have table in there, set it. you can see quirksmode the display declaration . edited from w3c recommendation :: tables reads the co...

javascript - JSON object null in browser but not firebug -

when step through javascript code (scoreboard.js) in firebug, works fine alerts. when don't put line break in firebug , run normally, received "favs null" message (no alerts). var favs = $.getjson("favs.json"); favs = $.parsejson(favs.responsetext); favs = favs.myteams; (i=0; i<favs.length; i++){ alert(favs[i].text); } the json (favs.json) {"myteams":[{"sport":10,"id":10,"abbrev":"nyy","isfav":false,"text":"new york yankees","sw_abbrev":"nyy"},{"sport":28,"id":19,"abbrev":"nyg","isfav":false,"text":"new york giants","sw_abbrev":"nyg"},{"sport":46,"id":18,"abbrev":"ny","isfav":false,"text":"new york knicks","sw_abbrev":"nyk"},{"sport":90,"id":11,...

jquery - How to toggle a bootstrap alert on and off with button click? -

i want display alert box multiple times button click event without having refresh page alert box shows once. if want show alert box again, have refresh page. currently if render bootstrap alert on page, when close it, div container of alert gone page. when click button again, doesn't show anymore. have been doing following on close button make hide instead of delete div container of alert. <button class="close" onclick="$('#alertbox').hide();; return false;">×</button> i wonder if using data-toggle or data-dismiss in bootstrap can make sort of toggle effect working without going through own custom javascript handlers. i've had same problem: don't use data-dismiss close button , work jquery show() , hide() : $('.close').click(function() { $('.alert').hide(); }) now can show alert when clicking button using code: $('.alert').show() hope helps!

gcc - Anyway to see list of preprocessor defined macros? -

i'd see macros defined invocation of compiler i'm using. there way this? have seen in manual says can use cpp -dm doesn't work me. perhaps i'm doing wrong? when run: cpp -dm i no output @ preprocessor. if try adding -dm option on gcc, don't notice difference. you can use: gcc -dm -e - < /dev/null note can compiler macros in addition command: touch bla.c && gcc -dm -e bla.c for example on computer: $ touch bla.c && gcc -dm -e bla.c | wc -l 486 $ gcc -dm -e - < /dev/null | wc -l 124 $

For mxmlc (flex flash compiler), what is the target player if no -target-player is set? -

i'd know target-player given flex sdk 3.2, 3.5, , 4.6 if no -target-player command line option specified. i think minimum version supported sdk, can't find documentation confirm. thanks from docs : if not explicitly set value of option, compiler uses default flex-config.xml file. value in flex-config.xml version of flash player shipped sdk. i'm pretty sure flex-config.xml file should somewhere in sdk directory.

wpf - DataGrid decimal format converter -

i have never used wpf datagrid before , trying format decimal columns use specific value format based on other columns values of row. using infragistics xamdatagrid in past, able set styles xamcurrencyeditor, setting values "format" , "mask" , use multi value converter wrote, passing along dataitem. the grid columns created programatically. so, create field so: var field = new datagridtextcolumn { header = item.name, binding = new binding("[" + item.name + "].value") { mode = bindingmode.twoway } }; this field contain decimal values (even though column text column). how can add formatting column takes account other values in data object? not sure how reference actual bound data row pass along data along cells value converter. not sure how work if decimal string xaml syntax decimal property binding stringformat=decvalue: {0:n2}}

sql - Building a search script in PHP -

i'm trying build search script in php-sql facebook or stackoverflow uses. example, user may put in multiple entries; separated semi-colon , autocomplete on each term. also: values stored in sql; type of data should use or how should insert terms in sql table?? <script type="text/javascript"> $().ready(function() { $("#job_type").autocomplete("get_job_list.php", { width: 224, matchcontains: true, selectfirst: false }); }); </script> php code:: <?php require_once "connection.php"; $q = strtolower($_get["q"]); if (!$q) return; $sql = "select distinct itemid itemid eportal itemid '%$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $cname = $rs['itemid']; echo "$cname\n"; } ?> add chosen tags separated table structure query_id tag_id (you need table tags structure tag_id tag_name . way query way easier , faster. moreover, able popu...

replace class name with javascript -

i need finding element specific class name , replace new class name. here code came with. no results. class name not change, , there no errors in console. updated code : var classmatches = document.queryselectorall(".crux.attachflash"); (var = 0; < classmatches.length; i++) { classmatches[i].classname = " "; } because need amend class-name of matched element, not array of elements: var classmatches = document.queryselectorall(".crux.attachflash"); (var = 0; < classmatches.length; i++) { classmatches[i].classname = " "; } you forgot [i] index, trying set classname whole array (which, you've found, not work).

How to design schema relation in SQL to mongoDB? -

Image
i still confuse after read mongodb definitive guide , link http://www.mongodb.org/display/docs/schema+design there standard mongodb design schema database. have schema in mysql database below my database above fixed & ddl. please me show step design schema relation above mongodb. in advance it's easier think of mongo document storage system. looking @ schema.... of should go document per named thing in main table. however, depends lot on how use it. but, clear, there not straight conversion between relational model , document model.

regex - How do I group regular expressions past the 9th backreference? -

ok trying group past 9th backreference in notepad++. wiki says can use group naming go past 9th reference. however, can't seem syntax right match. starting off 2 groups make simple. sample data 1000,1000 regex. (?'a'[0-9]*),([0-9]*) according docs need following. (?<some name>...), (?'some name'...),(?(some name)...) names group name. however, result can't find text. suggestions? you can reference groups > 9 in same way < 10 i.e $10 tenth group. for (naive) example: string: abcdefghijklmnopqrstuvwxyz regex find: (?:a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p) replace: $10 result: kqrstuvwxyz my test performed in notepad++ v6.1.2 , gave result expected.

c# - Identifying a usercontrol in the same page in ASP.net -

am using user control c in page a. while doing submit / or action in user control ( contains grid edit delete functionality) , control goes parent page enters edit or delete function. how can identify control has been directed user control? please me out. thanks in advance how about if (sender c) // said usercontrol c { //your code here }

c# - How to get objectcontext from a control datasource -

i'm new in c# , entity framework. there way objectcontext control datasource ? i have 3 project , 2 entity framework , last 1 window form application. winform have 2 datagridview each 1 each ef project. the issue when want savechanges datagridview a, have call myef_a.savechanges() , when want save datagridview b, have call myef_b.savechanges() . is there solution, can call savechanges() method base on form.activecontrol (datagridview or datagridview b) tracing control.datasource objectcontext ? i'm afraid not. problem datasource of type "object". though cast original type, never use objectcontext binding object, collection. i may wrong though, please correct me if that's case here.

javascript - Jquery timepicker addon not working correctly -

i have code in view (js): $("#mydivelement").timepicker(); instead of timepicker, displays datetimepicker. have datepicker defaults set in layout page if matters: $.datepicker.setdefaults({ dateformat: 'dd/mm/yy', yearrange: '1930:2012', changeyear: true, changemonth: true, autosize: true, showanim: 'slidedown', firstday: 1 }); update: used library- jquery-ui-timepicker-addon.js you missing add {} inside of .timepicker() jquery $(function() { $( "#mydivelement" ).datepicker({ dateformat: 'dd/mm/yy', yearrange: '1930:2012', changeyear: true, changemonth: true, autosize: true, showanim: 'slidedown', firstday: 1 }); $('#timepicker').timepicker({}); // shows timepicker without datepicker }); jsfiddle example

html - fixed left column vertically, but scrollable horizontally -

in web page there 3 columns, left, middle , right; within 3 columns left column position:fixed , others normal. while vertical scrolling, left column should remain fixed while others scrolling. but when browser size reduced; while horizontal scrolling 3 columns should scrollable horizontally not middle , right. how overcome problem ? pure css (without using js or jquery)? there has been similar question , jquery solution provided. have @ here see if answers provided you:- how fixed position div scroll horizontally content? using jquery

c - What is char * const *? -

so seems means a pointer constant pointer char . points char * const , far good. what gets me confused , how saw used. looking @ man page qsort , example following convert pointers elements of char ** (an array of strings), (pointers elements seen const void * ) normal char pointers feedable strcmp : static int cmpstringp(const void *p1, const void *p2) { /* actual arguments function "pointers pointers char", strcmp(3) arguments "pointers char", hence following cast plus dereference */ return strcmp(* (char * const *) p1, * (char * const *) p2); } my question is, why there cast char * const * ? why isn't const char ** (because want send const char * strcmp )? char * const * indeed means pointer constant pointer chars. reason cast performed in code in question following: p1 , p2 (non-const) pointers constant location. let's assume type of location const t . now want cast p1 , p2 real types. know each eleme...

java - Selenium WebDriver set Attribute having webelement -

currently have problem - want switch out of current frame parent. application have lot of of inner frames, using driver.switchto().defaultcontent() not case. in discussion possible solution suggested - should remember frames visited , and iterate on them top using driver.switchto().defaultcontent() the main problem in fact, in application i, sometimes, forced use switching frames located xpath , other locators - use switch webelement. , mentioned in discussion above after switching located webelement becomes invalid , can't used switching. should have way find element inside frame again. although can locate index of frame element executing js calls(i.e (webelement)executescript("window.frames[i]").equals(mywebelement) ), not case index may change when frames deleted page. either can try find frame names , id's may not specified. so see possible solution - set attribute frames parent of selected - example attribute active value true. should able methods ...

iphone - Error when updating video on brightcove in objective c -

hi trying update video on bright cove when send request returns error in return. request json wich send {"method":"update_video","params":{"video":{"id":"myid","economics":"ad_supported"},"token":"mytoken.."}} and response is {"name":"missingjsonerror","message":"could not find json-rpc.","code":211}, "result": null, "id": null} here can find brightcove api error details . error, reason listed as: 211 missingjsonerror not find json-rpc. got null string either json parameter (for non-multipart post) or first part of multipart post. it looks result telling id null. if passing id, check exists , id type brightcove expecting (ie, brightcove id vs. reference_id). you can check api params here: brightcove video cloud / media api reference

accessing session data in rails models -

i need check whether thing's id in session variable. my instinct add method thing model checks see whether thing's id in array stored in session variable. class thing < activerecord::base ... def pinned? session[:pinned].include? self.id end end the functionality trying create user selects bunch of different things list, stored in per-user session , retrieved @ later date printing. rails seems prevent session access in model without hackery, i'm keen avoid. maybe i'm approaching problem wrong way round, or pinned? function belongs somewhere else? thanks. maybe pass method argument instead of accessing directly? def pinned?(things) things.include? self.id end thing.pinned?(session[:pinned])

Java stored procedure batch with multiple OUT params -

i'm using oracle db. and need call stored procedure sequentially 1000 times. stored procedure has several in params , out params. i'm doing under 1 transaction. using java's for-each loop , using spring's storedprocedure within of it. transaction takes 4 seconds. , it's not cool. need speed-up transaction time. there way that? thanks in advance write wrapper stored proc calls other ones, inputting data wrapper proc hashmap, or similar (see http://docs.oracle.com/cd/b19306_01/java.102/b14355/oraarr.htm#g1072333 ), storing output in cursor , returning out java. call wrapper java. let db heavy lifting , entire job runs in 1 db tx.

javascript - Looping Through className index not working...Alternatives? -

wins.push(document.getelementsbyclassname("page")[x].attributes["id"].value); this code for() loop in javascript, using variable 'x'. unlike google chrome, firefox , opera don't seem comprehending fact variable index of class wish attribute "id" from. is there alternative method? i think should work out function findpageclasses() { var pageclasses= document.getelementsbyclassname("page"); for(var i=0; i<pageclasses.length; i++) { wins.push(pageclasses[i].attributes["id"].value); } }

android - cfheader cfcontent Mobile Browser download unsuccessful -

i'm serving .epub file download without displaying url client. code below works in browser on pc/mac not work in mobile browsers, @ least in android have testing currently. 'download unsuccessful' message every time. ideas??? code: <cfheader name="content-disposition" value="attachment;filename=#authstuff.lastname#-#thetitle#.epub" /><cfcontent type="application/unknown" file="d:\home\sample.net\booksource\#book.epub#"> all examples i've seen , used ave space between attachment; , filename, try: <cfheader name="content-disposition" value="attachment; filename=#authstuff.lastname#-#thetitle#.epub" /> also, use firebug or fiddler make sure header coming through unaltered. desktop browsers prompt save right filename? edit: tried code out on ios pdf , happily consumed pdf, space may red herring, makes me think it's worth trying out code below try see if it's epub...

Using DRAKON with python's try: except: exceptions -

Image
is familiar drakon? i quite idea of drakon visual editor , have been playing using python -- more info: http://drakon-editor.sourceforge.net/python/python.html the thing i've had problem far python's try: except: exceptions. way i've attempted use branches , define try: , except: separate actions below branch. thing drakon doesn't pick try: , automatically indent exception code afterwards. is there way handle try: except: in visual way in drakon, or perhaps you've heard of similar visual editor project python? thanks. you put whole "try: except:" construct inside 1 "action" icon this: both spaces , tabs can used indentation inside icon.

android - AdMob ads not showing up at all -

so downloaded latest admob sdk. followed instructions importing project, etc. then did thing allows ads in 2.3.3 changing project.properties target android-13 , set min-sdk 10. also declared in manifest : <activity android:name="com.google.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize"/> declared adview in xml : <com.google.ads.adview android:id="@+id/adview" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adunitid="xxxxxx" <!--replaced xxxxxx publisher id--> ads:adsize="banner" ads:testdevices="xxxxx" <!--replaced xxxxx device id--> ads:loadadoncreate="true"/> after of ad doesnt show up!! in grapical ...

jquery - Search an DOM element by attribute name -

how can search (using jquery) dom element has attribute given name (not attribute value)? for example: <div id="div1"> <div id="div2" myattr="myvalue"> </div> </div> i search every element under #div1 (inclusive) has has attribute named myattr (so #div2 element returned). use selector: $('#div1[myattr], #div1 [myattr]') this #div1 attribute myattr , items under #div1 has attribute named myattr . documentation

How to set maximum characters per line for text view in android -

hiii all, may possible duplicate couldn't find solution problem.i need limit number of characters per line when displaying on textview , display remaining characters in next line.i cannot set ems value , tried setting maxlength attribute in xml not displaying remaining characters,can 1 tell me how can it. using android:maxwidth="size" replace "size" size prefer. example, 100dip .

java - Trying to have a view reflect an editor's status -

i have view want react happens in editor. right have button want when clicked updates data in view new set of information. start, have selection event no idea on how communicate between two. i'm looking loose coupling solution. i'm sure there many ways of doing this, i've used jface ipropertychangelistener interface in past simple event propagation. make view implement ipropertychangelistener. create singleton class can register ipropertychangelistener with, , send propertychangeevent to. in constructor of view, register singleton. now can hold of singleton in editor , fire off event picked in view. example code singleton: public class propertychangeeventbus { private static propertychangeeventbus s_instance = new propertychangeeventbus(); public static propertychangeeventbus instance() { return s_instance; } private set<ipropertychangelistener> m_listeners; private propertychangeeventbus() { // u...

wpf - How to take action if user tries to check/uncheck a checkbox by keyboard or mouse? -

i'm writing app (wpf mvvm) , need prompt user whenever tries chek/uncheck checkbox (and other controls i'll focus on checkbox post). need him confirm via messagebox whether wants continue action started checkbox, have messagebox question previewmouseleftbuttondown event, told me: if check/uncheck using keyboard? is there analog keyboard event can hook code have previewmouseleftbuttondown event prompt shown anytime check/uncheck checkbox? there previewkeydown/keyup event on control can attach icommand (for mvvm style) or wireup code behind event (for non-mvvm). the event can display message box , if needed can cancel operation using: if(e.key == key.space) { //todo: processing message box e.handled = true } the above mark event chain handled further events in pipeline not executed. note key.space can replaced may want capture or removed if want capture everything.

visual studio - Entity Data Model Wizard not showing Microsoft SQL Server Compact 3.5 in vs 2012 -

i have sql compact 3.5 edition trying generate edmx file using entity data model wizard. using visual studio 2012 beta ultimate. i trying generate model (generate database). create new connection, selecting change data source. here not able see microsoft sql server compact 3.5 database file. but see in vs 2010. how do create entity model sql ce 3.5 , visual studio 2012? sql server compact 3.5 not supported server explorer etc in vs 2012. update latest version of free sql server compact toolbox addin adds support connecting sql server compact 3.5 files server explorer working entity framework tools

Rails: method defined in application_helper.rb not recognized by categories_controller.rb -

more newbie issues. i understand if define method in application helper, available entire app code. in applicaton helper, have: def primary_user_is_admin if current_user user_login_roles = json.parse(current_user.role) if user_login_roles["admin"] return 1 end end return nil end if call categories_controller: if !primary_user_is_admin redirect_to root_url end i error message: undefined local variable or method `primary_user_is_admin' this happens if put primary_user_is_admin code in registrations_helper.rb file however, if use in of views (views/user/edit.html.erb instance) <% if primary_user_is_admin %> <% end > then works. missing? helpers not included controller default. can include applicationhelper to gain access methods in applicationhelper module. previous discussion has bunch of useful solutions accessing helpers in controller.

networking - Data Link Layer and Transport Layer -

what need of error control @ data link layer when transport layer provides error control ? difference between 2 error controls ? transport layer data broken down many data-link layer frames/packets. so possible without data-link errors transport layer stream/packet may corrupt. edit: because transport layer path composed of many data-link layer hops , example: host1 <----> switch1 <----> switch2 <----> host2 if packet lost between switch1 , switch2 there no errors recorded on switch2 host2 link, corresponding transport layer stream corrupted. on other hand - once data-link error encountered it's possible drop/restart transport-layer transmission, without wasting resources.

html - Disable form autofill in Chrome without disabling autocomplete -

this question has answer here: disabling chrome autofill 64 answers how can disable chrome's autofill feature on <input> s prevent them being automatically populated when page loads? at same time need keep autocomplete enabled, user can still see list of suggestions clicking on input or typing in it. can done? edit: feel free use plain javascript or jquery if feel necessary or feel make solution simpler. here's magic want: autocomplete="new-password" chrome intentionally ignores autocomplete="off" , autocomplete="false" . however, put new-password in special clause stop new password forms being auto-filled. i put above line in password input, , can edit other fields in form , password not auto-filled.

google chrome - Chome API manifest dynamic url permission based on default search engine? -

is there way extract url default search engine (for omnibox) , include within url permissions scope? quick answer no, there no such api that. unless want use npapi plugin, can anything. if can access default search engine reading chrome files, according this post , it's in sqlite database.

In Java how to shutdown executorservice when it may submit additional tasks to itself -

i have pipeline of tasks (each task in pipeline has different parallelism requirements), each task works in different executorservice. tasks work on packets of data, if have 10 datapackets 10 tasks submitted service1 , 1 task per data packet. once task submitted service1 has invoked may submit new task work further on datapacket service2 , service3 or not. the following code works fine, i.e.: shutdown() invoked on service1 after has been submitted service1 then awaittermination() not return until tasks submitted before shutdown() have completed running. -- shutdown() invoked on service2 because tasks submitted service1 have completed, , tasks submitted service2 tasks on service1 tasks have been submitted service2 before shutdown() called on service2 . -- , on service3 executorservice[] services = { service1, service2, service3}; int count = 0; for(executorservice service: services) { service.shutdown(); service.awaittermination...

html - HAML loses my <td> tag -

i have following haml .x-row-tpl %tds {{#parent}}{{name}}{{/parent}} %td {{#parent}}{{name}}{{/parent}} %p {{#parent}}{{name}}{{/parent}} it's rendered html (i mean in browser) as: <div class="x-row-tpl"> <tds>{{#parent}}{{name}}{{/parent}}</tds> {{#parent}}{{name}}{{/parent}} <p>{{#parent}}{{name}}{{/parent}}</p> </div> why haml skips <td> tag on rendering? i tried wrap :erb , not doesn't help. tried different tag names, invalid tags (like <tds> ), working fine, except <td> . your html invalid following reasons: your tag named <tds> , isn't valid. should <td> . a <td> tag's valid parent element <tr> . when valid tag element in invalid location, browser free remove or move tag. when invalid tag name used, browser free whatever wants—afaik in modern browsers treated <div> . always sure final html passes w3c's html validator . if ...

java - How to increment a number from a saved text file? -

*how increment number read saved text file? i'm trying add account number read file array , when add new data array account number should auto increment of existing account number. problem code woks fine until save file. when re-open application account number starts beginning i.e if saved acc number 100,101 when re-open application acc number starts 100 again. please can 1 me read file , write file.* the array starting beginning when restart application.but wondering if 1 can me find solution this this code import java.io.serializable; public class student implements serializable { //-------------------------------------------------------------------------- protected static int nextbankid=1000; protected int accountnumber; protected string fname; protected string lname; protected string phone; //-------------------------------------------------------------------------- //constructor public student(string fname, string...

database - Polymorphic association to either another model or parent model -

Image
i have model in rails called recipe. recipe model contains ingredients. each ingredient line has association food model or recipe. basicly want polymorphic association food model , recipe model. when made change, recipe_id in ingredient class null. there obvious wrong in associations? class recipe < activerecord::base has_many :ingredients, :as => :element end class food < activerecord::base has_many :ingredients, :as => :element has_many :recipes, :through => :ingredients end class ingredient < activerecord::base belongs_to :element, :polymorphic => true belongs_to :recipe end so, ingredient line recipe can contain recipe or element food table (and each recipe can contain number of ingredient lines). here drawing representing want: and here how schema looks in rubymine: the problem recipe_id in ingredient lines (which parent table) null relation has stopped working when started implementation of polymorphic association. here in...

api - get access to com.android.internal.telephony.Call -

i need access com.android.internal.telephony.call. doing so: // initialize telephony framework phonefactory.makedefaultphones (this); // default phone phone phone = phonefactory.getdefaultphone (); callmanager mcm = callmanager.getinstance (); mcm.registerphone (phone); call call = mcm.getfirstactivebgcall(); but not extend initialize framework. help me initialize call. i need read state of call like: idle, active, holding, dialing, alerting, incoming, waiting, disconnected, disconnecting. thanks help!!! you need make use of phonestatelistener provide facility have application listen different state of phone call. need put <uses-permission android:name="android.permission.read_phone_state"/> in manifest file

How to store binary data in MySQL -

this question has answer here: binary data in mysql 10 answers how store binary data in mysql database? this question not straight forward answer, sounds: there lots of different binary data usage patterns out there, each own caveats , pros , cons. let me try summarize: short pieces of binary data, such password hashes, work base64-encoding them , storing resulting string varchar "not-quite-binary" data, such document snipplets occasional non-printable can escaped , sored string the blob datatype allows store arbitrary chunks of binary data, recommend against using it: store data in file, store path file in string type. gain nothing storing binary data, db doesn't "understand" in db.

php - Stripos issues in php4 -

please have following function contact form, shows following error "fatal error: call undefined function: stripos() in" how can fix it function checkemail($vemail) { $invalidchars ="/:,;" ; if(strlen($vemail)<1) return false; //invalid characters $atpos = stripos($vemail,"@",1); //first position of @ if ($atpos != false) $periodpos = stripos($vemail,".", $atpos); //if @ not found null . position ($i=0; $i<strlen($invalidchars); $i++) { //check bad characters $badchar = substr($invalidchars,i,1); //pick 1 if(stripos($vemail,$badchar,0) != false) //if found return false; } if ($atpos == false) ...

.net - Is there a way to speed up reading the data? -

in program created following logic reading data database , storing list<>: npgsqlcommand cmd = new npgsqlcommand(query, conn); list<userinfo> result = new list<userinfo>(); npgsql.npgsqldatareader rdr = cmd.executereader(); while (rdr.read()) { string userid = rdr[0].tostring(); string sex = rdr[1].tostring(); string strdatebirth = rdr[2].tostring(); string zip = rdr[3].tostring(); userinfo userinfo = new userinfo(); userinfo.msisdn = userid; userinfo.gender = sex; try { userinfo.birthdate = convert.todatetime(strdatebirth); } catch (exception ex) { } userinfo.zipcode = zip; ...

.net - Uploading a file to sharepoint using WebDav protocol and VB.NET -

i trying upload file sharepoint. authorization works fine, ends status ok instead of created . file not created. not understand why it's happening since used approach seems work others (no complaints). here's code using: public sub create() dim szurl1 = "http://host.domain.com/p/projects/4/proposal/cze.txt" dim szcontent = string.format("date/time: {0} {1}", datetime.now.toshortdatestring(), datetime.now.tolongtimestring()) 'define username , password strings. dim domain = "domain_name" dim szusername = "user_name" dim szpassword = "password" dim httpputrequest httpwebrequest = directcast(webrequest.create(szurl1), httpwebrequest) httpputrequest.credentials = new networkcredential(szusername, szpassword, domain) httpputrequest.preauthenticate = true httpputrequest.method = "put" httpputrequest.headers.add("overwrite", "t") httpputrequest....

What is implemetation difference between dojo.aspect and dojox.lang.aspect -

while implementating aspect oriented programming getting confuse why dojo having 2 differentaspect library files? when use dojo.aspect , dojox.lang.aspect ? i have never heard dojox.lang.aspect before, according git log latest commit dates 2008. you can find explanation why dojox.lang.aspect exists in article author eugene lazutkin: aop aspect of javascript dojo . while doesn't make sense in cases, should realize primary role of dojo.connect() process dom events. [...] to sum up: events != aop. events cannot simulate aspects of aop, , aop cannot used in lieu of events. so aop in javascript sounds simple! well, in reality there several sticky places: implementing every single advice function expensive. usually iterations more efficient recursive calls. the size of call stack limited. if have chained calls, it'll impossible rearrange them. if want remove 1 advice in middle, out of luck. the “around” advice “eat...

r - How to find highest value in a data frame? -

i have dataframe x values: x1 x2 x3 1 na 4 1 2 na 3 na 3 4 na 2 4 na 1 11 5 na 2 na 6 5 na 1 7 5 9 na 8 na 2 na a simple question: how highest value? (11) use max() na.rm argument set true : dat <- read.table(text=" x1 x2 x3 1 na 4 1 2 na 3 na 3 4 na 2 4 na 1 11 5 na 2 na 6 5 na 1 7 5 9 na 8 na 2 na", header=true) get maximum: max(dat, na.rm=true) [1] 11

Using the DataView in XPages Extension Library Mobile Controls -

on page 1 of mobile app need display categories categorised view. when user selects category app should transition page 2 showing documents in selected category. customer not want category expand/collapse on first page of app. would use dataview this? advice on how best achieve this? thanks. if http://sutol.mapsys.cz/ (application in czech, can still see about) need, can send code. "dopoledne" , "odpoledne" categories

facebook - Using API To Post Links Does Not Include Picture, Title or Meta Desc PHP -

when posting using api receive this: https://www.facebook.com/weather.warnings/posts/329128793830700 notice how title, thumbnail , meta description missing thing. the following code using. $allalert = array ( 'oauth_token' => 'not pasting :p', 'message' => "new $type $where", 'link' => $url, ); $sendalert = $facebook->api('/125291287567922/links/','post',$allalert); referencing how 1 post thumbnail picture facebook /links object? says item pulls picture page itself thoughts? you can passing following items in array: 'name' => "post title", 'link' => "url page", 'message'=> "message", 'description' => "longer description", 'picture'=>"url of picture", 'caption' => "another bit of text" this removes reliance on fb scraper go out url , scrape , parse data.

compilation - C++: Quickly determine appropriate list of header includes? -

is there tool or method can speed process? for instance split neattrick.cpp source file 2 separate files neattrickimplementation.cpp , neattricktests.cpp. what have go through list of #includes @ top of neattrick.cpp , determine of them need go implementation file, , need go tests file. of headers required both of them, not. may unnecessary. i feel process (start nothing, compile, see what's broken, add proper include, compile again, repeat) produce unbloated code frustratingly slow. think it'd great if ide analyze rest of headers in project, see ones eliminate current set of errors, , automate task me. there talk chandler carruth on microsoft's "going native" (a c++ conference) said clang tooling project had in pipeline solve problem. from understanding, presented no publically available tool able @ moment , people pretty impressed this. so: at moment , there no such tool. in near future clang-based tool compile yourself. long-term , expe...

jsf 2 - a4j:commandButton passing values in callback -

i'm working jsf 2 , richfaces. can pass value bean oncomplete function in a4j:commandbutton? counter (int) example. you can use el in there. it's evaluated on per request basis. <a4j:commandbutton ... oncomplete="somefunction(#{bean.someintproperty})" /> note feature specific richfaces components. standard jsf components (and primefaces) evalute them on per view build time only.

java - Finding absolute value of a number without using Math.abs() -

is there way find absolute value of number without using math.abs() method in java. if inside math.abs can find best answer: eg, floats: /* * returns absolute value of {@code float} value. * if argument not negative, argument returned. * if argument negative, negation of argument returned. * special cases: * <ul><li>if argument positive 0 or negative zero, * result positive zero. * <li>if argument infinite, result positive infinity. * <li>if argument nan, result nan.</ul> * in other words, result same value of expression: * <p>{@code float.intbitstofloat(0x7fffffff & float.floattointbits(a))} * * @param argument absolute value determined * @return absolute value of argument. */ public static float abs(float a) { return (a <= 0.0f) ? 0.0f - : a; }

java - One security concept for multiple wars on embedded jetty -

i have embedded jetty server multiple wars. each war 1 part of 1 web application. goal add same security wars. preferred security mechanism spring security. there might 2 solutions: a) define security in each war. i define servlet filter in each web.xml. problem: how can use same security among different wars? redundancy: have add same config web.xml. b) define security filter path /* how can set spring security filter on jetty? what using apache shiro . see shiro vs. springsecurity further information. super simple application security apache shiro les hazlewood great introductory screencast.

c# - emgu two hands detection -

i want detect 2 hands (using hsv filtered image). the problem when 2 hands head gets in between , hands cannot recognized. im using haar detect 2 hands when application starts , turn image hsv (black , white). im using segmentation detect objects central mass can follow them. dismiss objects area small enough. any ideas how can solve problem ?

javascript - How I'll create a model from json file? (ExtJS) -

this model want create using json file ext.define('users', { extend: 'ext.data.model', fields: [{name: 'user_id', type: 'int'}, {name: 'user_name', type: 'string'}] }); what have in order automatically create model, based on content of json response server? in order have model created automatically, need include metadata field json data. metadata can used describe of fields model. in extjs 4.1 documentation - ext.data.reader.json has section called response metadata describes basic use of feature.

mysql - PHP array into one string -

i have 1 array filled mysql_query. values in array want put 1 continuous string example: $array = array(1, 2, 3, 4, 5); insert 'new_slovmas'.'$tabulka'('$array[0]', '$array[1]', '$array[3]') values ('$r_1', '$r_2', '$r_3')"; sense in 1 table on 50 columns not want fill manually, while or for. thinking putting values 1 string this: $array = array("'1',", "'2',", "'3',", "'4',", "'5',"); so have this: echo $array[2]; => '3', by cycle wont achieve having multiple entries in 1 variable. $str = $array[0], $array[1] ... $array[xy]; insert 'new_slovmas'.'$tabulka'('$str') values ('$r_1', '$r_2', '$r_3')"; use implode() $string = implode(',', array(1, 2, 3, 4, 5)); // $string = 1,2,3,4,5

osx - Is it possible to use LuaInterface in Mono/Mac OS? -

luainterface uses 2 .dlls: lua51 , luanet . while being able rebuild lua51 liblua5.1.dylib (and code found necessary entry points) im stuck luanet.dll . does have idea how build on mac os or if have avoid using entirely (at cost of losing such stuff objecttranslator , metafunctions)? i know there alternatives http://github.com/jsimmons/luasharp . you need configure dllmap tell luanet.dll should looked @ lua51.dylib http://www.mono-project.com/config_dllmap

performance - Why does my 'dns' lookup and 'connect' take over 2 seconds (57% of page load time)? -

Image
i found takes 2 seconds page display single thing (i'm assuming cause lookup taking longest) http://www.webpagetest.org/result/120613_qc_833b06d5bbdf38bafcff8ed2777be8ac/ how improve this, or rid of 2 second lag? i hosting on heroku, , dns setup in godaddy. dns not problem. take closer @ network waterfall chart . application.js file first performance culprit. if can: make smaller if can, move script tag bottom of page even better, if you're not doing document.write's in script, mark "async" with out of way, background next biggest problem - it's massive. perhaps worth reconsidering if should there if you're concerned speed.

jquery - Can't remove class from previously selected radio button -

what i'm trying have user click table selects radio button inside table , add class table selected. if user selects table when radio checked class added, class selected table/radio needs removed well. right of works, accept when select radio previous class isn't removed. if toggle radio removed. here's link demo on jsfidd can see html , other js. $(function() { $('table').click(function(event) { if (event.target.type != "radio") { var = $(this).find('input:radio'); that.attr('checked', !that.is(':checked')); if (that.is(':checked')) { that.closest('table').addclass('selected'); } else { that.closest('table').removeclass('selected'); } } }); }); i forgot using version before modified that. in 1 if click radio button style add/remove correctly not when cl...

asp.net - how update panel do partial postback and server side function is invoked and control UI updated -

Image
i search google lot know how update panel partial postback. if have 1 button & 1 label inside update panel , when click on button inside update panel partial postback occur , button click server side event called. if button click routine change label value effect after partial postback...i need how update panel call server side function , read response , update control ui @ cliend side.. kind of javascript generate , call make partial postback , how update ui. if possible please discuss in details sample javascript update panel generate handle postback , ui updation. thanks if totally new ajax (which stands stands asynchronous javascript , xml), ajax entry on wikipedia starting point there more links link1 or link2 : like dhtml , lamp, ajax not technology in itself, group of technologies. ajax uses combination of: html , css marking , styling information. dom accessed javascript dynamically display , interact information presented. method exchanging ...

Need DICOM dataset for 3D rendering -

i having tough time finding datasets of dicom 3d rendering. please note dont want dicom images or set of dicom images differernt perspectives. rather want dicom images 3d rendering. the place able needed is: http://members.tripod.com/~clunis_immensus/free3d/sample_data.htm i found link @ page: http://www.researchpipeline.com/mediawiki/index.php?title=sample_dicom_images there highly recommended link ( http://pubimage.hcuge.ch:8080/ ) on same page not open. can see cached page has rich datasets. there alternative link? the download site looking has been moved here .

sql server - hibernate - allow null value on FK -

i have 2 tables associated fk. table student mapped this: @entity @table(name="student") public class student implements serializable { ... @id @generatedvalue private int id; @manytoone(fetch = fetchtype.lazy, optional = true) @joincolumn(name = "school_id", nullable = true, insertable = false, updatable = false) private school school; private integer school_id; @transient private boolean editable = false; } table school : @entity @table(name="school") public class school implements serializable { ... @onetomany(fetch = fetchtype.lazy, mappedby = "school") private set<student> student = new hashset<student>(0); when try insert/update student, isn't @ school ( student.school_id null ) reports: exception: java.lang.exception: org.hibernate.exception.constraintviolationexception: not update: [tables.student#556758] ... caused by: com.microsoft.sqlserver.jdbc.sqlserverexception: update...

iphone - What is the difference between primitive data type vs an non primitive data type(apple defined data type)? -

what's basic difference between two..? nice if can explain using example of nsinteger , nsnumber.. thanks the main difference related stay in memory, objects stored in heap while value type stored directly in stack ... heap : area of memory used dynamic memory allocation. stack : section of memory allocated automatic variables within functions. data stored in stack using last in first out (lifo) method. about nsinteger , nsnumber : nsinteger nothing more synonym long integer, while nsnumber objective-c class, subclass of nsvalue specific.