Posts

Showing posts from April, 2012

visual c++ - LoadLibrary() fails with error 1114: "A DLL initialization routine failed" for Users -

i have situation loadlibrary() fails error 1114, fails when user logged in part of "user" group. works fine "administrators" , "power users". can run fine if start application "run as" administrator or power user i can step through of code, can not make changes (at least not changes can rolled out field), unfortunately solution has external application. so far tried give full access directory (and containing files) exes , dlls user group without success. next started looking group policy, before go in modifying bunch of stuff, thought id run community. thank in advance a dll initialization routine failed means dllmain of library returned anormal status, must require administrator run. if specify library want load can provide better answers.

java - Installing JDK without administrator privileges -

i trying install jdk @ office laptop says need administrator privileges. have access own account @ work. how can install java development kit without administrator rights? here workaround install java without admin privileges or without administrator password. need cygwin installed not require admin privileges. in utils make sure select cabextract.exe install it. fireup cygwin bash shell. type cabextract jdk1.6.exe <-- jdk file name this extract files current directory. move tools.zip new directory , unzip using cygwin or windows explorer. java directory. hint: try subsitite 7zip instead of cabextract , cygwin. if works faster. edit: doesn't working jdk latest versions of jdk 6 , 7. many of jar files (eg rt.jar) compressed need decompressed using unpack200. just go through each directory looking files .pack extension , unpack them using unpack200, eg: .\jre\bin\unpack200 .\jre\lib\rt.pack .\jre\lib\rt.jar this allows run java programs still had tr...

linux - Unable to remove files from directory -

i using rm delete files directory through perl script throws error can't exec "rm" no such file or directory . command goes : system("rm $directory$files"); $directory$files = /var/spool/mqueue/qf* perl has builtin function removing files, unlink . third example shows how use in combination glob delete list of files: unlink glob "*.bak"; or in case, unlink glob($directory.$files);

c# - Combobox selected item is deleted once selected . Invalid Postback or Callback argument -

i have 4 textboxes 1 combobox , 1 button ( , other controls) in page . based on values typed in textboxes related values updated in combobox. on clicking submit button in page giving following error . "invalid postback or callback argument. event validation enabled using in configuration or in page. secuity purposes,this feature verifies arguments postback or callback events originate server control rendered them. if data valid , expected . use clientscriptmanager.registerforeventsvalidation method in order register postback or callback data validation." now in page directive added <%@page enableeentvalidation="false"> when type values in 4 textboxes corresponding value appear in cobobox . when select combobox value, selected value wil deleted . reason ? <%@ page language="c#" masterpagefile="~/main.master" autoeventwireup="true" codebehind="addechecklist.aspx.cs" inherits="labtr...

c# - dynamically add a link button in gridview template field at run time together a label control -

i have gridview in form. working rowdatabound event grid. have template field inside columns of gridview. label has been taken inside template field. want add link label on rowdatabound event @ runtime, .system.web.ui.webcontrols.linkbutton showing instead of link button. how add link button label text in grid view? just add linkbutton inside templatefield <asp:gridview runat="server" id="gridview"> <columns> <asp:templatefield> <itemtemplate> <asp:linkbutton runat="server" id="lnktest"></asp:linkbutton> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> then in rowdatabound event can find , whatever want void gridview_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { enti...

cocos2d iphone - object is moving in the accelerometer -

i want create 1 game in cocos2d in 1 object running . i want move object left , right base on device accelerometer. getting value of accelerometer , update location of object. can see new location in log. object not moving it's possion. here code have writen in app . - (void) accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration *)acceleration1 { acceleration = acceleration1; cgpoint position = mainplayer.position; if(acceleration.y < -0.25) { // tilting device right position.y -= 0.25; } else if (acceleration.y > 0.25) { // tilting device left position.y += 0.25; } else { } // newposition = position; ccaction *action = [ccmoveto actionwithduration:0.01 position:position]; [mainplayer runaction:action]; // mainplayer.position = ccp(position.x, position.y); } i have try both way setting position direct , using action. dose 1 knows why problem occure or setting need accelerometer work. please give link such kind exampl...

operating system - Difference between Counting and Binary Semaphores -

what difference between counting , binary semaphore. what have seen somewhere both can control n number of processes have requested resource. both have taken , free states. is there restriction on how many resources binary semaphore , counting semaphore can protect? both allow 1 process use resource @ time... is there other difference? above mentioned properties correct? actually, both types used synchronize access shared resource, whether entity trying access process or thread. the difference follows: binary semaphores binary, can have 2 values only; 1 represent process/thread in critical section(code access shared resource) , others should wait, other indicating critical section free. on other hand, counting semaphores take more 2 values, can have value want. max value x take allows x process/threads access shared resource simultaneously. for further information, take @ link. http://www.chibios.org/dokuwiki/doku.php?id=chibios:articles:semaphores_mutexe...

php - Change the uri of a module without renaming the class in PyroCMS -

what best way change uri of module without renaming class. example i'd blog module show: / blog /post-title -> / news /post-title routes.php? first added routes.php. $route['news/([0-9]+)/([0-9]+)/([a-za-z0-9_-]+)'] = 'blog/$1/$2/$3'; then make sure correct links added blog plugin.php. foreach ($posts &$post) { $post->url = str_replace('blog/', 'news/', $post->url); }

c# - When I copy a file I get The process cannot access the file "..." because it is being used by another process -

i know easy 1 guys. new @ , know there probly program want learn. my program copy files 1 location another, depending on age of file. when file going copied error. here 3 classes. //find.cs using system; using system.io; using system.collections; namespace findold { class find { static void main(string[] args) { console.write("please select option use: [c]opy, [m]ove, [d]elete : "); string type = convert.tostring(console.readline()); console.write("what source path: "); directoryinfo source = new directoryinfo(console.readline()); console.write("what destination path: "); string destination = console.readline(); console.write("files of age want manage: "); int32 months = convert.toint32(console.readline()); string rootpath = convert.tostring(source.parent); string newdest = path.combine(de...

ios - Int failing to do math? -

i have in value set 10. run nstimer code: [nstimer scheduledtimerwithtimeinterval:0.01 target:self selector:@selector(updatetimer) userinfo:nil repeats:yes]; void this -(void)updatetimer { timeleft = timeleft -0.01; nsstring *string = [nsstring stringwithformat:@"%i",timeleft]; [timer setstring:string]; nslog(string); } i using coco2d, not problem in log comes out this 2012-06-05 17:28:56.030 numberpop[31291:10a03] 9 2012-06-05 17:28:57.030 numberpop[31291:10a03] 8 2012-06-05 17:28:58.030 numberpop[31291:10a03] 7 2012-06-05 17:28:59.030 numberpop[31291:10a03] 6 2012-06-05 17:29:00.030 numberpop[31291:10a03] 5 2012-06-05 17:29:01.030 numberpop[31291:10a03] 4 2012-06-05 17:29:02.030 numberpop[31291:10a03] 3 2012-06-05 17:29:03.030 numberpop[31291:10a03] 2 2012-06-05 17:29:04.029 numberpop[31291:10a03] 1 2012-06-05 17:29:05.029 numberpop[31291:10a03] 0 2012-06-05 17:29:06.029 numberpop[31291:10a03] 0 2012-06-05 17:29:07.029...

jquery - How can I force stop a JavaScript image preloading sequence (preloader by Ariel Flesler)? -

say have button on web page. whenever buttons clicked, content (a whole list of image files can go 5mb) pre-loaded asynchronously , added web page when loading complete. but makes sense stop pre-loading procedure if button clicked again before first pre-loading procedure finish, , start second. how can achieve forced stop? by way, i'm using ariel flesler's jquery based image preloader . thanks in advance! it's werid code there 2 places images kept img variable , $preload.cache array. you can add settings.control(function() { imgs = null; $preload.cache = []; }); it can after lines var imgs = $(array(settings.threshold+1).join('<img/>')) .load(handler).error(handler).bind('abort',handler).each(fetch); and can pass function abort var _abort = null; $('<your button>').click(function() { if (_abort) { _abort(); } $.preload( '#images img', { placeholde...

ios - Objective C Passing Data -

Image
displaycontoller *show = [[displaycontroller alloc] initwithnibname:@"displaycontroller" bundle:[nsbundle mainbundle]]; contacts *contacts = [arr objectatindex:indexpath.row]; show.context = context; show.contacts = contacts; in display view controller ok, , again passing same data edit view controller editcontoller *edit = [[editcontroller alloc] initwithnibname:@"editcontroller" bundle:[nsbundle mainbundle]]; edit.context = context; edit.contacts = contacts; in edit view controller empty cells if print data (null) if skip detail view controller, table edit view controller works great... when table view display edit view, zeros(nill). in display, insert these 2 logs before 2 assignments , observe log. nslog(@"context: %@", context); // see valid data nslog(@"contacts: %@", contacts); // see valid data edit.context = context; edit.contacts = contacts;

javascript - how to enable fb-login for dynamic subdomains -

what way(rather best way) enable fb-login dynamic subdomains? suppose have domain.com , app self-serve , allow end-user create personal app(e.g. myapp.domain.com), fb-login/registration enabled. how can have single fb-script handle scenario? . what problem? if have set example.com domain in app settings, should able login everything .example.com, no matter everything is.

django - Permission on specific instances of a model -

i've got customuser model additional field region , other models same field. how can allow instance of customuser add/delete/view instances of other models (give permissions) same region value only? edit using custom manager, suggested vivek soundrapandi, can do class shopmanager(models.manager): def get_query_set(self): return super(shopmanager, self).get_query_set().filter(region=?) but how can filter shop instances region of connected user? and still allow customuser modify shop instances other region using default manager, right? there no way using django permission system? thanks use django-guardian (actually that's it, wants more characters)

java - Why is it that an overridden method can't throw a new checked Exception -

this question has answer here: why can't overriding methods throw exceptions broader overridden method? 10 answers i have 2 questions : what purpose of constraint overridden method can't throw new checked exception? why allowed overridden method can throw or none, or subset of checked exceptions specified in throws clause of overridden method in superclass? in both cases, it's because base method you're overriding has set contract calling code; if add checked exceptions method may throw, you'd breaking contract. consider class base method foo throws checked exception someexception . have derived derives base , overrides foo . code in app using base b variable initializing new instance of derived , , calling b.foo() . contract foo throws someexception ; throwing else breaks contract.

objective c - NSString with wrong characters when using UTF-8 -

i data utf-8 encoded xml file, , want display every element in uitableview . want cells have same size , display 2 first text lines data possible tried remove carriage returns. in cellforrow method changed : [[mycell textlabel] settext:data]; by : [[mycell textlabel] settext:[self correctdata:data]]; here correctdata method : - (nsstring *) correctdata : (nsstring *) str { nsmutablestring *res = [nsmutablestring stringwithformat:@""]; for(int = 0 ; < [str length] ; i++) { char car = [str characteratindex:i]; if(car != 10 && car != 13) [res appendstring:[nsstring stringwithformat:@"%c",car]]; } return res; } and correctly removes carriage returns, alters utf-8 chars. example, bit of initial string (str) : diplômé(e) d'etat and function becomes : diplÙmÈ(e) d'etat what should ? thanks. nsstring works unichar characters stored on 16bits whereas char 8bits lo...

singleton - What are the advantages and disadvantages of creating an Object in static block in Java? -

this question might blunder of java experts. know why create objects in static method main not in static block. understand going create object unnecessarily if instantiate in static block , of course if don't use further. there other things noted approach ? can relate singleton pattern ? for example: public class myclass { static { anotherclass object = new anotherclass(); // operations here object. } } the main reason control on when gets executed. stuff in static block executed first time class loaded , it's easy accidentally cause class loaded (for instance referencing constant on class). having static method means have complete control on when method called (because have explicitly call it). in regards singletons, java idiom eagerly loaded singletons initializes instance static field. run same static block. public class singleton { private static final singleton instance = new singleton(); private singleton() ...

javascript - How Can decode sha1 code? -

i have code can't decode need you. please me. firstly don't know type. ? sha1 ? md5 ? hash ? know code have 40 character. how can decode security code ? it's have game score need decode can't decode it. this code: "security":" c6aefe7f8c9fd439f59635efc82fcbd4f6cd4b9c " it's protect game inform. when changed anything, it's not confirm security code. full code: {"security":"c6aefe7f8c9fd439f59635efc82fcbd4f6cd4b9c","time":40844,"numberofbirdsshot":2,"type":"levelcomplete","blocks":"800,100,130,130,130,130,310,110,300,300,110,10,150,70,120,60,40,60,60,110,130,80,70,140,180,20,190,20,40,40,90,70,10,10,40,10,40,190,190,40,40,50,20,130,20,140,10,60,90,120,120,10,10,80,100,120,30,90,90,290,100,80,120,70,70,370,150,50,50,160,160,10,30,250,160,180,180,130,70,70,130,60,30,30,130,320,70,70,170,70,150,40,40,90,30,110,120,270,60,40,180,140,220,30,20,160,460,10,30,70,...

mysql - PHP script not executing upon HTML Form 'Submission' -

i building website form in html want gather information users, , store in mysql. however, when submit form after entering information, php script not executed. displays php script in raw form. in browser, downloads php file. at first, lead believe issue mysql, php, apache configuration, after following this step step, still cannot execute php script. my form's header looks so: <form id="form-settings" method="post" action="file.php"> file.php being script want execute upon submission. here php script: <?php error_reporting(e_all); $link = mysql_connect("localhost","username","password"); if (!$link) { die('not connected : ' . mysql_error()); } mysql_select_db("mysql", $link) or die("unable select database"); $var1=$_post['var1']; $var2=$_post['var2']; $var3=$_post['var3']; $var4=$_post['var4']; $var5=$_post['var5']; $...

scala - Creating a Class[T] from a Manifest[T] without casting -

given ev: manifest[t] can class[t] using ev.erasure.asinstanceof[class[t]] . it's shame ev.erasure alone returns static type of class[_] . can class[t] manifest without casting? if not there reason why blessed scala creators have gone raw return type in erasure method? i understand may have negligible impact on code i've run issue in arguably non-idiomatic piece of scala code , curious more else. no, have cast — , should so. cast potentially unsafe, depending on want returned class instance. imagine want roll in own version of cast: def cast[t](obj: any)(implicit m: manifest[t]) = m.erasure.asinstanceof[class[t]].cast(obj) this dangerous — indicated unchecked asinstanceof . why? because code runs fine such nonsense, instance: val listint = list(1, 2, 3) val liststring = cast[list[string]](listint) there, list[int] typed list[string] . , compiles , runs fine, you'll classcastexception later in code @ unexpected line. that's why cannot d...

Go session variables? -

i'm new go language (golang) , i'm writing web-based application. i'd use session variables, kind in php (variables available 1 page next , unique user session). there in go? if not, how go implementing them myself? or alternatives methods there? you want take @ gorilla . has session support documented here . other or possibly 1 of other web toolkits go have roll own. possible solutions might be: goroutine per user session store session variables in memory. store variables in session cookie. use database store user session data. i'll leave implementation details of each of reader.

x86 - Sum reduction of unsigned bytes without overflow, using SSE2 on Intel -

i trying find sum reduction of 32 elements (each 1 byte data) on intel i3 processor. did this: s=0; (i=0; i<32; i++) { s = s + a[i]; } however, taking more time, since application real-time application requiring lesser time. please note final sum more 255. is there way can implement using low level simd sse2 instructions? unfortunately have never used sse. tried searching sse2 function purpose, not available. (sse) guaranteed reduce computation time such small-sized problems? any suggestions?? note: have implemented similar algorithms using opencl , cuda , worked great when problem size big. small sized problems cost of overhead more. not sure how works on sse you can abuse psadbw calculate small horizontal sums quickly. something this: (not tested) pxor xmm0, xmm0 psadbw xmm0, [a + 0] pxor xmm1, xmm1 psadbw xmm1, [a + 16] paddw xmm0, xmm1 pshufd xmm1, xmm0, 2 paddw xmm0, xmm1 ; low word in xmm0 total sum attempted intrinsics version: i n...

java - Programmatically call menu item with Eclipse JDT, Plug-In Development -

i've been trying figure out while how call eclipse menu item within plug-in i'm developing. say, sake of posting, want call eclipse "format" menu item in right click menu format source, how go doing calling item (i.e. not mimicking menu item's effect, calling it)? i'm not looking how format code, idea of calling menu item. i leaning towards apis info on iworkbench, shell, toolbar, toolitem, etc., don't know. haven't been able find on topic in apis or anywhere else online. there better approach doing rather programmatically? eclipse jdt - http://help.eclipse.org/indigo/index.jsp?nav=%2f3 edit: string commandid = "org.eclipse.jdt.ui.edit.text.java.format"; ihandlerservice handlerservice = (ihandlerservice)(ihandlerservice ) platformui.getworkbench().getservice(ihandlerservice.class); handlerservice.executecommand(commandid, null); simple that. hardest part finding commandid, can searched for, rlegendi mentioned. wanted. accesses...

ssh - Why does Fabric throw 'TypeError: argument must be an int, or have a fileno() method'? -

when running fabric task on remote server following stack trace: [x.x.x.x] run: git fetch && git reset --hard origin/develop exception in thread thread-2: traceback (most recent call last): file "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() file "/var/lib/jenkins/jobs/deploy/workspace/.pyenv/lib/python2.6/site-packages/ssh/agent.py", line 115, in run self._communicate() file "/var/lib/jenkins/jobs/deploy/workspace/.pyenv/lib/python2.6/site-packages/ssh/agent.py", line 125, in _communicate events = select([self._agent._conn, self.__inr], [], [], 0.5) typeerror: argument must int, or have fileno() method. the fact fabric task trying perform git fetch , exceptions raised in ssh/agent.py makes me think wrong ssh authentication. the same user can run git fetch outside of fabric, , task runs fine on laptop. what's going on here? how resolve issue? an issue raised on fabric'...

Hibernate mapping -

i have hibernate mapping using "class" tag representing publisher object. 1 of publisher field big description (30k char max). i'm using oracle varchar field have maximum of 4k char, i'm force split description in 8 differents fields (i'm force use varchar field type btw). wan't hide database complexity , have 1 description field in publisher object. the way found far have "transit" object mapped in hibernate 8 description field manually copy on fly in final publisher object 1 description. anyone got better way ? i imagine employ hibernate's custom usertypes "magically" combine columns single value. this section of of docs discusses how combine 2 columns create custom currency class upon retrieving data table. might started. http://docs.jboss.org/hibernate/orm/3.6/reference/en-us/html/types.html#types-custom i'm using load blobs database, , works nicely and, once usertype written , mapped database mappings...

jython - Remove all strings from list of strings and integers -

you given: list1 = [2, "berry", "joe", 3, 5, 4, 10, "happy", "sad"] want return [2, 3, 5, 4, 10] is possible remove strings list? using a list-comprehension can construct list elements want. >>> list1 = [2, "berry", "joe", 3, 5, 4, 10, "happy", "sad"] >>> [i in list1 if isinstance(i, int)] [2, 3, 5, 4, 10] alternative in case example have floats , wish keep those, too: >>> list1 = [2, "berry", "joe", 3, 5, 4, 10.0, "happy", "sad"] >>> [i in list1 if not isinstance(i, str)] [2, 3, 5, 4, 10.0]

php - Place text between sidebar Wordpress widgets -

where can code add "or" between 2 of wp sidebar widgets? understand add text widget , place word "or" in there. however, when that, css styling sidebar widgets has background-color , border. not want "or" have same styling. want text between 2 widgets have on site. can place "or" once, incase more widgets added? thanks in advance! you use plugin magic widgets . offers widget named unfiltered text name says: prints content put in there. doesn’t use before_widget , after_widget parameters, can use create content full control. disclosure: i’m author of plugin.

objective c - One UIButton two scenes only one segue, conditional code needed -

Image
i have created several scenes within storyboard file in xcode project, , first scene loaded user login in screen. when user logs in uibutton "login" takes user welcome screen. setup in storyboard using modal segue. want user name "admin" taken welcome admin screen. i'm pretty sure it's possible have 1 segue associated 1 object, i.e. uibutton in storyboard, stumped how can accomplish login take admin admin welcome screen, , take other users user welcome screen. don't want create 2 separate login buttons, that's not option. i came across stackoverflow posts similar questions answers seemed little convoluted. keep in mind new xcode, if paste code in answer please specify file code should go in (that me out lot). i'll post picture of storyboard looks far demonstrate visual diagram of talking about. if understood question correctly, here steps need take make work: from welcomeviewcontroller – have username / password login ...

r - Unpacking a vector into a list with each element of vector as separate elements in list -

with following code, creating list: scales <- c(p="hye", r="t3") details <- list(t=20,y="c", scales) at moment above gives me list so: $t [1] 20 $y [1] "c" [[3]] p r "hye" "t3" however want list so: $t [1] 20 $y [1] "c" $p [1] "hye" $r [1] "t3" since going reused in function want keep scales vector argument can insert list. how can this? the solution is: details = c(list(t=20,y="c"),scales)

asp.net - MVC4 Mobile Framework -

since mvc4 mobile still new , has limited info on @ time, wondering if mobile framework meant windows phone applications or meant mobile web browsers in general. in other words if create mvc4 mobile application, compatible use mobile browsers? info. it meant mobile web browsers in general. more information , list of how test different browsers located @ http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-4-mobile-features .

input - setText() doesn't really work Python -

import sys pyqt4 import qtcore,qtgui windows.intro_win import ui_introduction windows.post_adder_win import ui_posttool import win32clipboard import pyhook class intro(qtgui.qmainwindow): def __init__(self,parent=none): qtgui.qwidget.__init__(self,parent) self.ui = ui_introduction() self.ui.setupui(self) class posttool(qtgui.qmainwindow): def __init__(self,parent=none): qtgui.qwidget.__init__(self,parent) self.ui2 = ui_posttool() self.ui2.setupui(self) def setmodposition(self): self.ui2.lineedit_2.settext("something") print "nomnom" def onkeyboardevent(event): keyclicked = event.keyid if keyclicked == 121: print "debug keyboardevent" omd_post.show() posttool().setmodposition() if __name__ == "__main__": app = qtgui.qapplication(sys.argv) omd_intro = intro() omd_post = posttool() omd_intro.show() eventkey = pyhook...

C# getting full path of an input file in win XP -

i wrote simple console tool reads file , writes out. intend drag , drop files , out pops output in same directory input file. all of testing works, , when call command-line, comes out expected. however, when tried dragging , dropping in explorer, no files created. i did search through system , found dumped @ documents , settings under user folder, , when printed out full path that's said. which weird. wouldn't path.getfullpath return absolute path of input file? instead looks combined user directory path input's filename. edit: here's code. feel i've made logic error somewhere can't seem see it. filename = system.io.path.getfilename(args[i]); abspath = path.getfullpath(filename); dirpath = path.getdirectoryname(abspath); .... console.writeline(dirpath); path.getfullpath should return absolute path of path string pass in. path.getfilename(string path) returns filename , extension of file pass in. example, system.io.path.getfilename(...

php - Custom/Own Views in opencart -

i trying develop e-commerce application. have application's view pages standalone html pages(neatly formatted images , styling need) , trying plug them e-commerce package. e-commerce application has simple workflow -> customer adds products cart , check out followed order confirmation. now question how add existing view pages opencart? tried load view controller error says page not found. thanks in advance. most e-commerce solutions php based because incorporating database products. unless want develop own solution scratch, easier use existing platform , create customized template. have found zencart easiest create custom templates for, personal opinion

php - Multiple time execution bypass -

i have follow (sample) code: class foo { public function __construct() { $this->bar = new bar(); $this->baz = new bazr(); } } class bar extends foo { public function __construct() { parent::__construct(); $baz = $this->baz->alert(); } } class baz extends foo { public function __construct() { parent::__construct(); } public function alert() { echo('hello!'); } } new foo(); which generate fatal error: maximum function nesting level of '100' reached, aborting! . want is, this, ofcourse different code , no errors. what want 1 way know when instance created , not allow more instances of same object, avoiding circular reference. learned singletom, but, nothing worked. have idea? the constructor of foo calls constructor of bar calls constructor of foo calls constructor of bar... idea. after 100 times tells it's dizzy. don't create circular reference th...

javascript - jquery slide large table in sections left and right -

i have display table many columns on web page. columns days of week therefore 7 columns need displayed @ once (out of 4 weeks in total). i have set window overflow set hidden displays first 7 days , managed table scroll left 7 days table won't scroll further this. if scroll table scrolls far , table totally disappears right. i quite new jquery , realise should using possibly position() or offset() functions. sure simple piece of code although hours of googling have turned nothing covers problem. does know decent tutorials out there me started ? thanks it having container div of 500px overflow set hidden continaing seperare div of 2000px. when user clicks on previous or next buttons inner div scroll plus or minus 500px dependent on position. try this: $('.next').click(function(event){ if($('.table').css('left') != '-1500px') { $(this).prop('disabled', true) $('.table').animate({left:'-=500...

ruby on rails - A Better Way To Render Complicated Flash Messages -

i have complex message show inside of flash message instead of having long string in controller, extracted partial. this: flash[:success] = render(:partial => "complicated_message") … respond_to |format| format.html format.js end and normal view should rendered display flash. double render error, of course, since have "wasted" render on partial. what better way this? the answer, suggested @jdoe use render_to_string method instead.

windows - Batch file to detect only part of a filename -

i need snippet of batch file can detect part of filename, rename it. note numbers after filename change randomly "file" same. example: filename: file143424 there 1 file needs renamed in folder. script delete older versions of file. instance, put first file inside folder , script in there too. run script, renames file. if put new file in, script, when run again, recognize "file" prefix , rename file after deleting old one. excuse me. question incomplete, think. want rename "file134342" what? in comment said: rename "file", works if there one file name. anyway, here is: for %%f in (file*) ren %%f file if not want, give more details (you showld give full details beginning).

android - Bloated background picture when using keyboard -

i have question regarding background pictures , android keyboard. my interface looks following in 2 pictures below. search function listview beneath it. problem is, whenever type in search-bar (edittext) keyboard appears , changes background picture. looks awful , bloated. how tell android not change background picture when using keyboard (just make keyboard slide on background picture without changing it) ? how background should like: http://tinypic.com/view.php?pic=2nsxowx&s=6 keyboard changes background mess: http://tinypic.com/view.php?pic=23huck0&s=6 this xml file: <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_search_task" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/searchable" android:gravity="center|top" android:orientation="vertical" android:stretchcolumns="1" andro...

python - Buildbot and Multiple SVN Branches -

my svn repository layout... project_name(root)/trunk /branches/ /branches/new_feature_of_trunk1 /branches/new_feature_of_trunk2 /tags/ /tags/etc1 /tags/etc2 i trying make buildbot build several branches of repository example... /trunk , /branches/new_feature_of_trunk1 .this how code it from buildbot.changes.svnpoller import svnpoller, split_file_branches source_code_svn_url='http://domain.com/svn/project_name/' c['change_source'].append( svnpoller( svnurl=source_code_svn_url, split_file=split_file_branches, pollinterval=60, histmax=10, ) ) def modified_files(change): name in change.files: if name.endswith(".c"): return true elif name.endswith(".h"): return true return false buildbot import scheduler buildbot.changes.filter import changefilter s1=scheduler.anybranchscheduler( na...

java - FileNotFoundException with 404 status for valid URL on HTTP GET request -

Image
i have following code perform request on following url: http://rt.hnnnglmbrg.de/server.php/somereferencenumber however, here output logcat: java.io.filenotfoundexception: http://rt.hnnnglmbrg.de/server.php/6 why return 404 when url valid? here connect code: /** * performs http request returns base64 data server * * @param ref * accident's reference * @return base64 data server. */ public static string performget(string ref) { string returnref = null; try { url url = new url(server_url + "/" + ref); httpurlconnection con = (httpurlconnection) url.openconnection(); con.setrequestmethod("get"); bufferedreader reader = new bufferedreader(new inputstreamreader(con.getinputstream())); stringbuilder builder = new stringbuilder(); string line; while ((line = reader.readline()) != null) { builder.append(line); } returnref = builder.tostring(); ...

java - Scrollbar disappears when using SectionIndexer at specific sections on HoneyComb -

i'm using adapter listview implements sectionindexer . listview has fastscrollenabled set true in xml file. works great on android 2.2 , 2.3, when test application on tablet android 3.0, @ sections scrollbar disappears. example when scroll down list, @ elements beginning letters a-b scrollbar visible, letters c-h it's not, , after h again visible. this adapter made sorting content alphabetically in listview fastscroll can used. application designed api level 8, couldn't use fastscrollalwaysvisible. here code of adapter: public class alphabetsimpleadapter extends simpleadapter implements sectionindexer { private hashmap<string, integer> charlist; private string[] alphabet; public typeface tfsansmedium; public context mcontext; public int mresource; public int[] mto; public list<? extends map<string, ?>> mdata; public string mtitlekey; public alphabetsimpleadapter(context context, list<? ex...

c# - Grid with empty rows in MVVM -

i want have excel grid empty rows(n-number of rows). gridview bound collection of m number of model objects. if user enters new data empty row new model object must added bound collection. everyone suggesting introduce empty model objects collection create empty rows, last comment said don't want empty rows in model. having viewmodel allow do. viewmodel contains display collection can have additional empty model objects still not persist them model layer. key viewmodel collection not same model collection. if ever need load data screen , keep was, need persist row number each model object , can insert empty model objects needed.

eclipse - How can I configure the Android emulator to simulate the Galaxy 3 -

i've seen similar question nexus, app crashes on galaxy 3 only.. knows correct parameters this? this kinda difficult. in avd manager options wich can adjusted. but otherwise developer need devices test on, or got users devices. as s3 has samsung's ui (touchwiz afaik) "could" cause probleme, anyway can not create emulator touchwiz. see smiliar problem: samsung galaxy s3 emulator settings

php - mysql automatically cast strings to integer -

i've noticed if mysql request one: select 1 mytable id = 'asdf' then string 'asdf' casted 0 . means have record id 0 match. format of id field int(8). what best way proceed: i need check (by php example) value numerical only? there mysql way that? i must remove record id 0 ? (bad) you must first sanitize inputs via php. $id = 'asdf'; if(is_numeric($id)){ $query("select 1 mytable id = $id"); }else{ die("id not numeric"); } or can do: select 1 mytable id = 'asdf' , 'asdf' regexp '^-?[0-9]+$' this cause regex = false, causing no rows return.

OpenCV 2.4.1 - computing SURF descriptors in Python -

Image
i'm trying update code use cv2.surf() opposed cv2.featuredetector_create("surf") , cv2.descriptorextractor_create("surf") . i'm having trouble getting descriptors after detecting keypoints. what's correct way call surf.detect ? i tried following opencv documentation, i'm little confused. says in documentation. python: cv2.surf.detect(img, mask) → keypoints¶ python: cv2.surf.detect(img, mask[, descriptors[, useprovidedkeypoints]]) → keypoints, descriptors how pass keypoints in when making second call surf.detect ? i not sure whether understand questions correctly. if looking sample of matching surf keypoints, simple , basic 1 below, similar template matching: import cv2 import numpy np # load images img =cv2.imread('messi4.jpg') # convert them grayscale imgg =cv2.cvtcolor(img,cv2.color_bgr2gray) # surf extraction surf = cv2.surf() kp, descritors = surf.detect(imgg,none,useprovidedkeypoints = false) # setting samples ...

wcf - Syntax to Specify both ServiceBehavior and EndpointBehavior? -

looking @ http://msdn.microsoft.com/en-us/library/ms731303.aspx , , http://msdn.microsoft.com/en-us/library/ms789007.aspx , examples given specify servicebehavior, there way specify endpointbehavior in behaviorconfiguration well? <service name="servicename1" behaviorconfiguration="servicebehavior1;endpointbehavior1"> ... <behaviors> <servicebehaviors> <behavior name="servicebehavior1"> ... </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="endpointbehavior1"> ... </behavior> </endpointbehaviors> </behaviors> ... silly question, endpoint element of web.config has own behaviorconfiguration attribute. <endpoint behaviorconfiguration="endpointbehavior1" ...

java - using gridview with images in android -

this problematic code: public class level1 extends activity { int[] logos = { r.drawable.arutz8, r.drawable.channel1, r.drawable.doctor_gav, r.drawable.foxgroup3, r.drawable.careline, r.drawable.golfnew, r.drawable.haaretz, r.drawable.hafenix, /*r.drawable.hando, r.drawable.bankleumi, r.drawable.jerusalempostred, r.drawable.laisha, r.drawable.logo, r.drawable.logodelta, r.drawable.maariv, r.drawable.pelephone, r.drawable.ravbariah, r.drawable.renuar, r.drawable.reshet_tv, r.drawable.sano, r.drawable.shilav, r.drawable.sport5, r.drawable.srigamish, r.drawable.steimatzky, r.drawable.superpharm, r.drawable.supersal, r.drawable.tambur, r.drawable.tzometsfarim, r.drawable.walla, r.drawable.yediot,*/ }; @override protected void oncreate(bundle save...

PHP: setlocale in Windows 7 -

i have problem setlocale function in php 5.3 in windows 7. i need set russian locale utf-8 encoding. saw solutions russian_russia.65001, function type of locale returns false. all solutions designed using in windows xp list of locales in control panel. in windows 7 feature removed. it's not possible use utf-8 locales on windows systems. : if provide code page utf-7 or utf-8, setlocale fail, returning null. only windows code page russian_russia.1251 work (see moodle's table of locales ). you may still try set both , see 1 comes trough: if ($newlocale = setlocale(lc_ctype, 'ru_ru.utf-8', 'russian_russia.1251')) { echo 'locale set to: ' . $newlocale; }

xterm python subprocess -

if using subprocess execute xterm on linux, in turn executes other process, seems python (2.6.5) never recognize process (xterm) has completed execution. consider following code: import subprocess import shlex import time proc = subprocess.popen(shlex.split('xterm -iconic -title "foo_bar" -e sleep 5')) while true: if proc.poll(): print 'process completed' time.sleep(0.1) this loop infinitely until terminate python interpreter. i'm guessing caused oddity xterm, , not direct cause of python subprocess module, maybe there other smart people out there shed light on situation. note: calling proc.communicate() in fact return when xterm completes, reason poll method not work. this program doesn't distinguish between proc.poll() returning none (meaning process still running) , proc.poll() returning 0 (meaning process terminated exit value of zero, conventionally indicating successful completion). change line: if pr...

.net - WPF MVVM Light master-detail in TabControl, pass selected item using messages -

i'm new wpf mvvm (light) , need help. what have master-detail scenario, tabcontrol in main view, master view (productsview) in first tab , multiple different details views (e.g. detailsview) in following tabs. depending on item selected (selectedproduct) in productsview, want fetch items in detailsview, not - when user clicks tabitem containing details view. so fetching detail data database should somehow deferred point when user clicks appropriate detail tab (he may not click @ all). here's xaml: <!-- main view --> <usercontrol x:class="myapp.views.mainview"> <tabcontrol> <tabcontrol.items> <tabitem> <views:productsview /> </tabitem> <tabitem> <views:detailsview /> </tabitem> <!-- more tabitems details views --> </tabcontrol.items> </tabcontrol> </usercontrol> <!-- products view --> <usercontrol x:class=...

How to solve Time in loop context in CMD -

i did own code try calculate delay when execute program within loop. weakness value %time% evaluated @ same moment. want ask you, possible change code move 2 blocks of calculations (using set /a) separate subroutines. searched web solution goto, not clear me how return loop. examples have found, referred on end of file. @echo off setlocal enabledelayedexpansion /f "tokens=*" %%a in ('date/t') %%b in (%%a) set today=%%b echo it's %today% today chcp 1250 > nul set tpath=temp /f "delims=" %%x in (delimiter.ini) set tab=%%x if not exist proxies.ini ( echo proxies not found! pause exit ) rem set array of proxies /f "eol= tokens=1,2 delims=%tab%" %%a in (proxies.ini) ( if "%%a"=="*" ( set asterisk=1 set http_proxy=%%b set t0=%time% wget.exe http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg set t1=%time% rem /f %%a in ('time/t') set t1=%%a echo !t0! ...