Posts

Showing posts from September, 2011

ruby - Checkboxes in rails returning no value? How to get Checkboxes working with Rails -

i trying values check boxes, whenever use params[:chosen], seems return nil. missing? params right way it? this line have in view: <td><%= check_box_tag "chosen[#{i}]",i,true,:name => "chosen[]" %></td> this produce checkboxes can never seem value it. need put in controller? thank you i don't think need :name => "chosen[]". first argument used name. also, rails guides recommend using label_tag wtih check_box_tag <td> <%= label_tag :my_attribute, "attribute label" %> <%= check_box_tag :my_attribute, my_model.my_attribute %> </td> then controller can check params[:my_attribute]

osx - Unable to make file editable on Mac OS X -

i'm trying edit httpd.conf file located in /private/etc/apache2, , can't figure out how permission write i've done $ cd /private/etc/apache2 $ sudo chown bdh httpd.conf $ ls -lash 0 drwxr-xr-x 13 root wheel 442b jun 7 00:11 . 0 drwxr-xr-x 93 root wheel 3.1k jun 26 10:51 .. 0 drwxr-xr-x 13 root wheel 442b jan 3 16:26 24 -r--r--r-- 1 bdh wheel 24k jun 7 00:11 httpd.conf ...etc... $ vim httpd.conf and says "httpd.conf" [readonly] 677l, 24330c tried cp ing desktop, cant permission edit there either i'm pretty new using terminal, there other command can use? it unnecessary , undesirable alter access permissions edit file. edit file requires administrator (or other user) privileges without altering access permissions, use: sudo -e /private/etc/apache2 sudo's -e option tells want edit given file. this command copies file , makes writable you, tells editor specified sudo_editor, visual or edit...

date format - How to set dateformat to mdy in SQL Server 2005? -

i using sql server 2005. when execute set dateformat mdy , date format specific session. when disconnect management studio , connect not take format. but want set permanently. how can it? i don't think can. per msdn: this setting used in interpretation of character strings converted date values. not affect display of date values. the setting of set dateformat set @ execute or run time , not @ parse time. the way change permanently alter sys.syslanguages table, , aren't allowed alter system tables that. best bet create custom date parsing function sets dateformat , returns appropriate string value, you'd still need call function every date. set default language "british english" instead of "english"?

What specific problems does Declarative Programming solve best? -

i understand declarative languages have offer, have not yet connected dots why use them. example, not understand why describing problem more beneficial writing solution understood problem in imperative language (side-effects non-withstanding). this not discussion makes application in declarative language. want understand circumstances , common, specific project requirements make programmer "we should use declarative language this". as rule of thumb, guess declarative programming makes sense when there exists multiple strategies achieve 1 goal. declaratively programming what rather how let parser/compiler/runtime figure out strategies best--it optimizes execution you. two exemples of declarative languages , optimizations: regular expression -- want bother underlying dfa, ndfa required fast execution? sql queries -- dbms has statistics , caches , can (hopefully) figure out optimal execution plan the link provided @verisimilitude worth reading.

c# - how to use XMLTextWriter to write XML node at a specified position -

i have xml file likes below. <?xml version="1.0" encoding="utf-8" ?> <book> <title>title</title> <content>content</content> </book> i want write new node after 'content', know how use xmldocument that, there way use xmltextwriter that? you have write whole xml document, i.e. elements , attributes , attribute values using xmltextwriter . after you've written <content> element, can write additional element. something this: writer.writestartdocument(); writer.writestartelement("book"); writer.writestartelement("title"); writer.writestring("title"); writer.writeendelement(); writer.writestartelement("content"); writer.writestring("content"); writer.writeendelement(); // insert new data here writer.writeendelement(); writer.writeenddocument();

google chrome - Interface C/C++ library into HTML5 by using any tag -

my intention make ui having following features: should able run/ work on os platform windows, mac & linux. should able work web browser ie, chrome, firefox, etc. should able link or interface c/c++ library. if possible can embed other tool link these c & c++ lib. actually here, there no server involved. there independent application has link c & c++ lib , run on 3 os , every possible web browser. is possible how ? kindly suggest me appropriate way cross hurdle. how using qt , open html5 pages using qml webview element ? qt code can port possible platforms, , above can run html code. should able run/ work on os platform windows, mac & linux. qt code can ported platforms. should able work web browser ie, chrome, firefox, etc. you can use on qml's webview element or qtwebkit on platforms. should able link or interface c/c++ library. using qt's c++ code able link other libraries/processes via interprocess communicatio...

sharepoint - Infopath Custom Task Form Updation : System.xml.xmlexception -

i have created workflow create task , approve task using custom infopath form. while clicking button approve/reject, task form raises xml exception "date" unexpected token, expected token "=". below have listed stack trace of excetion, server error in '/' application. 'date' unexpected token. expected token '='. line 1, position 22. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.xml.xmlexception: 'date' unexpected token. expected token '='. line 1, position 22. source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [xmlexception: 'date' unexpected token. expected token '='. line 1, position 22.] system.xml.xmlte...

How to get Facebook like button's comment list -

now our requirement this: we have button on 1 page, user can click button , type comment in popup comment box. question how comment of button of specified page? want show these comments in place of page. we have button on 1 page, user can click button , type comment in popup comment box. if user types comment box popping when using button, result not comment, link share of url – that’s individual post on user’s wall. i had little around fql tables, did not find give resulting post without knowing actual user used button.

security - Europe cluster availabe for europe� its also used for cloud storage and gmail? -

with release 1.7 of appengine sdk specifies europe cluster available. cluster used google services drive or gmail? important point europe laws privicy , data protection. regards this announcement refers data stored app engine apps , not apply other google services such drive or gmail. update (to include guido's comment): "what store in eu @ rest: datastore, blobstore, logs." see https://developers.google.com/appengine/docs/premier/location details: """ locating application in european union useful if application's users closer europe united states. there less network latency , end user content stored @ rest in european union. """ and """ while application run out of datacenter in location have chosen, please aware google may process , store application , customer content in united states or other country in google or agents maintain facilities. """

android - Periodic update of location details to server -

i new user stackoverflow , first question... question is... how periodic updates of location details? have tried service class , run thread inside but,this called once. can 1 suggest me doing wrong? thank you. here code public class myservice extends service { string gps_filter = ""; thread triggerservice; locationmanager lm; gpslistener gpslocationlistener; boolean isrunning = true; @override public void oncreate() { // todo auto-generated method stub super.oncreate(); toast.maketext(getapplicationcontext(), "hello",toast.length_long).show(); gps_filter = "mygpslocation"; } @override public void onstart(intent intent, int startid) { // todo auto-generated method stub super.onstart(intent, startid); triggerservice = new thread(new runnable(){ public void run(){ ...

JavaScript parse variable in quote -

possible duplicate: javascript variable inside string without concatenation - php in php, double quotes has ability read variable, e.g. "$foo" but in javascript, have use + read variable variable won't inside quote when read, e.g. var foo='bar'; alert("the name's "+foo); so, there workaround or method this? using + time quite troublesome. nope, that's not possible in javascript. in javascript, variables turned string when put in single quotes or doubles quotes , can't parsed. in javascript everything inside quotes treated string . even if write custom parser , have no way figure out if in quotes variable or string because variable named name can appear in string somewhere create naming collisions.

c# - Not able to find any elements identified on the webpage after the InternetExplorer browser is launched through Selenium Webdriver -

i using selenium webdriver 2.24 automate website. ie browser gets launched using webdriver, driver not able find fields present (such text boxes, buttons etc ) on page , throwing unable locate element . i used visual studio c# write code. same works fine on firefox. note: when try driver.pagesource ; returns null value possible reasons/suggestions solve issue? other people have had problems 2.24 too--try either going 2.23 or move on 2.25.

html - CSS float right without changing order? -

there similar questions already, none of fixes worked me. want float <li> menu right, can't correctly. html <div id="topnav"><ul class="topnavlinks"><li class="menu-474 first"><a href="/" title="home page">home</a></li> <li class="menu-540 active-trail active"><a href="/our-company" title="" class="active">our company</a></li> <li class="menu-541"><a href="/news_blog" title="">blog</a></li> <li class="menu-930"><a href="/faq" title="frequently asked questions">faq</a></li> <li class="menu-900 last"><a href="/contact" title="contact">contact</a></li> </ul></div> css #topnav { width:100%; height:14px; background:#b8b8b8; border-bottom:1px so...

c# - How can I convert BitmapImage to Icon? -

in application have send list<menuitem> shell extension in wcf. these menuitems composed of icon , label. type of icon system.drawing.icon have work system.windows.media.imaging.bitmapimage . there way convert bitmapimage icon ? my thoughts: first comvert bitmapimage bitmap converting bitmapimage bitmap , vice versa then save icon http://social.msdn.microsoft.com/forums/en-us/netfxbcl/thread/4a10d440-707f-48d7-865b-1d8804faf649/ hope helps!

java - Amazon DynamoDB NoSuchMethodError Exception -

been trying insert entries amazon dynamodb, error on these lines of code: awscredentials credentials = new propertiescredentials(simpledbloaddata.class .getresourceasstream("awscredentials.properties")); dynamodb = new amazondynamodbclient(credentials); this exception : exception in thread "main" java.lang.nosuchmethoderror: com.amazonaws.auth.querystringsigner: method <init>()v not found any ideas? thanks, daniel

oop - VBA: how to test for object equality (whether two variables reference the same object) -

what operator or function test whether 2 variables of same custom object type refer same object? i've tried if myobject = yourobject but runtime error 438 object doesn't support property or method. i'm guessing that's telling me override '=' operator test if fields of 2 objects have same value. want test whether same object. i'm guessing that's telling me override '=' operator test if fields of 2 objects have same value. no, tells objects don't have default property have been called otherwise, , returned results compared. you test reference equality is if myobject yourobject

ruby - Find Value in Array of ActiveRecord Objects vs. Find Value from Repeated DB Calls -

i return true, if array of contact(s) (model) contains contact id equal value. example: @contacts = contact.all @someval = "alskjdf" find_val(@contacts, @someval) def find_val(contacts, val) @contact.each |c| if c.id == val return true end end return false end i have repeatedly in app (at 100 times particular actions), in order exclude data external api has list of contacts. going expensive? i thought might able faster, similar activerecord find on array after it's been pulled down db, can't figure out. expensive call activerecord this? contacts.find_by_id(@someval) the above line have called hundreds of times... figure iterating through array less expensive. thanks! the best approach index contacts in hash, using contact id key after retrieve them db: contacts = contact.all.inject({}) {|hash, contact| hash[contact.id] = contact; hash } then can contact contact[id] in performant way.

Jquery Formatting - run function after another one has finished -

i have 2 jquery functions. first 1 below want run first, when function has finished, run other one. i'd add function first bit of code, not sure how i'd block or if it's correct way. so in short, want code run... $('#setuppanel').modal({ backdrop: "static", keyboard: false }); after function has finished executing... $('html, body').animate({ scrolltop: $("#header_wrap").offset().top }, 600); edit: here's entire function... $(setup).click(function () { $('html, body').animate({ scrolltop: $("#header_wrap").offset().top }, 600); $('#setuppanel').modal({ backdrop: "static", keyboard: false }); }); you can try promise() method: $(setup).click(function () { $('#setuppanel').modal({ backdrop: "static", keyboard: false }).promise().done(function() { $('html, bo...

javascript - Phonegap - Phonegap to Utils change -

so had app running phonegap 1.4.0 (don't ask), decided upgrade 1.8.1, upon doing phonegap global variable no more, replaced utils. so converted every occurance of: var thisuuid = phonegap.createuuid(); to: var thisuuid = utils.createuuid(); only greeted 'utils' not defined reference error when running application. opened cordova-1.8.1.js , see utils , utils.createuuid indeed being defined globally, have no idea why when try , call i'm not generating uuid, nor matter. i had same requirement found the utils not exported external module used following way: var utils = cordova.require('cordova/utils'); var myid = utils.createuuid();

java - HTTP links in alert dialog not working -

i tried following following example make http link in textview in alert dialog clickable, not work: how make links in textview clickable? the way can work if put text of link directly string , put android:autolink="web" textview. not want see whole link, name. here dialog created: @override protected dialog oncreatedialog(int id) { layoutinflater factory = layoutinflater.from(this); switch (id) { case disclaimer: final view disclaimerview = factory.inflate(r.layout.disclaimer_dialog, null); final textview dtv = (textview) disclaimerview.findviewbyid(r.id.disclaimer_body); dtv.settext("v"+versionname+"\n\n\u00a9"+calendar.getinstance().get(calendar.year)+" "+"developer\n\n" + getstring(r.string.alert_dialog_disclaimer_body)); dtv.setmovementmethod(linkmovementmethod.getinstance()); return new alertdialog.builder(myac...

c# - How to ask for permission when click on activity link -

in website, when user reading article, if user authenticated user. "reads" action publish user's timeline. however, when other user click on link publisher above user, did not ask permission , go link's destination. how force ask permission when click on link? if accept permission, user redirect destination, if decline, user remain in facebook. thanks you can use javascript confirmation, if user click yes redirect user article ex: in aspx page link call javascript write: <asp:linkbutton id="xyz" runat="server" onclientclick="return checkuser()" onclick="xyz_click" /> javascript: <script type="text/javascript"> function chackuser(){ if (confirm("are sure") == true) { return true; } else return false; } </script> in code behind page: protected void xyz_click(object sender, eventargs e) { resonse.redirect("your lin...

Reset git repository to specific commit from specific branch -

i working on branch in following state a'--b'--c'--d' / a--b--c--d some bad things happened , have go b' both locally , remote remote repository following a'--b' / a--b--c--d for local repository did git reset --hard <sha> but how can remote repository? i should able like git push origin mybranch --reset but it's not in man page i tried creating commit cancel previous ones but git add . reports there no changes (expected since i'm after previous push) so how can reset remote repository? removing commit history all need on b' branch, , go git push --force overwrite current commit pointer branch. if don't have remotes set tracking branches, may need git push --force origin <branchname> instead. c' , d' remain in reflog , objects in repository until pruned, shouldn't show part of log history unless start digging plumbing. removing dangling obj...

c# - Windows Phone Preserving Page State not working -

i trying preserve page state when go page, reason when go page, items returned default state. why doesn't work? seems follow tutorials perfectly... protected override void onnavigatedfrom(system.windows.navigation.navigationeventargs e) { base.onnavigatedfrom(e); state["title"] = titletextbox.text; //all of radiobuttons - if better way please comment :) int = new int(); if (rb0.ischecked.value) = 0; else if (rb1.ischecked.value) = 1; else if (rb2.ischecked.value) = 2; else if (rb3.ischecked.value) = 3; state["checkedrb"] = i; } protected override void onnavigatedto(system.windows.navigation.navigationeventargs e) { base.onnavigatedto(e); if (state.containskey("title")) titletextbox.text = state["title"] string; if (state.containskey("checkedrb"...

localization - django translated urls and accept-language header -

i've setup translated urls languages. default language django has been set en-us. if request page /registration/ nl-nl accept-language header, 404. wasn't expecting such behaviour. rather hoping redirected /registratie/ ,the tranlated url corresponds accept-language header. ofcourse /registratie/ nl-nl accept-language header, works fine , gives me expected 200. i'm guessing normal can ? isn't there chance user might link website , link build english language, user in question has different supported language setting, accept-language header ? in such case presented 404. should presented or english (default) content or or redirected correct url language if supported. also happens if user has not supported language setting ? django default language_code used, en-us in case ? is there way work around or handle in different better way ? an extract urls.py file, shows how i've setup translated urls: url(_(r'^step1/$'), accounttypeselectionvie...

easy calculation of weeks of certain period with java -

is there easy library or approach week (from date ~ date) of periods? example: there 6 weeks(variable) (start 1 july, 2012 ~ 11 aug, 2012). i want cut off 6 weeks 2 portions (variable) . results be 1) 1 july,2012 ~ 21 july, 2012 2) 22 july,2012 ~ 11 aug, 2012... etc with jodatime, can number of weeks between periods though. all know start date , end date both variables , cutoffweeks amount (eg.6 weeks or 4 weeks). final localdate start = new localdate(); final localdate end3 = start.plusweeks(3) its not clear want, joda-time makes things rather easy. i guess need : public void dostruff(int cutoff){ int portion = cutoff/2; final localdate start = new localdate(); final localdate end = start.plusweeks(portion) }

html - CSS Bug with inline ul li in IE7 -

i've got little issue inline menu, bug appears in ie7. menu li has menu underneath it, not inline rest, rest seem appear pushed down. html <div id="topnav"> <ul id="jsddm"> <li id=""> <a id="" href="/">home</a> </li> <li id=""> <a href="/about.aspx">about</a> <ul style="visibility: hidden;"> <li> <a href="/about/board.aspx">board</a> </li> <li> <a href="/about/contact.aspx">contact</a> </li> </ul> </li> <li> <a href="/practices.aspx">practices</a> </li> <li> <a href="/how-we-work.aspx">how work</a> </li> <li> <a href="/patients.aspx">patients</a> </li> <li> <a href="/news-links.aspx">news &amp; links</a> </li> <li>...

ruby - Bundler erase logger's format? -

as long require gems bundler.require , logger doesn't work more. require "logger" logger1 = logger.new(stderr) require 'bundler/setup' bundler.require logger2 = logger.new(stderr) logger1.info 123 logger2.info 123 output: i, [2012-06-29t17:51:30.323356 #20774] info -- : 123 123 i don't have logger in gemfile . source 'http://rubygems.org' gem "activesupport", "~> 3.2.6", :require => ["active_support", "active_support/core_ext"] edit : seems problem activesupport . have , logger both? suggestion? active_support/core_ext changes default logger format logger::simpleformatter . to old formatter need manually assign after initialization: logger2 = logger.new(stderr) logger2.formatter = logger::formatter.new logger2.info 123 => i, [2012-06-29t13:56:07.580428 #24714] info -- : 123

c# - Where to join development teams -

i hope question isn't out of focus. i've been wanting find way improve skills programmer. i've tried teaming game dev groups @ school , coming own ideas apps. these things move me , ideas seem out of reach due lack of skill. don't have degree yet, i've been learning program around 5-6 years now. i'm efficient in learning programming skills , using them, find there lack of projects me join , have no clue find them. think can me out? my current languages are: c, c++, c#, java, python. i've worked asp.net web development , dabbled around sql server. i want learn more , become more efficient in programming , think best way it.

Selenium setup/teardown best practices- returning data to orginal state -

{ assert.that(_edituserpage.state.selectedtext, is.equalto("illinois")); _edituserpage.state.selectedtext = "new york"; assert.that(_edituserpage.state.selectedtext, is.equalto("new york")); _edituserpage.savechanges(); assert.that(_edituserpage.state.selectedtext, is.equalto("new york")); } in example above, changing user's state illinois new york; question is: should change state orignal value of illiois @ end of test? i have 20 other independent tests in same file , wanted know best practice returning data original state. using setup/teardown entire test suite, not within each individual test. best practice far did see this: the test had 1 test data input (excel sheet) each run add prefix data (e.g. name pavel => test01_pavel) test did verify such data not exist in system test created testing data according input , verified data present test deleted testing data ,...

Convert Maya 2013 to X3D file -

is there way convert file maya 2013 x3d file? thanks! do need x3d? seems project did maya 5+ years old. if looking pretty supported xml-based format , collada appears accepted. there plugin maya called colladamaya here list of conversion tools claim handle collada -> x3d: http://www.web3d.org/x3d/content/examples/x3dresources.html

Can I retrieve the 'check ins' I have made on Facebook -

i lats , lons of check ins have done via teh facebook 'check in' button. there api call can make? foursquare let's this, can't see reference on fb. checkins can retrieved via checkins connection of user object, need user_checkins permission (or friends_checkins if retrieving friend's checkins). also habe ability access same data via fql: select coords, tagged_uids, page_id checkin author_uid=me() you want read documentation of checkin object , documentation checkin table (fql)

iphone - make UIView in UIScrollView stick to the top when scrolled up -

so in uitableview when have sections section view sticks top until next section overlaps , replaces on top. want have similar effect, have uiview in uiscrollview, representing sections uiview , when hits top.. want stay in there , not carried up. how do this? think needs done in either layoutsubviews or scrollviewdidscroll , manipulation on uiview.. to create uiview in uiscrollview stick top when scrolled do: - (void)createheaderview:(uiview*)headerview { _headerview = [headerview retain]; _headerviewinitialy = _headerview.frame.origin.y; [_scrollview addsubview:_headerview]; _scrollview.delegate = self; } - (void)scrollviewdidscroll:(uiscrollview *)scrollview { cgrect headerframe = _headerview.frame; headerframe.origin.y = max(_headerviewinitialy, scrollview.contentoffset.y); _headerview.frame = headerframe; }

.htaccess - htaccess from www to non-www -

i'm having problem. i have python(django) website, , want delete "www" url, have htaccess: rewriteengine on rewritebase / rewritecond %{http_host} ^www.mydomain.com/$ [nc] rewriterule ^(/)?(.*) http://mydomain.com/$1 [r=301,l] it works, problem if enter url "www.domain.com/admin" or "www.domain.com/something" redirects "domain.com" instead of "domain.com/admin" or "domain.com/something". do know wrong htaccess? thanks lot time , help. change ^(/)?(.*) ^/?(.*) . you're capturing / , appending onto url, instead of part want append $1 .

My Visual Studio 2010 program in copyright by Hewlett-Packard Company -

Image
today noticed c# program made copyright hewlett-packard company. know how fix this? have tried tutorials regedit did not work or might have messed want fixed. check out assembly information dialog in project properties. in solution explorer can right click on project , select properties. assembly information button in application tab. i haven't tried this, change default value, use regedit modify hklm\software\microsoft\windows nt\currentversion\registeredorganization hklm\software\wow6432node\microsoft\windows nt\currentversion\registeredorganization (x64 systems)

r - Omit x axis levels with no data in a facetted plot and change widths of the bars -

Image
as can see in data below, levels of x axis variable "type" missing of facetting variables "items". example, there no "type = a" "items = 32". i want rid of empty space along x axis corresponding non-existing "types" (e.g., type 32 items case). some data ("temp"): type items value 16 6.3 b 16 8.3 c 16 7.9 b 32 7.7 c 32 8.3 c 64 7.9 code plotting: library(ggplot2) ggplot(temp, aes(x = type, y = value, fill = type)) + geom_bar(stat = "identity") + facet_grid( . ~ items) ======================= edit: according joran's solution, setting scales = "free_x" doing want. however, widths of bars become large under item numbers 32 , 64. please me make widths bars. ggplot(temp, aes(x = type, y = value, fill = type)) + geom_bar(stat = "identity") + facet_grid( . ~ items, sca...

python - What does the 'u' symbol mean in front of string values? -

this question has answer here: what's u prefix in python string? 7 answers yes in short know why seeing u in front of keys , values. i rendering form. form has check-box particular label , 1 text field ip address. creating dictionary keys being label hardcoded in list_key , values dictionary taken form input (list_value). dictionary created preceded u values. here sample output dictionary: {u'1': {'broadcast': u'on', 'arp': '', 'webserver': '', 'ipaddr': u'', 'dns': ''}} can please explain doing wrong. not getting error when simulate similar method in pyscripter. suggestions improve code welcome. thank you #!/usr/bin/env python import webapp2 import itertools import cgi form =""" <form method="post"> firewall <br>...

android - Settings don't take effect immediately -

anytime change in-app-settings (with shared preferences) have use button , go activity changes take effect. i'd them take effect immediately. tried use protected void onresume(){ super.onresume(); } but doesn't work. doing wrong? settings activity called menu inflater , finished when click on save button. here things out for: you're writing new settings same file 1 being used, , not different one most people use local variables store settings on run run basis. make sure update of these after changing settings. way have seperate method updateuserchoices(), , have code boolean sound = settings.getboolean(); in it. call method @ beginning, , after update settings.

ios - A static character prefix in UITextField -

Image
is there built-in way add character prefix uitextfield screenshot below? if no, best, straight-forward way accomplish this? thinking background property might able this. simply adding gray uilabel on top of uitextfield trick: note uilabel behaves background image, entered text stays on top: update additionally can add padding uitextfield using following code: uiview *thepadding = [[uiview alloc] initwithframe:cgrectmake(0, 0, 5, 20)]; thetextfield.leftview = thepadding; thetextfield.leftviewmode = uitextfieldviewmodealways; this way text cannot cover prefix character. adjust rect make working in situation.

php - updating variable inside label without refresh -

simply, want display number of unread messages in label inside menu follows: <li><a id="2" style="background-image:url('menu icons/comments.png'); background-repeat: no-repeat; background-position: left; background-position-x: 5px;" href= "viewmessages.php">messages<label id="num_msg">(<?php echo $count; ?>)</a></li> where $count as: $num_messages = mysql_query("select count(m.message_id) cnt messages m inner join member_message_member mmm on (m.message_id = mmm.message_id) mmm.member_id2 = $id , m.seen = 0") or die(mysql_error()); $mcount = mysql_fetch_assoc($num_messages); $count = $mcount['cnt']; and when user clicks on message: $("#sub a").click(function(){ mesg_id = $(this).attr('msg_id'); page = $(this).attr('href') ...

.net - How to get base properties and fields with values using reflection to work up the class hierarchy? -

how can base class properties , fields using reflection, can work class hierarchy 1 level @ time? goal build tree display showing properties , fields values of class instance, debugger locals window. need ability lazy load each base instance, when "base" tree node expanded, properties , fields values can shown on demand. here simple example specified. i’m sure can modify specific needs or @ least point in right direction. you can copy , paste example console application , set few breakpoints see how works. the code in vb.net module module1 private class classone private _one string private _two integer private _three double public property one() string return _one end set(byval value string) _one = value end set end property public property two() integer return _two end s...

asp.net mvc - reading excel worksheet in mvc .net -

could examples of on how read excel spreadsheet in .net 4.0 using mvc? i have read 3-4 worksheets in excel spreadsheet, loop through rows in each worksheet retrieve values in each cell , store in database. looking code examples point me in right directions. thanks in advance. sue. you can use npoi . there have many examples, can try use example importxlstodatatable

dependency injection - Implementing Repository without ORM or LINQ in 3 tier architecture -

i trying implement simple repository pattern ioc in current project. project 3 tier application ui layer (a web application), business logic layer (a class library) , data access layer (a class library). want use unity container microsoft enterprise library di. don't want use orm nhibernate, entity framework etc. don't want use linq sql. unfortunately not able find example of repository pattern implementation scenario. have decided go ahead , implement repository pattern based on understanding of concept. in business layer have defined generic repository interface: // namespace businesslayer interface irepository<t, u> { // add entity repository void add(t entity); // single entity repository id t getbyid(u id); // list of entities repository // specified parameters ienumerable<t> getlist(idictionary<string,u> parameters); ... ... } i use irepository interface in business service (which in business layer...

java - jvisualvm 1.3.2 refuses to show CPU for some local apps and not others -

osx lion, java 1.6.0_33 one program running @ moment, shows cpu in jvisualvm overview: host: localhost main class: org.jetbrains.idea.maven.server.remotemavenserver arguments: <none> jvm: java hotspot(tm) 64-bit server vm (20.8-b03-424, mixed mode) java: version 1.6.0_33, vendor apple inc. java home: /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home jvm flags: <none> another not: host: localhost main class: com.basistech.ntt.socialsecuritydeathmastertodistribution arguments: /data/ssdm/ssdm.txt target/ssdm.dist.txt jvm: java hotspot(tm) 64-bit server vm (20.8-b03-424, mixed mode) java: version 1.6.0_33, vendor apple inc. java home: /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home jvm flags: <none> heap dump on oome: disabled why? i'm not sure still have issue, answer might others i'm on linux , had same behaviour yours : local jvm cpu sampling disabled on vm working on others (jvisualvm example) w...

google apps script - How to mix jQuery and a UiInstance for generating GUIs -

i've got basic dialog form worked out using gui builder. put slider widget in form. (don't ask!) the jquery ui lib has slider, seems in order jquery scripts , css loaded template, have switch html service instead of ui service page generation. at moment have gui builder form working ok, running this; function doget(e) { var app = uiapp.createapplication(); app.add(app.loadcomponent("doceditorgui")); return app; } and have jquery slider in html page can pull in this; function doget(e) { return htmlservice.createhtmloutputfromfile('mysliderwidget'); } however using html file seems incompatible app.createhtml() html type widget, in nothing displayed if pass htmloutput contents. html processed, logger.log shows correct jquery , html. var t = htmlservice.createhtmloutputfromfile('mysliderwidget'); var widgethtml = container.createhtml(t.getcontent()); widgethtml.setstyleattribute("background", "green"); logger...

Trello drag and drop effect -

does know how trello pretty drag , drop effects, selected card angles text visible? i think @ site on web , know how being done, i've never seen effect done seamlessly. pre-rendered image dynamically styled on server , loaded when dragging starts? utterly trivial question know! trello uses css rotate transformation on ui-sortable-helper .list-card.ui-sortable-helper { transform: rotate(3deg); -moz-transform: rotate(3deg); -webkit-transform: rotate(3deg); }

Which css versions are supported in chm files? -

i writing stylesheet use compiled files. looks css2 works, i'm not sure css selectors > , + . is chm format equivalent to, say, ie 7? fwiw, authoring on windows 7 , ie9 installed. the html viewer uses layout engine components of microsoft internet explorer (shdocvw.dll hosting mshtml.dll) display topics. http://msdn.microsoft.com/en-us/library/aa189109%28v=office.10%29.aspx which means: css version support determined ie version installed.

Why does Scala's type inferencer fail with this set of implicit arguments involving parameterized types? -

i define method parameterized type t has behavior dependent on implicit argument can found of type box[t] . following code has method defined foo . when called foo[int] or foo[string] without issue return 1 or "two" expected. where things weird method bar. defined returning int , instead of foo[int] have foo . hope compiler infer t must of type int . not , instead fails: bash $ scalac code.scala types.scala:15: error: ambiguous implicit values: both value 1 in object main of type => main.box[int] , value 2 in object main of type => main.box[java.lang.string] match expected type main.box[t] def bar: int = foo ^ 1 error found what causing error? replacing foo foo[int] compiles fine. simpler situation there no box[t] type compiles fine. example below , uses argle , bargle instead of foo , bar . object main extends application { case class box[t](value: t) implicit val 1 = box(1) implicit val 2 = box("two") def...

ios - Sort Array by Distance for TableView -

can please me sorting array distance , display in tableview? have created property "sortedarray" , synthesized. i've created "sortlist" method , called under didupdatetolocation. doesn't seem sorting array or i'm not getting updated results tableview. @property(nonatomic, strong) nsarray *sortedarray; -(nsarray *) sortlist; -(nsmutablearray *) barlist; @synthesize sortedarray; - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { currentloc = newlocation; if (newlocation.horizontalaccuracy <= 100.0f) { [locmgr stopupdatinglocation]; } nslog(@"lat: %f, long: %f", currentloc.coordinate.latitude, currentloc.coordinate.longitude); [self barlist]; [self sortlist]; [self.tableview reloaddata]; } -(nsmutablearray *) barlist{ theauthors = [[nsmutablearray alloc] init]; @try { nsfilemanager *f...

wordpress - How to use get_posts() and form select -

hi i'm new wp plugin development. far, i'm doing except form select piece seems kicking head. i'm trying show list of recent post in select field admin select , stuff title not show. tried in radio button , text field , got no result. please, missing in form? <form method="post"><select name="article"> $args = array( 'numberposts' => 10, 'order'=> 'asc', 'orderby' => 'title' ); $postslist = get_posts( $args ); foreach ($postslist $post) : setup_postdata($post); echo'<option value='".the_id()."'>'".the_title()."'</option>'; endforeach; echo"</select></form>"; i can't test right now, there couple of possibilities. first, the_id() echo value - won't work you'd in middle of concatenation. need get_the_id() instead. second, matching of quotes seems odd when you're echo ing option ...

webview - What's the best way to display html via java -

what best way view html (from url or file) using java? had try using flyingsaucer. fail. move jeditorpane. fail. try lobo. fail. suggest me else if want display html file in java swing, consider java swing tutorial oracle. check out code on how read file through method createeditorpane() . have found link other libraries might want try out.

ios - swipe gesture toolbar -

for app need recognize swipe gesture on toolbar change items on toolbar. can scroll through toolbar. i want develop ios 5.0 or higher xcode 4.3 i found out how change viewcontroller using swipegestures. can me? -(void)swipedidhappen:(uiswipegesturerecognizer*)swipe { [self settoolbaritems:secondarray animated:yes]; } should fade out/in new items great. note toolbar must 1 supplied uinavigationcontroller. hook up, create 1 in code, , use [[self toolbar]addgesturerecognizer:gesture]; . secondarray array of uibarbuttonitems, must made programmatically (as far know, cannot storyboard array, nor should you).

mysql - Is it faster to dig data using sql_fetch_array or having a csv string and separate the values using php? -

i'm working on website supposed show specifications of computers, example: cpu, cpu speed, ram , stuff that. there lot of fields , wonder whether php's mysql_fetch_array faster or saving data in 1 varchar field , separating using php? wondering if there pros , cons either of them? i'm using php 5.3 , mysql in advance. if i'll use database in separates field , tables (db relational) entity relationship diagram + normalization. doing have scalability, independence, avoid redundancy, beside if add index (pk,fk , uk) have performance. of course depend of queries , php code. that's practice implement right db design plus security stuff. the pros lot... cons, take more time worth it.

osx - Patch Vim with the breakindent patch on OS X with Homebrew -

i'm on os x 10.7 vim 7.3. i'd install the breakindent patch . here's way on linux apt-get : compiling vim breakindent patch . how do this? suppose involve building vim via homebrew (which ok me). use mercurial latest vim source code: $ hg clone https://vim.googlecode.com/hg/ vim $ cd vim grab patch. apply patch indicated in linked thread: $ patch -p1 < /path/to/breakindent.patch configure vim options need (python/ruby support, custom location, etc.): $ ./configure --with-features=huge <other options> build , install: $ sudo make && make install

How do I insert a Google Document into a Google Site using Google Apps Script -

using google apps script, how can accomplish same "insert" -> "document" within google sites editor? using gas, can obtain url and/or id of document, cannot create equivalent of embedded google document within google site page. i have been able insert <iframe> , assumes document has been published web-document. i can copy html existing page , using replace() substitute different id, appears work if original page gadget has borders , title turned on. i think approach mentioned should work. have 'template' page dummy google document inserted in , use apps script replace dummy document. can put in code around replace have.

svn - PuTTY fatal error - Disconnected: Received SSH2_MSG_CHANNEL_FAILURE for not existent channel 258 -

i need connect our server, download project using putty. when trying 'checkout' using tortoisesvn, several files loaded , error messages: 1). svn - error: report of '/blabla/blabla/blabla/!svn/vcc/default': not read response. body: secure connection truncated (https://localhost). 2). putty - putty fatal error: disconnected: received ssh2_msg_channel_failure not existent channel 258. thanks. seems bug on server side. if use freesshd on windows, can try switch openssh server

c# - How do I use try-catch correctly in simple methods? -

i make sure classes robust - if simple , seem dumb experienced programmer. let's have method written below accepts string[] , returns int[]. public static int[] getintarrayfromstringarray(string[] stringarray) { int = 0; int[] ints = new int[stringarray.length]; foreach (var str in stringarray) { ints[i++] = (str != "" ? int.parse(str) : 0); } return ints; } is best option use try-catch , throw exception? when try use try-catch, seems have issues variables not being in scope need them in try-catch catch errors stringarray being null! perhaps should use this? if (stringarray == null) //do ... but not sure in event of error ... return null int[] or throw exception? (i have check int.parse(str) doesn't fail - i'm getting 1 hoped in try-catch block!) as said, these simple tasks want try , correct before develop many bad habits. thanks. public static int[] getinta...