Posts

Showing posts from June, 2013

sql - Aggregate function over a given time interval -

my sql bit rusty , i'm having quite bit of difficulty problem. suppose have table timestamp column , number column. goal return result set containing average value arbitrarily chosen regular interval. so, example, if had following initial data, resulting output 5 minute interval follows: time value ------------------------------- ----- 06-jun-12 12.40.00.000000000 pm 2 06-jun-12 12.41.35.000000000 pm 3 06-jun-12 12.43.22.000000000 pm 4 06-jun-12 12.47.55.000000000 pm 5 06-jun-12 12.52.00.000000000 pm 2 06-jun-12 12.54.59.000000000 pm 3 06-jun-12 12.56.01.000000000 pm 4 output: start_time avg_value ------------------------------- --------- 06-jun-12 12.40.00.000000000 pm 3 06-jun-12 12.45.00.000000000 pm 5 06-jun-12 12.50.00.000000000 pm 2.5 06-jun-12 12.55.00.000000000 pm 4 note oracle database, oracle-specific solutions work fine. could, of course, done st...

vb.net - Setting a databound TextBox control's BorderStyle overrides the new Text value -

Image
i've found , able reproduce peculiar behaviour in windows forms, in updating text in databound textbox , changing borderstyle override new text value. to reproduce: create new form, add 3 textbox controls, , use following code: public class form1 private class sampleobject public property mytext string = string.empty end class private _sampleobject1 new sampleobject {.mytext = "old text 1"} private _sampleobject2 new sampleobject {.mytext = "old text 2"} private _sampleobject3 new sampleobject {.mytext = "old text 3"} private sub form1_load(sender object, e eventargs) handles me.load textbox1.databindings.add(new binding("text", _sampleobject1, "mytext", true, datasourceupdatemode.onvalidation, string.empty)) textbox2.databindings.add(new binding("text", _sampleobject2, "mytext", true, datasourceupdatemode.onvalidation, string.empty)) textbox3.da...

php - User authentication with SecurityServiceProvider via POST -

what i'm looking authenticate users on bar .com , post credentials foo.com/login , re-authenticate them without needing log in again. currently, secure pages on foo.com i'm using form-based access via securityserviceprovider , db-backed userprovider authenticate. works great: attempt load secured route intercepted firewall , redirected after successful authentication. what can't figure out how pass post variables (username , password) on provider instance , forward user supplied route. stub post route: $app->post('/login', function(request $req) use ($app) { $route = $req->request->filter('route'); $username = $req->get('username'); $password = $req->get('password'); /* magic happens...? */ }); here example of using user provider load user check password matches setting token in security service. if put code route can access request username , password. $userprovider = $app[...

f# - Passing large sequences as function parameters -

this simple question (but couldn't seem find answer in msdn documents). if pass large sequences , objects function parameters in f#, copied value unless supply byref keyword? thing is, have no intention of modifying arguments, @ same time, don't want large objects copied each time call function. by default sequences/lists/arrays passed reference for example let mutate (arr:int[]) = arr.[0] <- 1 let t = array.zerocreate 1 mutate t printfn "%i" (t.[0]) //prints 1

java - Dynamically creating rows in Excel sheet with Apache POI -

i'm writing program read large xml file , create excel file it. attributes of each node column headers in excel file. created dom object , got nodelist. need iterate through , each node, need add row in excel sheet node's attributes values column values. so, when iterating, need create rows dynamically. how can it? dont see functionality add created rows in apache poi, far have seen define new rows everytime. i'm unable since has more 5000 entries. want is: node node = null; hssfrow datarow = null; (int = 0; < nodelist.getlength(); i++) { node = nodelist.item(i); datarow = spreadsheet.createrow(i); //set values data row here, , add it. //so in loop, next time same variable assigned spreadsheet.createrow(1) etc. } i understand createrow invoked spreadsheet, add row it. in loop, same variable assigned other rows too, think 1 row. please advice me on this. try following node node = null; hssfrow data...

callback - GWT Query selector not working -

gwt query selector i.e. $("#id") not working inside callback function. xyz.find("#id") works, xyz -> gquery variable. callback function doesn't support $ selector or there other problem. are sure element id "id" attached dom when callback function called ? when execute $("#id"), gquery try find elements matching selectors within set of elements of dom tree . when execute xyz.find("#id"), gquery try find elements matching selectors inside array of elements selected xyz no matter elements still or not in dom tree.

Batch script compiler -

is there batch script compiler available? have big batch file , want check syntax going wrong. using @pause , echo can check what's going wrong compiler better option. i suppose best find syntax checker, not real compiler, in batch many constructs compile @ runtime. each %var% expansion needs compile in moment of expansion, content change everything. possibility of self modifying code makes problem bit tricky. perhaps someone, write batch debugger, should possible.

c++ - What the effect of std::nth_element(a.begin(), a.end(), a.end())? -

i read description of std::nth_element @ http://www.sgi.com/tech/stl/nth_element.html template <class randomaccessiterator> void nth_element(randomaccessiterator first, randomaccessiterator nth, randomaccessiterator last); note preconditions are [first, nth) valid range. [nth, last) valid range. my question is: is valid call std::nth_element(a.begin(), a.end(), a.end()) ? if so, what's effect? doesn't violate preconditions above, anyway. anywhere in language standard (or other documents) stated nth must pointing element in a ? it's valid , probably, not guaranteed standard, null operation. given data, 2 preconditions become: [a.begin(), a.end()) valid range. [a.end(), a.end()) valid range. which both true, second interval empty though. standard 25.3.2/1: after nth_element element in position pointed nth element in position if whole range sorted. iterator in range [first, nth) , iterator j in range [nth, last)...

Intellisense for Visual Studio on variables defined as "var" that are collections -

i installed visual studio 2010 on new computer , having problems intellisense. seems "var" variables not working intellisense, if define (string, int, objectname or whatever), works fine. when mouseover defined variable, tool tip says: var user = dataaccess.user.get(userid); mouseover tooltip => (local variable) var user again, if explicitly define is, it's fine. dataaccess.user user = dataaccess.user.get(userid); mouseover tooltip => (local variable) dataaccess.user user i'm @ loss know this. note dataaccess own project, may cross-project issue. note appears issue on collections (iqueryables, etc.) does happens variables? , in project?.. not sure if you'll try installing "resharper" program detect errors code , manage personalize intellisense

asp.net - How to open the Facebook login window in new Tab on clicking the Like Button -

how can open facebook window in new tab instead of opening in new window ? my html below <div style="position: relative; top: 3px;" id="likebutton"> <iframe frameborder="0" scrolling="no" allowtransparency="true" style="border: none; overflow: hidden; width: 260px; height: 35px;" src="http://www.facebook.com/plugins/like.php?href=http:\\localhost\login.aspx|@&amp;send=false&amp;layout=button_count&amp;width=100&amp; show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=35"> </iframe> </div> issue is - on clicking like button , opens facebook login window in new window. how can open in new tab my jsfiddle here try code, working me. <a style="position: absolute; top:0px; left: 0px; width:100px; height:40px; cursor:pointer;" href="https://www.facebook.c...

c# - Assist the UI Dispatcher to handle a flood of method invocations -

the following post has become bit *longer* expected apologize maybe you'll find interesting read , maybe have idea me :) i developing small application gui consists of number of list controls. each list control has thread associated permanently producing strings being added list. to allow list controls being updated different threads built extended observablecollection asynchronously invokes operations ui dispatcher works pretty fine. here code-snippet of class examplify insert-operation: public class threadsaveobservablecollection<t> : observablecollection<t> { private int _index; private dispatcher _uidispatcher; private readerwriterlock _rwlock; // ... private bool _insertregflag; new public void insert (int index, t item) { if (thread.currentthread == _uidispatcher.thread) { insert_(index, item); } else { if (_insertregflag) { } else { bufferedinvoke...

javascript - Sliding li elements -

i'm trying find way make li elements slides. can make them on 1 line (see fiddle) , fit them in ul width. when click on next button want them slide right show hidden li . my fiddle: http://jsfiddle.net/5cmr7/ smiliar fiddle: http://jsfiddle.net/l5yea/ edit : want this built in better way, , more precise when clicking next. this need: jsbin demo var lin = $('ul.shop-groups li').length; var galw = $('.content').width(); var curr = 0; // set current 'li' slide function animate(){ var setcurr= (curr===-1) ? (curr = lin-1) : (curr = curr%lin); $('ul.shop-groups').stop().animate({left: -(galw*curr) },1200); } $('#prev, #next').click(function(){ var who= (this.id==='next') ? curr++ : curr-- ; animate(); }); just give id buttons: <input id="prev" type="button" value="previous"/> <input id="next" type="button" value="next"/...

ios - recalling and displying NSString -

hello im sure can answer bugging hell out of because being stupid. i have array , can store didselectrowatindexpath row , nslog formatselected. pop view controller , desplay formatselected botton title. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsstring *formatselected = [[nsstring alloc]init]; formatselected:[format objectatindex:indexpath.row]; nslog(@"this format selected %@",formatselected); [button2 settitle:[format objectatindex:indexpath.row] forstate:uicontrolstatenormal]; [navigationcontroler popviewcontrolleranimated:yes]; } that works fine. my problem is, in previous view newly titled button have button , label. i want able press second button , display formatselected string in label or nslog -(ibaction)printresults{ nsstring *fmat = [[nsstring alloc]initwithformat:@"%@",formatselected]; nslog(@"%@",fmat); nslog(@"nslong button pressed");} bu...

c# - image integration in setter -

i have used path create custom object as: <path style="{staticresource abc_style}" tooltip="object abc" horizontalalignment="center" verticalalignment="center"></path> abc_style definition is: <style x:key="abc_style" targettype="path"> <setter ..../> <setter property="fill" value .../> </style> now, have assign mesh image object (as content). questions: is there way integrate image it? if so, possible avoid picture getting stretched? thanks. what can think is, can create drawing brush <imagebrush imagesource="image.jpg" x:key="imagebrush" /> <drawingbrush x:key="thatchbackground" viewport="0,0,50,50" viewportunits="absolute" stretch="none" tilemode="tile"> <drawingbrush.drawing> <geometrydrawing brush="{staticresour...

javascript - jQuery easing Bounce animation -

i trying add bounce effect animation having trouble doing so. have been following jquery api animate() page keep failing. trying create effect object slides in top , bounces before settling place. $(this).animate( { "top": "+=100px" }, { duration: '400', specialeasing: { width: 'linear', height: 'easeoutbounce' }, } ); i'm not quite sure of element you're hoping bounce, try this: $(this).animate({ "top" : "+=100px" }, 400, "easeoutbounce");

zsh: completion menu. How to place common part of names? -

i have completion menu configured in zsh. works great, no problem. now want make zsh act that: let's there 3 files in directory: somefile_first somefile_second somefile_third now when press [tab], completion menu first file placed in command line. want zsh complete common part of file names (in example somefile_ ), not place else after common part, , let me navigate through completion menu. how do that? i realize question old stumbled upon when looking same answer. here found out. afaik when using completion menu zsh place highlighted completion in command line. can make less hasty. unsetopt menucomplete setopt automenu changes behaviour first tab completes common part second lists completions without changing command line third starts menu , completes command line highlighted completion if prefer no command line changes fancy menu unset automenu too: unsetopt menucomplete automenu that gives bash-like completion. common part completed...

Stacked Inline with many rows crashing in Django -

when trying navigate 'add presentation' in django admin, have wait ~1 minute response render. problem have ~500 slides in database , admin selecting slides 3 different times fill in menues. doing wrong model definitions, wouldn't expect amount of data bring server knees. visibility why experiencing issue way have defined relationships or using django admin? class presentationtitle(models.model): title = models.charfield(max_length=255) order_number = models.integerfield(default=0) def __unicode__(self): return self.title class presentationuser(models.model): user = models.onetoonefield(user) authorized_modules = models.manytomanyfield(presentationtitle) class presentation(models.model): title = models.foreignkey(presentationtitle) user = models.foreignkey(presentationuser) presentation_date = models.datetimefield() def __unicode__(self): return self.title.title class slide(models.model): .... submod...

apache - apache403 forbidden You don't have permission to access -

<virtualhost *:80> serveradmin python@v.python.centos documentroot "/var/www/vhost1/documents" servername v.python.centos serveralias www.v.python.centos.com errorlog "logs/v.python.centos-error_log" customlog "logs/v.python.centos-access_log" common <directory /var/www/vhost1/documents> order allow,deny allow </directory> wsgidaemonprocess v.python.centos processes=1 threads=2 display-name=%{group} wsgiprocessgroup v.python.centos wsgiscriptalias /app /var/www/vhost1/wsgi-scripts/myapp.wsgi <directory /var/www/vhost1/wsgi-scripts> order allow,deny allow </directory> alias /django-tjob /var/www/vhost1/djproject <directory /var/www/vhost1/djproject> order allow,deny allow </directory> alias /django-jobs /home/python/djproject <directory /home/python/djproject> order allow,den...

automated tests - Which filetype to import and manage easily in C# -

Image
i beginner concerning development in c# , need advice me choosing practical fileformat content imported in application. basically i'm developing test automation ranorex, test automation software projects based on c#. the aim of specific project test software imports file containing list of devices , repeats procedure want see if devices each time imported. big loop ranorex restarts program again , again file import , other devices file. so have several files import various devices inside it. problem number not regular. my first idea use excel file importing excel in c# not seem practical. our program can import file file , needs restarted after checking devices. want c# (ranorex) project start software, import file, check every devices file, close software , restart again same way. understand more or less question of list 2 dimension. the list contains file import , each file contains devices test. best solution ? database ? edit1: first picture basic , there u...

wpf - GridSplitter MinWidth with fixed size -

i have grid 2 columns separated gridsplitter using following xaml code : <grid> <grid.columndefinitions> <columndefinition width="100" minwidth="20" /> <columndefinition width="10" /> <columndefinition width="*" minwidth="100" /> </grid.columndefinitions> <rectangle fill="blue" /> <gridsplitter grid.column="1" background="lightgray" horizontalalignment="stretch" /> <rectangle fill="yellow" grid.column="2" /> </grid> problem : minwidth of column on right ignored i need first column width "100px" when page loads, cannot * sized. i not want set maxwidth on first column *i know has been adressed before suggest set column size * or set maxwidth on first column... don't want that. found solution, but ugly! :p , has cleaner way achieve want... codeless (if pos...

ruby - Is there any way to implement a "has one of each" relationship in rails? -

say have 3 models users, roles, , events. each user can have many roles (e.g. guitarist, bassist, etc) , each role can have 1 or more users (e.g. ted can act guitarist or bassist) can fulfil it. i'm creating rota application church band, means every event has 1 of each role in band , 1 user fill each role per event. wondering there way of enforcing relationship in model or whether had somewhere else in application. in advance! event should have many users through eventparticipation , eventparticipation should belongs_to :user belongs_to :event put uniqueness validation user_id, add role_id , scoped uniqueness validation if want.

php application class structure guidelines -

i developing php application using mvc architecture , need suggestions following design guidelines: according php class structure best practises, noted should minimize module dependencies, application class inheritance followed: some operations/methods accessible classes what have done have created helperclass contain these "global" methods string manipulations, integer manipulations, array manipulations , let other classes use these methods extend class. class organization: interface stringhelper{ ... } interface arrayhelper{ ... } class generalhelper implements stringhelper, arrayhelper{ ...... } class newclass extends generalhelper{ ... } // user factory style create object class newclassfactory{ public function create( $options ){ return new newclass( $options ); } } the application has 15 classes. is approach suitable scenario or end having big issues when maintaining application? appreciate help. in cases helper classes shoul...

ruby - JRuby Closing an AWT frame -

i decided check out jruby , jogl see if graphics sim stuff running. i've got classpath set , opengl things included properly. following tutorials, suggest using awt frame instead of swing one, swing won't support graphics acceleration (which i'm looking for). i can't figure out how close awt frame ruby, however. have windowadapter fires kernel.exit event when close button on frame clicked. looks this: class controller < windowadapter def windowclosing(event) kernel.exit end end the frame adds add_window_listener(controller.new) . event fires when click close button, spits out following error: exception in thread "awt-eventqueue-0" org.jruby.exceptions.raiseexception: (systemexit) exit calling kernel.exit frame's initialize exits program. i'm not sure why calling listener fails. know in java can define anonymous windowadapter inline, have no idea syntax in ruby. i did searching , experimentation , found answer. appear...

How can a Caliburn.Micro sub menuitem click call an action on the containing view's viewmodel? -

i have top level menu in shellview , when selecting sub menuitem, call following method on shellviewmodel (a conductor.collection.allactive). public void selectserver(string pservername) { mdefaultclaimserver = pservername; } the following not work no method gets called (i have tried various signatures , action parameters) - <menu name="menu1" dockpanel.dock="top"> <menuitem header="select server" name="claimservers"> <menuitem.itemtemplate> <datatemplate> <!-- need else show class name --> <textblock text="{binding displayname}"> <contentcontrol cal:message.attach="[event click] = [action txtester.shellviewmodel.selectserver($text)]"/> </textblock> </datatemplate> </menuitem.itemtemplate>...

android class calling orientation from another class -

i want call screen orientation 1 activity compress code , make easier call other functions. public class activity2 extends activity{ public void orientation(){ requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setrequestedorientation(activityinfo.screen_orientation_landscape); } } the main application call orientation class: public class main extends activity { final activity2 summon = new activity2(); public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); summon.orientation(); setcontentview(r.layout.main); } } can done? sorry bad english, second language. in oncreate() of activities, setting landscape orientation this.setrequestedorientation(activityinfo.screen_orientation_landscape); and portrait orientation `this.setrequestedorientation(activityinfo.screen_orientation_portrait);...

objective c - Xcode build error clang failed -

something's missing in iphone application. i not success fix error, seams martian error me... not understand @ all, after many searches... processpch /users/xyz/library/developer/xcode/deriveddata/intramuros-cqmesmesegqjxofftymiymllpzow/build/intermediates/precompiledheaders/intramuros-prefix-etlohrlrqzwcjicedfazzdvoaqbq/intramuros-prefix.pch.pth intramuros/intramuros-prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd "/users/xyz/ios - applications/intramuros-ios/application" setenv lang en_us.us-ascii setenv path "/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -x objective-c-header -arch i386 -fmessage-length=0 -std=gnu99 -fobjc-arc -wno-trigraphs -fpascal-strings -o0 -wno-missing-field-initializers -wn...

ruby on rails 3 - What does this mean #(?-mix:facebook|twitter)? -

what expression #(?-mix:facebook|twitter) mean in following output rake routes ? user_omniauth_callback /users/auth/:action/callback users/omniauth_callbacks#(?-mix:facebook|twitter) it's regular expression snippet , matches either facebook or twitter in position, , case-sensitive (so won't match facebook or twitter ). if want know more regular expressions start here :)

python - improve robots regular expression -

i have made following regexp extracting robots links: re.compile(r"/\s+(?:\/+)") and following result: /includes/ /modules/ /search/ /?q=user/password/ /?q=user/register/ /node/add/ /logout/ /?q=admin/ /themes/ /?q=node/add/ /admin/ /?q=comment/reply/ /misc/ //example.com/ //example.com/site/ /profiles/ //www.robotstxt.org/wc/ /?q=search/ /user/password/ /?q=logout/ /comment/reply/ /?q=filter/tips/ /?q=user/login/ /user/register/ /user/login/ /scripts/ /filter/tips/ //www.sxw.org.uk/computing/robots/ how can exclude links has 2 slashes like: //www.sxw.org.uk/computing/robots/ //www.robotstxt.org/wc/ //example.com/ //example.com/site/ any ideas ?? i'll suggest add if condition: if not line.startswith(r'//'): #then here

How can C++ compilers support C++11 atomic, but not support C++11 memory model -

while looking @ clang , g++ c++11 implementation status noticed strange: support c++11 atomics, dont support c++11 memory model. under impression must have c++11 memory model use atomics. difference between support atomics , memory model? lack of memory model support means legal c++11 programs use std::atomic<t> arent seq consistent? references: http://clang.llvm.org/cxx_status.html http://gcc.gnu.org/gcc-4.7/cxx0x_status.html one of issues definition of "memory location", allows (and forces compiler support) locking different structure members different locks. there discussion rl problem caused this . basically issue having struct defined this: struct x { long a; unsigned int b1; unsigned int b2:1; }; the compiler free implement writing b2 overwriting b1 (and apparently, judging report, does). therefore, 2 fields have locked one. however, consequence of c++11 memory model, forbidden (well, not forbidden, compiler must ensure s...

Stored procedure parameters with literals not working in SQL Server 2008 R2 -

i have stored procedure takes 2 parameters varchar(50) . stored procedure few simple queries temp table , returns result set temp table (i removed actual queries) alter procedure [dbo].[cv_getbooks] @booknumber varchar(50), @bookdate varchar(50) begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; --a few select statements if @ismultiple = '0' begin select * books booknumber = @booknumber , bookdate = @bookdate , bookname not null end else begin select * #temp books booknumber = @booknumber , bookdate = @bookdate , bookname null select * books bookauthor not in (select bookauthor #temp) , booknumber= @booknumber , bookdate= @bookdate drop table #temp end end i have query installed on local development machine on sql server 2008. have installed on 2 test machines running windows server 2003 , sql...

How to run an infinite loop in Android without freezing the UI? -

i'm creating , android program needs to continuously keep sending data on bluetooth use this: for(;;) { //send message } though works freezes ui , app how can implement same without freezing ui? i sure app sending data monitor data. put loop in asynctask , service separate thread or in thread beside activity. never heavy work, infinte loops, or blocking calls in main (ui) thread.

c# - Access Form Method from another static class -

so, i'm pretty out of clues now, not sure if it's possible after all. have visual c# form, gets run program.cs (standard way - vs did setup work of course). in addition that, have class static method in seperate c# file, because keeping 1 class in 1 file. my form code has public function: public void print(string text) { rtb_log.appendtext("\n" + text); } at point of time, i'm calling static function other class. is possible, access print method other class? since it's referring rtb_log ( rich text box), it's availible if instanced, , of course not static. since static methods can access static members, i'm little out of ideas here on how append text on form class. any here? but since static methods can access static members, i'm little out of ideas here on how append text on form class. static members can access instance members - need know instance call method on. write: public static void foo(otherform myothe...

How to remove multiple documents in Doctrine MongoDB ODM -

how can remove multiple documents in doctrine mongodb odm? in php class should able using following code: $db->collection->remove(array("age" => 18)); how can in doctrine mongo odm? you have 2 options. using documentmanager, can request collection given class. return doctrine\mongodb\collection instance, wraps base mongocollection support logging , events. underlying mongocollection available if want it, too: $collection = $dm->getdocumentcollection('documents\user'); $collection->remove(array('age' => 18)); // use raw mongocollection bypass logging , events $mongocollection = $collection->getmongocollection(); $mongocollection->remove(array('age' => 18)); alternatively, can use query builder api : $qb = $dm->createquerybuilder('documents\user'); $qb->remove() ->field('age')->equals(18) ->getquery() ->execute(); if stop @ getquery() , can use debug() ...

php - How Can I do for manipulate html tags inside of a template in jquery tmpl? -

i have problem, can't access outside of jquery template manipulate html code. result: [] i have template: <script id="tmpl" type="text/x-jquery-tmpl"> <select id="country"> <?php $query = 'select country_id, country_name countries'; $results = $wpdb->get_results($query, object); foreach($results $result) { echo '<option value="'.$result->country_id.'">'.$result->country_name.'</option>'; } ?> </select> <span value="${countryhelpers(user.country)}" /> </script> and outside of template have code javascript <script type="text/javascript"> function countryhelpers(country) { $("#country option[value='"+country+"']").attr("selected",function(){return "selected";}); } how put attr "selected" thanks! you can try this: function countryhelpers(country) {...

ios - How to define the object properties (title, image and description) without OG meta tags for the built-in Facebook like action -

we building ios app trying integrate built-in facebook action. action has been approved facebook. now comes difficult part. want let user facebook graph object following: curl -f 'access_token=' \ -f 'object=https://graph.facebook.com/object_id' \ 'https://graph.facebook.com/me/og.likes' in general works meta information missing, action posted timeline without title, image , description. know own landing page facebook extract information og meta tags put in html code. as not yet have our own landing pages wondering if pass information through parameters object url. in thread related og meta tags , facebook found there way sharing, e.g.: http://www.facebook.com/sharer.php?s=100&amp;p[title]=title&amp;p[url]=url we tried not work. after digging deeper found facebook engineer posted built-in action not work facebook pages. also developer documentation @ https://developers.facebook.com/docs/opengraph/actions/builtin/likes/ ...

php - Trigger HTML5 notification when new Wordpress post published -

i want trigger notification appear in bottom of user's screen when publish new post on wordpress blog (for committed readers!). edit: forgot say, need c2 lines of post text appear in notification! i've read on notifications in html5 api. e.g.: http://www.html5rocks.com/en/tutorials/notifications/quick/ i understand previous post on se javascript (or client side in general) needs passed notification server side. can web app give desktop notification i can add filter action in wordpress when post published, using plugin. http://codex.wordpress.org/plugin_api#create_an_action_function then think plugin needs pass variable javascript script, can picked html5 api. https://wordpress.stackexchange.com/questions/50770/add-javascript-when-post-is-published if can me connect dots on this, , lay out step step how work, appreciated! thanks (ps apart wordpress, none of tech choices above mandatory) use information https://wordpress.stackexchange.com/questions/5...

objective c - Reordering view controllers in a UITabBarController, all defined in a Storyboard -

Image
i'd change order of view controllers attached uitabbarcontroller, within storyboard, without disconnecting view controllers , reconnecting them in desired order. my question: can done via storyboard ib ui? discussion i'm looking inspector panel can move items , down in list of view controllers feeds viewcontrollers property on uitabbarcontroller . i've got lot of tabs , i'm hoping not have disconnect , reconnect, change order. i tried changing 'tag' value on bar item, in inspector, value ignored @ runtime (i believe identification purposes, not ordering). you can drag , drop , resort them mouse in storyboard. still works in 4.5.1 edit maybe have first switch storyboard view "source code" , go before can drag. right-click storyboard file , select "open as" -> "source code" , again "open as" -> "interface builder - ios storyboard". should trick. edit does not work in xco...

c# - What does params keyword in method signature really mean -

i'm skimming through troelsen's pro c# 2010 , came across discussion of params keyword method modifier. reading text, msdn, , other tubez sources, seems me thing params ability pass comma delimited list of values method. wrote code prove myself can send arrays of different lengths method not use params keyword, , works fine. now, i'm in favor of saving keystrokes when makes sense. in case, however, suspect savings illusory, , confusing have maintain code. illusory because i'm never going send hard-coded list of values method (bad form!). confusing because what's maintainer make of method lists bunch of values rather object explains i'm doing? otoh, since of folks @ ms, , of folks here, smarter am, suspect i'm missing something. please, anyone, enlighten me! thanks. have ever used console.writeline ? console.writeline("{0}: value of {1} {2}.", linenumber, foo, bar); this sort of call params can useful. having explicitly cons...

string - Why is '\n' === '\\n' true in php? -

i understand that: '\n' // literally backslash character followed character lowercase n "\n" // interpreted php newline character but life of me, can't understand why '\n' === '\\n' . in mind, '\\n' equal 3 separate characters: 2 separate backslashes, followed letter n. why '\n' === '\\n' true in php? the backslash still escape character in single-quoted strings (it escapes literal single quotes). this illegal instance (since backslash escapes closing quote): $path = 'c:\'; so \\ must map literal backslash avoid inadvertent escaping.

c# - ASP.net dynamic grid of textboxes -

Image
i have 2 lists of strings , i'd dynamically create grid of textboxes: list<string> x = {"a", "b", "c"}; list<string> y = {"1", "2", "3", "4"}; b c 1 tbx tbx tbx 2 tbx tbx tbx 3 tbx tbx tbx 4 tbx tbx tbx [button] when enter data textboxes , click button, i'd able iterate on these textboxes , determine "x" , "y" coordinates associated each textbox. i can figure out how dynamically create grid of textboxes, think i'll run issues when post data. how values dynamically created textboxes after postback? i'll have no issue doing iteration , actual logic can't figure out how data container can iterated. have dynamically create textboxes again while reading posted data? like? here approach. can have place holder in asp.net page. in code behind dynamically create table dynamic text bo...

mount - Linux Logical Volume Manager -

i can see single logical volume can mounted on 2 different file systems -- can explain me pros , cons of this? why doesn't linux throw error when happens? ex: /dev/mapper/vgep0-lvol12 9.9g 9.2g 243m 98% /lsmw /dev/mapper/vgep0-lvol12 9.9g 9.2g 243m 98% /oracle/ep0/oraflash in linux device can mounted multiple times. from mount(2) man page since linux 2.4 single file system can visible @ multiple mount points, , multiple mounts can stacked on same mount point.

mysql - What's wrong with this query using averages? -

courses (cid, cname, description) professors (pid, pname) teaching (tid, cid, pid, year, semester, department) students (sid, lname, fname, b_date, department) enrolled_stud (sid, tid, enrollment_date, grade, grade_date) the question: query students names have highest average: select a.sname,a.avg (select s1.sname,avg(e.grade)as avg students s1 natural join enrolledstudents e group s1.sid ) a.avg=(select max(a.avg)) you can see results in sqlfiddle , , can see doing wrong, , dont what! seem correct me... since it's study, i'll post hint first. think clause - a current row. of course a.avg equals max(a.avg) . update try following: select s1.sname, avg(e.grade) avg students s1 natural join enrolledstudents e group s1.sid having avg = (select avg(e.grade) avg enrolledstudents e group e.sid order avg desc limit 1);

How do you get rid of � (utf8 invalid character) in SQL server -

we have store lots of � characters in our product descriptions. tried running update queries update {table} set description=replace(description,'�','') worked in instances keep finding more of them. know easy way rid of them all? our store running on volusion uses sql server 2008, limit kinds of queries can run. if necessary, have updated copy of of product info in mysql database can want , upload changes. a php mysql connection defaults latin1 connection, so, first query after connection should be: mysql_query("set names 'utf8'"); maybe ^^

mercurial - How do I use Tortoise HG to set up a repository on my computer? -

Image
i given company website our repository on new project, don't know how set repository on computer using tortoise hg. our previous project set on machine when started working didn't need know how. feel more comfortable asking community rather boss. the repository "mercurial repository". website set in way. i've downloaded files "zip" button, don't know how connect file website using tortoise things affect real repository. how set tortoise workbench can pull , push changes repository? the zip contains files without of mercurial specific part. can delete it, won't use setup personal repository. first of need have url access repository. depending on configuration of server, can through http, ssh or network share. need credentials. you can "clone" url somewhere on website or ask coworker / boss this. once have url, clone repository tortoisehg : http://tortoisehg.bitbucket.io/manual/2.9/clone.html you can use reposito...

VBScript Permission denied when I delete a file -

let me start saying self taught in vbscript. i have folder gets filled temporary files , need delete them. so created script when runs getting permission denied when script tries delete file. domain admin, sure manually deleted file , had no issues. same message when run script on server. i tried post of code here put had hard time reading it. if can tell me how post can read please let me know. saw putting ">" on first line put not putting on 1 line. here section having issues with, error last line (permission denied) set objfile = objfso.getfile(strfolder1 & "\" & strfilename.name) objfso.deletefile myfiletodelete, true ok looked @ more. not indent 4 spaces in front. not sure how code this, tried cannot accept it. tia, rodger this should you're asking: sub deletemyfile(myfiletodelete) dim fso set fso = createobject("scripting.filesystemobject") fso.deletefile(myfiletodelete) end sub myfi...

Ruby on Rails about the Structure App Sample -

im learning ruby on rails have somes questions , not find answers hope me in , , thanks. 1 - if construct e-commerce store , im have create controller each aspect example: 1 controller admin 1 controller products 1 controller store 1 controller client my question , correct ? 1 controller each ? 2 - im analise scaffold code , im not want use , want write app analyse code , see diferent routs , example , create post , how define actions , scaffold use new show create..and more classes(actions) default ?or code in controller of generated scaffold make how define if or post ? i hope can answer these questions, thank support. 1 - if construct e-commerce store , im have create controller each aspect example: 1 controller admin 1 controller products 1 controller store 1 controller client my question , correct ? 1 controller each ? yes, 1 controller each! and don't forget: skinny controller, fat model!

math - Right behavior for variable-arity sum function -

i'm defining variable-arity sum function toy language. seems natural me allow called without arguments , return 0 , real languages (and implementations) disagree among themselves. is there use-case returning 0 less correct throwing exception? mathematically speaking, empty sum (the sum of no numbers) defined zero. mathematically correct, returning 0 seems proper choice here. throwing exception in case potentially complicate use of function, since have sure guard each call try/catch in case provide 0 arguments somehow. hope helps!

asp.net mvc 3 - c# is there a easy way to convert month integer to name -

i trying create archive list blog application. have veiw model has code snippet: @model ienumerable<nplhblog.models.archivelistmodels> ... @foreach (var item in model) { <li>@item.archivemonth/@item.archiveyear : @item.postcount</li> } ... i trying print item.archivemonth 'jan' instead of '1'. the archivelistmodel follows: public class archivelistmodels { public int archiveyear { get; set; } public int archivemonth { get; set; } public int postcount { get; set; } } and blogs read repository follows: public iqueryable<archivelistmodels> archivelist() { var archivelist = blogs in db.blogs group blogs new { blogs.publishdate.year, blogs.publishdate.month } dategroup select new archivelistmodels() { archiveyear = dategroup.k...

mongodb - Doctrine2 ODM - Object ( or Embedded Document ) as _id -

i have process running incremental map reduce collection looking @ metrics on different time periods - grouping id(s) , date. output collection has composite id handle grouping. { "_id" : { "site" : 67, "dt" : isodate("2012-07-03t00:00:00z") }, "value" : { // metrics here } } i want able fetch results collection in symfony2 app using odm - having trouble _id field. thought might able specify @id , @embedone : /** * @mongodb\id * @mongodb\embedone(targetdocument="reportid") */ protected $id; however, doesn't work. tried setting @id strategy=none , , can use querybuilder fetch rows, errors when trying hydrate document class. tried slugging site id , date ( 67-134137916 ) , allows me use documentmanager, lose ability query date ranges. anyone have input on how handle object id in doctrine2's odm, supported? edit: removed composite primary key...

android - The alert dialog must not dismiss until user input text in editext is valid -

i making alert dialog edit text. want remain on screen until user input email in it. how can that?? code below: final alertdialog.builder alert= new alertdialog.builder(this); alert.setmessage("enter email:"); final edittext userid = new edittext(this); alert.setview(userid); userid.setinputtype(inputtype.type_text_variation_email_address); alert.setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { if (userid.gettext().tostring().length()>0){ userid = userid.gettext().tostring(); result(); }else{ toast.maketext(getapplicationcontext(), "enter email future reference.", toast.length_short).show(); } } }); alert.show(); by clicking on button dialog dismisses. please tell how retain dailog on screen till need it.thanx in advance... ...

ios - Can I save a file on the iPhone? -

i have android app porting iphone , important feature requires opening simple text file user downloads. on android, usual way user file email attachment, way user can download file iphone app can open work. there way on iphone? i'm not quite sure how you're handling text file, following methods can retrieve text file attached email when user selects open attachment mail app in app. first need register app being able open text files. this, go app's info.plist file , add following section: <key>cfbundledocumenttypes</key> <array> <dict> <key>cfbundletypename</key> <string>text document</string> <key>cfbundletyperole</key> <string>viewer</string> <key>lshandlerrank</key> <string>alternate</string> <key>lsitemcontenttypes</key> <array> <string>public.text...

jquery - How to avoid IE warning for secure content with fancybox version 2? -

i'm using fancybox version 2.0.6 load hidden divs fancybox, in ie warning secure content displayed. see there people have addressed issue in version 1.3.4, version 2 not have same code replaced in patch (i checked). has dealt already? there resolution in latest fancybox version? i decided try installing older version of fancybox has patch issue, before adding javascript included old version commented out script lines new version , warning remained! i noticed had included jquery instructed @ http://fancyapps.com/fancybox/#instructions , didn't change http https in line: <!-- add jquery library --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> so answer fancybox version 2.0.6 not throw security warnings in ie, if blindly follow instructions you'll warning due jquery line. :)

file accessed time in linux using python -

this question continuation of question in another thread .since point of question different,i thought i'd post new question. i experimented getting accessed time files in linux machine( ubuntu lucid ),using python .the idea have function goes through files in particular directory,see if have been accessed in last 2 minutes,and print files have not been accessed. for accessing file ,i defined readfile() method def readfile(fname): open(fname) f: ct = f.read() print 'read file at:',time.time() print 'length of file:',len(ct) for convenience ,i defined filenames f1='/home/me/dev/misc/usedfiles/one.txt' f2='/home/me/dev/misc/usedfiles/two.txt' f3='/home/me/dev/misc/usedfiles/three.txt' f4='/home/me/dev/misc/usedfiles/four.txt' sothat calling readfile(f1) access file one.txt i defined function go through directory , print files not accessed in last 2 minutes def files_not_accessed(): ...