Posts

Showing posts from February, 2014

android - How to start video from where it stopped -

i using videoview playing video. if go out of application, while returning application ie in onresume() should play video stopped. to current progress(check in onpause): long progress = mvideoview.getcurrentposition(); to resume (in onresume): mvideoview.seekto(progress);

arrays - Mongodb query doesn't work -

in image sharing application can upload images , create albums. when delete image site shall deleted in albums (the ones has got image in it). below route deleting image, , need why code deleting images (imagename , imageid) in albums below doesn't work. thanks in advance! the models: var albumschema = new schema({ title : string, imagename : [string], imageid : [string] }); modelobject.albumschema = albumschema; modelobject.album = mongoose.model('album', albumschema); - var blogpostschema = new schema({ name : string, size : number, type : string, author : objectid, title : string }); modelobject.comment = mongoose.model('comment', commentschema); modelobject.blogpost = mongoose.model('blogpost', blogpostschema); the part doesn't work in code below following: albums[i].imagename.remove(j); albums[i].imageid.remove(j); albums[i].save(f...

activerecord - rails fields_for object is nil, when I try to access an attribute -

have 3 models: class offer < activerecord::base has_many :offer_items end class offeritem < activerecord::base belongs_to :offer belongs_to :partner_product accepts_nested_attributes_for :partner_product end class partnerproduct < activerecord::base has_many :offer_items accepts_nested_attributes_for :offer_items end in form offer edited, there fields_for edit offer_item <% f.fields_for :offer_items |offer_item_form| -%> <div class='offer_item'> <%= render :partial => 'offer_item_fields', :locals => {:offer_item_form => offer_item_form}%> </div> <% end -%> the code chunk in partial: <%= offer_item_form.object.partner_product.name%> throws error undefined method `name' nil:nilclass extracted source (around line #29): <%= offer_item_form.object.partner_product.name%> but when don't ask name, this <%= offer_item_form.object.partner_product%> ...

ruby on rails - How do I add a data association between records in a HABTM many to many relationship? -

i have set habtm relationship between 2 table creating many many relationship between items , categories. want add item connected 1 or more categories via add item form. when submit form getting error "can't mass-assign protected attributes: categories". here models: class item < activerecord::base attr_accessible :description, :image, :name has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" } belongs_to :user has_and_belongs_to_many :categories validates :name, presence: true, length: {maximum: 50} accepts_nested_attributes_for :categories end class category < activerecord::base attr_accessible :description, :name has_and_belongs_to_many :items validates :name, presence: true, length: {maximum: 50} end and migrations: class createitems < activerecord::migration def change create_table :items |t| t.string :name t.text :description t.has_a...

android - Implementing callback from Service to Activity -

this question has answer here: accessing ui thread handler service 5 answers i have been playing service , cannot them run need. need call service functions activity , , use this public class localbinder extends binder { localservice getservice() { return localservice.this; } } but how callback activity once long network operation done? i want show spinner on action bar while service something, , when finishes hide it. need persist on different activities have same action bar. also, serviceconnection asynchronous callback, how bind service, wait callback and then change case case function of service call? well , call service's function synchrounous , implementation of function on service can asynchrounous (for example , using asynctask ) , when result finished , can either send intent , or call listener stored call .

python - Django 1.2: How to connect pre_save signal to class method -

i trying define "before_save" method in classes in django 1.2 project. i'm having trouble connecting signal class method in models.py. class myclass(models.model): .... def before_save(self, sender, instance, *args, **kwargs): self.test_field = "it worked" i've tried putting pre_save.connect(before_save, sender='self') in 'myclass' itself, nothing happens. i've tried putting @ bottom of models.py file: pre_save.connect(myclass.before_save, sender=myclass) i read connecting signals class methods here , can't figure out code. anybody know i'm doing wrong? rather use method on myclass, should use function. like: def before_save(sender, instance, *args, **kwargs): instance.test_field = "it worked" pre_save.connect(before_save, sender=myclass)

ios - How to delete call history details using tableview editing method in iPhone -

i new in iphone application development. developing call history application in iphone. in application fetching call details using call history database, , displaying in table view. want perform delete on selected row call history value in database. don't know how perform operation. using following code showing error like: terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'error while creating delete statement. 'near "<": syntax error'' - (void)tableview:(uitableview *)atableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { [appdelegate.displayhistroryvalueappdelegate removeobjectatindex:indexpath.row]; [displaytableview reloaddata]; int rowid = [[[appdelegate.displayhistroryvalueappdelegate objectatindex:indexpath.row]valueforkey:@"rowid"] intv...

iphone - how to assign class object values to mutable array? -

i using class object store xml parsed data. need 1 mutable array , want store class object values in new mutable array. use [yourarray addobject:obj];

string formatting - Display html formatted text, split into page-sized chunks-- methods? -

i'm building web application better give writers constructive criticism. part of involves fetching portions of html-formatted text, scribbled on html5's canvas. if marking page red pen. i'm having trouble figuring out best way display page-worth (500 x 600px) of text @ time. wordcount work, cut things off @ awkward places. character count, stripped of tags, plus space paragraph breaks may work better, on mono-type font. so what's best way automatically cut text based on size? or need approach entirely? here's solution found: pomax's 'bookstyle' did trick, using javascript , bit of php sanitize text. the text loaded dynamically generated page-sized div until overflows specified clientheight. when hits overflow, refills page minus last paragraph, attempts add said paragraph word word until bottom of page filled. last, pages 'navigated through' hide() , show() commands. it bottlenecks on last paragraph each time, , had trouble...

javascript - How to achieve lazy loading with RequireJS? -

we're building non-trival web application using backbone, requirejs , handlebars, , well, i'm curious. @ moment, each of our models sorta looks this: define(['backbone', 'js/thing/a', 'js/thing/b', 'js/lib/bob'], function(a, b, bob) { return backbone.router.extend({ // stuff here }); }); where thing/a, thing/b both have own dependencies, example on handlebars templates, etc. happens in main.js, of 'top-level' routers loaded , initialized; each top-level router has set of dependencies (models, views, etc) each have own dependencies (templates, helpers, utils, etc). basically, big tree structure. the problem in case entire tree resolved , loaded on page load. don't mind per sé, we'll run through optimizer , end 1 big single file (reducing requirejs modularization framework). however, curious whether can load stuff views , templates 'on demand'. there "simplified commonjs wrapping" explained here...

windows - Automatically Wake NAS on Access -

i'm trying nas server wake s3 sleep state when nas accessed user. want increase longevity of server, , limit power usage. i've seen people asking similar advice none found provide robust solution, threads ended unanswered. so detail problem quickly: @ home have custom built, old pc, nas server, running ubuntu server, stores media , documents mainly. server set sleep after predefined inactive period. nas can brought out of s3 state wol magic packet. achieve magic packet automatically sent server when user accesses 1 of shares pc. users running windows 7. i'm not sure if entirely prevalent have linksys wrt54g running dd-wrt home router/dhcp/dns. during research came across many articles automatically woke server on timed loop, no real intelligence. article given below seems want: http://wdtvhd.com/index.php?showtopic=7908 a script given attempts address problem using dd-wrt router send wake-on-lan packets when query made. seems way go this, not script given in li...

github - heroku with Smart HTTP Support -

does heroku support smart http support github ? you mean deployments via git push ? no —because http not protocol use when push heroku.

I want to allow an IP range in .htaccess -

i want allow ip addresses between 145.050.039.008 , 145.050.039.017 inclusive for example (but doesn't work): allow 145.050.039.008 145.050.039.017 or: allow 145.050.039.008,145.050.039.017 or: allow 145.050.039.008/017 ? thanks, jelmar allow 145.050.039.008 145.050.039.017 check here details. (late) edit: my bad, previous answer never worked, @ time answered without understanding problem. option #1: define ip here's way it: allow 145.50.39.8 allow 145.50.39.9 allow 145.50.39.10 allow 145.50.39.11 allow 145.50.39.12 allow 145.50.39.13 allow 145.50.39.14 allow 145.50.39.15 allow 145.50.39.16 allow 145.50.39.17 option #2: use partial ip if want more generic, can use partial ip: allow 145.50.39 but allow ip 145.50.39.0 145.50.39.255 . option #3: use netmask or cidr to closer, can use netmask or cidr: allow 145.50.39.0/255.255.255.224 or allow 145.50.39.0/27 this allow ip 145.50.39.0 145.50.39.31 .

C# - Exception handling in frameworks -

i have write ftp (auth tsl) framework in c#. i'm noob @ writing frameworks. e.g. when prove file exists , doesn't, should do? throwing exception programmer uses framwork? printing exceptionmessage (console.writeline()) without throwing exception? what professional in case? broad question actually, there clues on way: never use console.writeline() or stuff in framework. for methods framework.fileexists , if file doesn't exist, return false value. that's true nature of boolean return value. that's more semantic. for operations encounter problems, throw custom, or predefined exception. example, if need argument , want sure no null has been passed method, check argument in method's body , if it's null, throw argumentnullexception .

html5 - Crop image to canvas -

i have 2 divs <div id="image-orig"> <img src="image_example.jpg"/> </div> <div id="image-crop"> <canvas id="preview" style="width:548px;height:387px"></canvas> </div> image_example.jpg can image size. function updatepreview(c) { if(parseint(c.w) > 0) { var orig = $("#image-orig img")[0]; var canvas = $("#image-crop canvas")[0]; var context = canvas.getcontext("2d"); context.drawimage(orig, c.x*coeff,c.y*coeff,c.w*coeff,c.h*coeff, 0,0,canvas.width,canvas.height ); } } $(function(){ $('#image-orig img').jcrop({ onselect: updatepreview, onchange: updatepreview, aspectratio : parsefloat($('#image-orig img').width()/$('#image-orig img').height())...

variables - Why a parameter is not defined, if I can dump it and it has a value in Coldfusion? -

just little clueless... using coldfusion8, if dump session file: <cfdump output="d:\coldfusion8\logs\dump.txt" var="#session#"> this includes: accounttyp: whatever i same result if dump parameter: <cfdump output="d:\coldfusion8\logs\dump.txt" var="#session.accounttyp#"> question: if it's defined , dump-able, how come checking isdefined so: <cfdump output="d:\coldfusion8\logs\dump.txt" var="#isdefined(session.accounttyp)#"> turns out no ? if it's there should defined, shouldn't it? thanks clarification. <cfdump output="d:\coldfusion8\logs\dump.txt" var="#isdefined(session.accounttyp)#"> it because syntax incorrect. isdefined expects name of variable ie string. omitting quotes around variable name, session variable gets evaluated first, , value ("whatever") gets passed isdefined . code checking variable named "what...

In PlayN, how do you exclude a directory from being compiled by Maven? -

i want build html version of game command line using maven. however, when run package command core folder: mvn clean package -pl core,html i following errors because of unit tests in source path: [info] ------------------------------------------------------------- [error] compilation error : [info] ------------------------------------------------------------- [error] /home/klenwell/projects/mygame/playn/mygame/core/src/main/java/mygame/playn/tests/unit/userdatatest.java:[3,23] package org.junit not exist [error] /home/klenwell/projects/mygame/playn/mygame/core/src/main/java/mygame/playn/tests/unit/userdatatest.java:[7,16] package org.junit not exist ... how can exclude directory these test files being included in compilation? it not idea mix source , test classes. per maven convention, should move tests src/main/java src/test/java . you should add dependency junit tests can compiled. you can choose skip tests (if broken) using -dskiptests or similar ...

OpenGL superbible 5th edition source on Xcode -

i downloaded source code examples of opengl superbible 5th edition here: http://www.starstonesoftware.com/opengl/ file called xcode.zip the projects there never updated latest xcode opengl 3.0. wonder if walked perilous , dark way , made these projects work, or if there new zip file latest xcode. the issue examples use glut, hasn't been updated able use opengl 3 on os x yet. apple didn't update glut. trying make time adopt glfw new framework.                                                 — richard s. wright jr., post on twitter

memcached - Is it important to give expiry time for memcache -

i have web application perform if database operations cached. static data's , new data added everyday. reduce database read operation i'll using memcached. what happen if don't give expiry time data put in memcached. affect performance consuming more ram..? ditch expiry time while adding data cache. ps: use aws deploy webapp ngnix, php, mysql. presumably when app still running in year 2050, things put in cache way in 2012 no longer relevant. if don't provide sort of expiration, cache reset (e.g. server restart) end flushing cache. unless have infinite memory (and i'm pretty sure aws doesn't provide ;-) wise add expiration time cached items. even though memcached expire items based on least used mechanism (thanks @mikewied pointing out), cache still fill entirely before memcache begins evicting items based on lru. unfortunately, memcache's lru algorithm per slab, not global. means lru-based evictions can less optimal. see memcached ...

Android WebView Hardware Accelerated Keyboard Glitch -

when webview hardware accelerated, clicking on input field causes keyboard appear , html redrawed shifted , duplicated moment: 1) when soft keyboard appearing webview pans content bottom-left, againt normal position. causes short view-able duplication. 2) when changing keyboards (ex. abc->numbers) contents panned down keyboard height , normal position. causes short view-able duplication. tested on 2 android 4.0 tablets, if hardware accelerations turned off no such glitches appear. i failed found any information on this, has experienced same problem? so found solutions: the entire webview content moves layout margin width, setting 0px fixes problem. android:windowsoftinputmode="adjustpan" webview activity.

parsing - h264 reference frames -

i'm looking algorithm of finding reference frames in h264 stream. common metod saw in different solutions finding access unit delimiters , nal of idr type. unfortunatelly streams checked didn't have nal of idr type. i'll gratefull help. regards jacek h264 frames split special tag, called startcode prefix, either of 0x00 0x00 0x01 or 0x00 0x00 0x00 0x01 . data between 2 startcodes comprises nal unit in h264 speak. want search startcode prefix in h264 stream. byte following startcode prefix nal header . lowest 5 bits of nal header give nal unit type. if nal_unit_type = 5, particular nal unit reference frame. something this: void h264_find_idr_frame(char *buf) { while(1) { if (buf[0]==0x00 && buf[1]==0x00 && buf[2]==0x01) { // found nal unit 3-byte startcode if(buf[3] & 0x1f == 0x5) { // found reference frame, } break; } ...

Strange behavior of ProgressDialog's key listener in Android -

i wrtie small program test progressdialog in android. dialoginterface.onkeylistener dialogkey = new dialoginterface.onkeylistener() { public boolean onkey(dialoginterface arg0, int arg1, keyevent arg2) { switch(arg1) { case keyevent.keycode_volume_down: log.i("spinner key", "key volume down"); log.i("spinner key", "" + arg0.tostring()); return true; case keyevent.keycode_volume_up: log.i("spinner key", "key volume up"); log.i("spinner key", "" + arg0.tostring()); return true; default: break; } return true; } }; this.mypdialog = new progressdialog(sensordefenceactivity.this); this.mypdialog.setprogressstyle(...

html - rotating text on a table using css3 -

Image
i trying create table printing purpose. seen in many forms, want vertically rotated text , both left , right side of form. so far have achieved this fiddle: http://jsfiddle.net/naveen/p8azd/ this has 2 problems i wanted border td widths 50 px text spanning more area. rotated text gets clipped 50px. how overcome this? the style rotate-right has incorrect filter: progid:dximagetransform.microsoft.matrix . has been copied .rotate-left . values (m11, m12, m21, m22) in filter denote? what wrong code? see http://jsfiddle.net/p8azd/7/ i added div around text , made not wrap

internationalization - django - understanding LocaleMiddleWare (translation.deactivate) -

i use django.middleware.locale.localemiddleware website i18n'ed , make language 'switcher' via set_language redirect . and can not understand couple of things: why call translation.deactivate ( source on github ) during process_responce? does mean can not using middleware? (it shows page in different language once, , switches back.) translation.deactivate called because current language stored in global (thread local) variable. set when request comes in, , must un-set when request finished prevent "leaking" next request (ex, imagine thread handles request must localized portuguese, request no localization set. if portuguese localization wasn't deactivated, next request localized portuguese).

ios4 - Instructions per second for iPhone -

this bit of generic question. working on ios cocoa-2d game involves complex path finding algorithms. game turn based. before each user's turn calculate possible paths. involves running lot of data manipulation commands , allocate , releasing simple data objects (no i/o) guessing million instructions required calculate paths each turn. iphone 3gs, 4 , 4g perform @ fraction of second, assuming game using single thread. in general how many instructions per second can achieved within game. looking guesstimate high level figure. this depends on type of "instructions" used in algorithm or calculation, how scheduled compiler, , how count them. in extremely rough , coarse terms, arm cpus used apple can issue on order of 1 integer instruction per clock cycle, , arm processor cores used in ios devices reportedly range in clock speed 400 mhz 1 ghz. high ratio of floating point, multiply or divide instructions or cache misses may change actual instruction issue , re...

.net - Should you use variables or properties, and global or static variables in a class? -

i'm new in .net programming. i have class form1 includes button1_click event. (button1_click creates multiple text boxies @ run time) here class: public class form1 dim shiftdown integer dim counter integer private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim textbox1 new textbox counter += 1 shiftdown = shiftdown + 30 textbox1.name = "textbox" + counter.tostring() textbox1.size = new size(170, 10) textbox1.location = new point(10, 32 + shiftdown) textbox1.visible = true groupbox1.controls.add(textbox1) end sub end class currently rows: dim shiftdown integer dim counter integer defined global variables. my question is, instead of way are, should define these variables properties or static local variables in button...

PHP split lines into pages -

currently, have code: <?php if (isset($_get['id'])) { $itemid = $_get['id']; $search = "$itemid"; $query = ucwords($search); $string = file_get_contents('http://example.com/tools/newitemdatabase/items.php'); if ($itemid == "") { echo "please fill out form."; } else { $string = explode('<br>', $string); foreach ($string $row) { preg_match('/^(.+)\s=\s(\d+)\s=\s(\d+)\s=\s(\d+)/', trim($row), $matches); if (preg_match("/$query/i", "$matches[1]")) { echo "<a href='http://example.com/tools/newitemdatabase/info.php?id=$matches[2]'>"; echo $matches[1]; echo "</a><br>"; } } } } else { echo "item not exist!"; } ?> what want take of results in line echo $matches[1]; , split between pages 5 lines on each page. this ...

Save a Web Page with Python Selenium -

i using selenium webdriver python 2.7: start browser: browser = webdriver.firefox() . go url: browser.get('http://www.google.com') . at point, how can send 'save page as' command browser? note: not web-page source interested in. save page using actual 'save page as' firefox command, yields different results saving web-page source. unfortunately can't selenium. can use page_source html get. selenium unfortunately can't interact dialog given when save as. you can following dialog need autoit finish off from selenium.webdriver.common.action_chains import actionchains saveas = actionchains(driver).key_down(keys.control)\ .send_keys('s').key_up(keys.control) saveas.perform()

JAVA:method and using one class -

i want use different methods in class. know main method read compiler. how can use other methods, objects , data in main method? can give me simple example? java compiler javac compile methods. jvm start executing program main() method can call other methods either current class or other classes. more information take java tutorial (for example referenced sergeii or other one). have pleasant time learning java!

java - Does removing the "final" keyword affect binary compatibility? -

if remove final keyword method or other "thing", users of class have recompile? technically, won't have recompile. i cannot think of repercussions can result removing final keyword method / attribute may lead loss in compatibility should not give problems. tested sample code , there no runtime errors: public class test2{ public static final string test = "hello!"; } public class test { public static void main (string [] args) { system.out.println(test2.test); } } compiled test.java ran test.java -> output = "hello!" modified test2.java: public class test2{ public static string test = "hello!"; } compiled test2.java ran test.java -> output = "hello!"

how to assign the result of a batch command to a variable -

if on command line execute: c:\digitemp.exe -t0 -o%c -q > res1.txt res1.txt contains correctly numerical temperature in celsius (say: 24.23456). if same command executed inside bat file (say: test.bat): @echo off echo hola pootol! echo. c:\digitemp.exe -t0 -o%c -q > res1.txt rem set pootol = < res1.txt rem set pootol echo prem una tecla per sortir. pause > null res1.txt contains wrong celsius value suspect related argument " -o%c " . can see rem variable assing cause pootol var wrong assigned celsius value before mentioned. doing wrong? the problem in case % sign, it's evaluated different in cmd-line , in batch files. in batch files can escape doubling it. so code looks like c:\digitemp.exe -t0 -o%%c -q > res1.txt

How to Cross-Reference/Verify Asp.Net website pages -

i've inherited asp.net website (vs/vb 2008 express). there many files copies of other files (previous developers copy code-behind page , rename make changes, page.aspx have pageupdatea.aspx.vb code-behind page, page.aspx.vb still exist). is there way cross reference site pages/files verify/validate pages, find unused pages? i need tool work source code, using crawler crawl site won't work. i have access versions of vs 2008 (and 2010/2012).

C# Webbrowser open with Default browser -

always open ie, how open defalut browser,like firefox or chrome go solution explorer -> right click on project -> select browse open browse with window, having list of available browser in pc select browse or make selected browser default browser.

java - JAX-RS request taking custom object -

in specific jax-rs based web service implementation there need of custom object sent in web service request. aware of returning objects jax-rs based web service not quite sure of sending object during request. can body me regarding this? thanks in advance, arijit bose you should implement messagebodyreader custom object such that: public class yourclassreader implements messagebodyreader<yourclass> { @override public boolean isreadable... @override yourclass readfrom... }

c++ passing by const reference -

in following program body cosists of vector of pointers. points struct of x,y,z coordinates , point_id. believe body passed const reference, following step should produce error. program running without problem. can please explain me why this. void readoutfile(const body& body, int n){ .... body.bp[0]->points.push_back(point_id(p,i)); } here's issue: body.bp[0]->points.push_back(point_id(p,i)); ^^ indirecting through pointer removes constness; rather, constness of result dependent on type of pointer. t *t; // pointer t: can modify t , (*t) const t *t; // pointer const-t: can modify t not (*t) t *const t; // const-pointer t: can modify (*t) not t const t *const t; // const-pointer const-t: can't modify either t or (*t)

json - PHP:file_get_contents() Error -

i using file_get_contents read json data. my code : //echo $json_url; $json_data = file_get_contents($json_url); i surprise that, variable $json_data returns null value. when echo variable $json_url, displays correct url. tt displays json record when manually enter url in browser. what can error here? what url? note: if you're opening uri special characters, such spaces, need encode uri urlencode(). furthermore, url fopen wrappers enabled? tip a url can used filename function if fopen wrappers have been enabled. but see why request failed if enable error reporting .

mysql PHP join - syntax issue -

i trying join 3 tables keep getting error query. not sure doing wrong. must doing incorrect syntax not quite sure wrong. select project_timecard_tasks.datetime, project_timecard_tasks.total_hours, project_timecard_tasks.user_id, project_timecard_tasks.task_id, project_timecard_tasks.project_id, users.user_id, users.firstname, users.lastname, tasks.id, tasks.taskname project_timecard_tasks join project_timecard_tasks on project_timecard_tasks.user_id = users.user_id , project_timecard_tasks.task_id = tasks.id project_timecard_tasks.project_id = '$jobnumber' your join statement little wonky. try this: select project_timecard_tasks.datetime, project_timecard_tasks.total_hours, project_timecard_tasks.user_id, project_timecard_tasks.task_id, project_timecard_tasks.project_id, users.user_id, users.firstname, users.lastname, ...

emulation - Android emulator, creating and AVD with screenLayout = SIZE_LARGE -

this question has answer here: get screen size bucket programmatically? 8 answers i'm developing app targeting android 4+, behaves differently depending on screen size. more in detail: on small/medium screens, orientation forced on portrait, , app runs switching activities. on large/x-large screens, orientation forced on landscpe, screen split two, menu fragment on left, , other fragments on right. problem is, can't create avd gets detected large screen. just tested on avd 640x1024 resolution, 240 density, code never goes first if. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // forcing layout landscape if display large or more if ((getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == configuration.screenlayout_size_large || (getres...

mercurial - Hg + Eclipse - filtering changesets for transplant -

Image
the action i'm repeating on , on transplanting changes default production branch. however, each time means tedious , error prone task of hand picking changesets want transplant between plethora of other changesets. is there way of filtering available chagnesets author , message? from screen shot, no. looks can't. commenter mentioned, can use command line or tortoisehg query using revset query : hg log -r "user('vartec') , desc('needle')" in tortoise hg, click "search" icon (the magnifying glass) , enter revset query in search box.

c# - Search between two dates and show results - gridview -

i have gridview , sqldatasource. here gridview: +----+--------------+--------+----------+ | no | names | id | date | +----+--------------+--------+----------+ | 1 | name1 |1636 |04.15.2012| | 2 | name7 |1236 |09.12.2012| | 3 | name1 |1136 |08.16.2012| | 4 | name3 |1536 |09.25.2012| | 5 | name11 |1436 |09.15.2012| | 6 | name1 |1836 |09.11.2012| | 7 | name2 |1736 |09.15.2011| | 8 | name1 |1296 |08.15.2012| +----+--------------+--------+----------+ and i'm searching name1 in names , show rows between first date , final date names : [name1] first date : [08.01.2012] final date : [09.30.2012] [[search]] results be: +----+--------------+--------+----------+ | no | names | id | date | +----+--------------+--------+----------+ | 3 | name1 |1136 |08.16.2012| | 8 | name...

maven - Eclipse run configuration with complete package name of selected resource as variable -

i running maven project eclipse , want setup run configuration goals compile exec:java , needs exec.mainclass parameter. because have different main classes in project, class , package name selected resource used when running. correct run variable insert value parameter? i use following configuration run main method of selected class. know asked parameters i'll provide more detailed steps other visitors since didn't found solution on net. prerequisite: m2e eclipse plugin , exec-maven-plugin select run > maven build … use goal exec:java optional: provide profile name optional: select debug output click add … create parameter name: exec.mainclass value: ${java_type_name} (this provides selected resource's full java name) now whenever use run configuration take current class parameter , execute main method. ${java_type_name} variable provided eclipse, should work somehow without using m2e. one thing mention exec.mainclass parameter didn...

maven release:prepare IOException -

i'm trying maven's release plugin working perforce. when run: mvn release:prepare -dusername=perforceuser -dpassword=perforcepassword i output (with ips/username/passwords removed): [info] scanning projects... [info] ------------------------------------------------------------------------ [info] reactor build order: [info] [info] root-project [info] project1 [info] project2 [info] project3 [info] project4 [info] project5 [info] project6 [info] project7 [info] project8 [info] project9 [info] [info] ------------------------------------------------------------------------ [info] building root-project 1.0-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-release-plugin:2.3.1:prepare (default-cli) @ root-project --- [info] verifying there no local modifications... [info] ignoring changes on: **\release.properties, **\pom.x...

java - Problems passing data to jquery's getJSON() - Will not accept map -

i trying serialize form (jsp/struts 1.1) , put object or map or whatever jquery's .getjson() method needs. here js code: // function makes ajax call, passing entire form action class function ajaxcallwithform(inputurl, formname, onreturnfunction) { var formasmap = serializeform(formname); $.getjson(inputurl, formasmap, onreturnfunction); } function serializeform(formname) { var obj = {}; var = $('#'+formname).serializearray(); $.each(a, function() { if (obj[this.name] !== undefined) { if (!obj[this.name].push) { obj[this.name] = [obj[this.name]]; } obj[this.name].push(this.value || ''); } else { obj[this.name] = this.value || ''; } }); return obj; } this results in java.lang.illegalargumentexception on end (something beanutils.populate servlet method). if set 2nd of 3 parameters of .getjson() call this, works fine , data sh...

c++ - What is std::promise? -

i'm familiar new standard library's std::thread , std::async , std::future components (e.g. see this answer ), straight-forward. however, cannot quite grasp std::promise is, , in situations best used. standard document doesn't contain whole lot of information beyond class synopsis, , neither just::thread . could please give brief, succinct example of situation std::promise needed , idiomatic solution? in words of [futures.state] std::future asynchronous return object ("an object reads results shared state") , std::promise asynchronous provider ("an object provides result shared state") i.e. promise thing set result on, can get associated future. the asynchronous provider creates shared state future refers to. std::promise 1 type of asynchronous provider, std::packaged_task another, , internal detail of std::async another. each of can create shared state , give std::future shares state, , can make state ready. std::asyn...

c++ - reading a file and splitting the line into individual variables -

program #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line,p1,p2,p3; ifstream myfile ("infile.txt"); if (myfile.is_open()) { while ( myfile.good() ) { /* myfile >> p1 >> p2 >> p3 ; cout << "p1 : " << p1 << " p2 : " << p2 << " p3 : " << p3 << endl; */ getline (myfile,line); cout << "line : " << line << endl; } myfile.close(); } else cout << "unable open file"; return 0; } infile.txt name param1 = xyz param2 = 99 param3 param_abc = 0.1 june 2012 output line : name line : param1 = xyz line : param2 = 99 line : param3 line : param_abc = 0.1 line : june 2012 line : i want search param2 , print value i.e. 99 after read line, parse it: stringstream ss(line); string token; if (ss >> t...

internet explorer - iframe zoom issue -

i attempting cross-browser css zoom work, have found here isn't working me. here have: html <div id="themeframe"> <div class="themeframe-overlay"></div> <iframe src="/index.php"></iframe> </div> css #themeframe{ position:relative; width:520px; height:400px; margin-top: 20px; border: none; overflow: hidden; } #themeframe .themeframe-overlay{ position:absolute; z-index:95; left:0;top:0; height:100%;width:100%; background:#fff; opacity:0; filter: alpha(opacity = 0); } #themeframe iframe { width:1040px; min-height: 800px; overflow: hidden; -moz-transform: scale(0.5); -moz-transform-origin: 0 0; -o-transform: scale(0.5); -o-transform-origin: 0 0; -webkit-transform: scale(0.5); -webkit-transform-origin: 0 0; -ms-transform: scale(0.5); -ms-transform-origin: 0 0; margin: 0; padding:0; border: none; } what trying achieve? have 520 x 400 div want filled 50% scaled version of webpage. shown above, have issue...

Delegate pattern vs delegate keyword in C# -

from msdn doc : a delegate type safely encapsulates method, similar function pointer in c , c++. unlike c function pointers, delegates object-oriented, type safe, , secure. i know , how use it. wonder whether or not written base on delegate pattern know (from wikipedia ) . difference between them? the c# (not pattern) delegate might useful when implementing delegate pattern @ delegate pattern implementation wikipedia changes: //note: sample, not suggestion in such way public interface { void f(); void g(); } public static class { public static void f() { system.console.writeline("a: doing f()"); } public static void g() { system.console.writeline("a: doing g()"); } } public static class b { public static void f() { system.console.writeline("b: doing f()"); } public static void g() { system.console.writeline("b: doing g()"); } } public class c : { // delegation action if = a.f; ...

Python code to delete photos/albums from facebook account. -

i want build python program deletes photos facebook account. later on, might want extend code delete friends. i read oauth, graph databases , have vague idea facebook api. i tried this: logging facebook python . login. isn't working reason. , not sure if right way requirements. can me kickstart in right direction? thanks , apologies if missed something. try ty use sdk http://pypi.python.org/pypi/facebook-sdk log in. can use delete http method remove objects need. see http://developers.facebook.com/docs/reference/api/ more

c# 4.0 - C# Getting Parent Assembly Name of Calling Assembly -

i've got c# unit test application i'm working on. there 3 assemblies involved - assembly of c# app itself, second assembly app uses, , third assembly that's used second one. so calls go this: first assembly ------> second assembly---------> third assembly. what need in third assembly name of fist assembly called second assembly. assembly.getexecutingassembly().manifestmodule.name assembly.getcallingassembly().manifestmodule.name returns name of second assembly. , assembly.getentryassembly().manifestmodule.name return null does know if there way assembly name of first assembly? as per other users demand here put code. not 100% code follow of code this. namespace firstassembly{ public static xcass { public static stream openresource(string name) { return reader.openresource(assembly.getcallingassembly(), ".resources." + name); } } } using firstassembly; namespace secondassembly{ public static class ...

ruby on rails - Conflicting Mongoid versions with Heroku/MongoHQ -

i have rails 3.2 app i'm trying going on heroku using mongoid , mongohq , i've found have use different version of mongoid gem local development vs heroku. here have found; to app working on heroku , mongohq have use mongoid 2.4.11 app working locally have use mongoid 3.0.0.rc here errors getting; mongoid 2.4.10 locally, undefined class/module moped:: mongoid 3.0.0.rc on heroku/mongohq we're sorry, went wrong. why incompatibility?

asp.net mvc 3 - Wrapper class in MVC3 -

i want create wrapper class queries should not in controller. select queries placed in controller. want create layer abstraction. i created viewmodel class. wrapper class else. how do that? i don't queries directly in controllers. have service layer controller call, , each service layer call repository insert, update or delete data or bring data. the sample code below uses asp.net mvc3 , entity framework code first . lets assume want bring countries , use whatever reason in controller/view: my database context class: public class databasecontext : dbcontext { public dbset<country> countries { get; set; } } my country repository class: public class countryrepository : icountryrepository { databasecontext db = new databasecontext(); public ienumerable<country> getall() { return db.countries; } } my service layer calls repository: public class countryservice : icountryservice { private readonly icou...

jquery - Assign VAL of input to other inputs before the click method -

i have 3 date range forms on site. want hide 2 of date ranges , show user one. however, still need value's chosen in 1 date range distributed other date ranges. tried applying val of first date range variable before click , applying other inputs, doesn't seem working. $('#edit-submit-calendar-full').click(function(){ var startdate = $('#edit-fd-min-datepicker-popup-1').val(); var enddate = $('#edit-fd-max-datepicker-popup-1').val(); $('#edit-fw-min-datepicker-popup-1').val(startdate); $('#edit-fw-min-datepicker-popup-1').val(enddate); $('#edit-sd-min-datepicker-popup-1').val(startdate); $('#edit-sd-min-datepicker-popup-1').val(enddate); }); edit: seem working basic example, when redirects page, inputs never filled in. doing more testing. it turns out had error selectors. code above works prop...

lucene - Is Solr 4 Production Ready? -

we right integrating solr search 1 of shopping cart application. have read several suggestions here on stackoverflow use solr 4 having support join in indexes. my question is, solr 4 production ready? , more importantly using join between 2 indexes have performance impact? check road map solr 4.0 the current roadmap discussed devs (as of may 2012) 4.0 is: 4.0-alpha release sometime in jun/jul 2012. 4.0-beta release no sooner 30 days after 4.0-alpha. beta release may contain additional features & api changes compared alpha release, should not change index format unless absolutely necessary fix bug. 4.0 (final) release no sooner 30 days after 4.0-beta. final release may contain additional features , api additions compared beta release, should not change apis (or index format) beta release unless absolutely necessary fix bug. also, don't think solr supports join across indexes. entities need within index. can confirm. performance, think better ask on sol...

ruby on rails 3 - Devise: how can I access the helper methods in all my controllers -

i'm trying implement devise sign in form in nav bar header(twitter bootstrap), tells me resource isn't defined method. do need somehow inherit devise helper methods achieve this? when comes creating custom sign in page, doesn't have controller, has accessing things in view, through helper of helper methods. want add them application_helper.rb file. there overview of method here: https://github.com/plataformatec/devise/wiki/how-to:-display-a-custom-sign_in-form-anywhere-in-your-app in nutshell, want add yours application_helper.rb def resource_name :user end def resource @resource ||= user.new end def devise_mapping @devise_mapping ||= devise.mappings[:user] end i have used bunch of times in projects make custom sign in forms in navbar when use twitter bootstrap. works great , doesn't require change other code anywhere else.

php - pagination within the facebook API (photos) -

i'm developing facebook app needs access users photos. needs loop through of users active photos i'm having trouble pagination aspect of feed. results api stdclass object ( [data] => array ( [0] => stdclass object ( [id] => 10151796309135076 [from] => stdclass object ( [name] => daniel benzie [id] => 762525075 ) ) ) ) obviosuly above excerpt , down bottom there section next , previous pages. [previous] => https://graph.facebook.com/762525075/photos?access_token=xxxxxxx&limit=25&since=1338985293&__previous=1 [next] => https://graph.facebook.com/762525075/photos?access_token=xxxxx&limit=25&until=1332002972 this set- know best way loop through photos in case? in advance (: keep calling next url until there no mo...