Posts

Showing posts from August, 2012

iphone - How to download and set a UIImage not on the main thread -

i'm adding image web service. how code it's not on main thread? want view load first , image load user doesn't experience slowness when detail view controller loads. what i'm unsure of how add dispatching code. here's code far: nsdata *imagedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:mainimageurl]]; uiimage *image = [[uiimage alloc] initwithdata:imagedata]; uiview *v = [[uiview alloc] initwithframe:cgrectmake(10, 150, 300, 180)]; uiimageview *iv = [[uiimageview alloc] initwithframe:cgrectmake(0, 10, 300, 180)]; [iv setimage:image]; [_scrollview addsubview:v]; [v addsubview:iv]; and i'm thinking can use threading: dispatch_async( dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ // add code here background processing // // dispatch_async( dispatch_get_main_queue(), ^{ // add code here update ui/send notifications based on // results of background processing }); }); thanks help you can use gcd d...

arrays - 'Repa' performance for planetary simulation -

i have written simulation of outer planets of solar system using euler symplectic method , implemented a) using repa , b) using yarr . yarr seems perform x30 quicker repa . given this, didn't try use parallelism. there obvious performance problems in repa code? repository @ github . can produce cut-down repa -only version if helpful, won't performance comparison against yarr . alternatively, how debug performance issues in repa ? most euler numeric integration methods suffer cumulative round-off error cause simulation "blow up". may want investigate advanced numerical integration methods, such 4th-order runge-kutta or predictor-corrector. another place n-body problem simulations become sticky when 2 bodies close, such moon eccentric orbit planet. if 1 uses fixed time increments simulation, error during large changes of angular velocity can lead division-by-zero errors or division small values result in simulation blowing up. use of variable...

html - Set height of p-element as percentage of containing div -

i want set height of <p></p> tag. many suggest setting line-height or margin, won't suffice, want p-tag percentage of containig div. actually, want vertically distribute p-tags across height. if them same size, can vertical-align , display: table , display: table-cell <div> <p>foo<p> <p>bar<p> </div> i know number of <p></p> tags. <p height="int%">lala </p> that set height of line of text percentage of containg div believe if not <div height="int%" > <p> lalal </p> </div> set padding work. work. if want font stretched think need new font.

winapi - Calling Win32 DLL from C++ -

i new dll world. have been given win32 dll has lot of functions. need call these dll functions c++ i want call createnewscanner creates new scanner object , results in c++. function mentioned in dll is: bool createnewscanner(newscanner *newscan); and newscanner struct , below, // structure newscanner defined in "common.h" . typedef struct{ byte host_no; // <- host_no =0 long time; // <- command timeout (in seconds) byte status; // -> host adapter status handle obj; // -> object handle scanner }newscanner; how call function? started c++ , here managed, #include <iostream> #include <windows.h> using namespace std; int main(){ hinstance hinstance; if(!(hinstance=loadlibrary("winscanner.dll"))){ cout << "could not load library" << endl; } /* pointer function in dll*/ farproc handle = getprocaddress(hmodule(hinstance), "createnewscanner"); if(!handle){ // h...

file - Portable way to check if directory exists [Windows/Linux, C] -

i check if given directory exists. know how on windows: bool directoryexists(lpctstr szpath) { dword dwattrib = getfileattributes(szpath); return (dwattrib != invalid_file_attributes && (dwattrib & file_attribute_directory)); } and linux: dir* dir = opendir("mydir"); if (dir) { /* directory exists. */ closedir(dir); } else if (enoent == errno) { /* directory not exist. */ } else { /* opendir() failed other reason. */ } but need portable way of doing .. there way check if directory exists no matter os im using? maybe c standard library way? i know can use preprocessors directives , call functions on different oses thats not solution im asking for. i end this, @ least now: #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> int direxists(const char *path) { struct stat info; if(stat( path, &info ) != 0) return 0; else if(info.st_mode ...

How to unbind mouseleave on click using jquery -

i have div when mouseenter previews image being shown - when mouseleave hides again. what i'm trying achieve when click div animates , shows, i'd unbind 'mouseleave' functionality image stays on screen isn't working - mouseleave still kicking in.... can help? here's code $('.attachment').on({ mouseenter: function (e) { tileid = (this.parentnode.id).substring(13); $('#imagecontainer-' + tileid).css('visibility', 'visible'); $('#imagecontainer-' + tileid).css('overflow-y', 'hidden'); $('#imagecontainer-' + tileid).stop().animate({ height: 40 }, { duration: 300, easing: animationeasing, queue: false }); }, mouseleave: function (e) { $('#imagecontainer-' + tileid).stop().animate({ height: 0 }, { duration: 300, easing: animation...

javascript - mering same geometry with different ambient colors -

i create custom geometry , use meshphongmaterial material. because geometry large, want merge them in 1 geometry better performance. problem want use different ambient color each child geometry. think can change color using more material , change materialindex each face, maybe not work , may costs lot of time , use more texture. there simple way archive this? i'm not sure how three.js render different material have no idea this.thanks help. the merge won't since materials stay different.

sql server - How to find matching pairs with transitivity of equality in MS SQL -

if have table data this: x1 y1 x2 y2 a001 1 b001 2 a001 1 b002 2 a002 2 a001 1 c001 2 b003 3 c002 1 b003 3 what sql query (microsoft sql server), achieve result this: groupid x y 1 a001 1 1 b001 2 1 b002 2 1 a002 2 2 c001 2 2 c002 1 2 b003 3 it's grouping equal pairs like: if == b , b == c == c well, after some trying found following: declare @mod int; set @mod=1; declare @newgrp int; set @newgrp=1; create table tbl([x1] varchar(4), [y1] int, [x2] varchar(4), [y2] int); insert tbl ([x1], [y1], [x2], [y2]) select 'a001', 1, 'b001', 2 -- modified input create chained equalities: union select 'b001', 2, 'b002', 2 -- --> replaced a001 1 b001 2 union select 'a002', 2, 'b002', 1 union select 'c001', 2, 'b003...

android - Unable to read file from server -

i want download file server. file created in android device file empty file. not writing in file. my filereading code follows: url url = new url(urlstring); httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setrequestmethod("get"); urlconnection.setdooutput(true); //connect urlconnection.connect(); file sdcardroot = environment.getexternalstoragedirectory(); //create new file, save downloaded file file file = new file(sdcardroot,pos); fileoutputstream fileoutput = new fileoutputstream(file); //stream used reading data internet inputstream inputstream = urlconnection.getinputstream(); //this total size of file downloading totalsize = urlconnection.getcontentlength(); //create buffer... byte[] buffer = new byte[1024]; int bufferlength = 0; while ( (bufferlength = inputstream.read(buffer)) ...

android - LinearLayout Animation behind other views -

i'm programming application in android, have problem animations. simplicate, have 3 "object" in horizontal linear layout (2 buttons @ extremities, , vertical linear layout in center want animate). problem when try move left, pass on button (and want behind). when try move right, pass behind button (like want). in topic it's same problem think there no answer :( android animation behind other views i have tried setzadjustment(animation.zorder_bottom) animations doesn't change anything. any idea ? my java code quite simple : layout_main= (linearlayout)this.findviewbyid(r.id.main_layout); movenext= animationutils.loadanimation(this, r.anim.move_next_seq); movenext.setzadjustment(animation.zorder_bottom); layout_main.startanimation(movenext); and xml : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation=...

regex - htaccess rule to parse php@parameter=anything as php file -

i want server treat files.php@parameter=anything simple php file i don't need use symbol " @ " separator, such " ? " but still want parse files.php@parameter=anything single php file without using parameters after @ i need like: addhandler php-script .php@cnt=(.*) but doesn't work.. p.s. got clother code <filesmatch \.php@cnt=(.*)$> sethandler php-script </filesmatch> but doesn't work too.. i suggest using mod_rewrite rewrite. enable mod_rewrite , .htaccess through httpd.conf , put code in .htaccess under document_root directory: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewriterule ^[^@]+@(.+)$ /$1?$2 [l] this internally rewrite /files.php@parameter=anything /files.php?parameter=anything , url handled php script.

Excel: search for a word in the column and copy it to another column on the same sheet -

i have excel table rows of data. column j contains various descriptions of goods. need search rows in column word latex , when found, copy word column on same sheet on same row. trying find solution , came macro using autofilter, not working properly. can please me? sub filterandcopy() dim dataws worksheet dim copyws worksheet dim totrows long dim lastrow long set dataws = worksheets("massiv") set copyws = worksheets("massiv") dataws .autofiltermode = false .range("j:j") .autofilter field:=1, criteria1:="latex" end end totrows = dataws.range("j:j").rows.count lastrow = dataws.range("j" & totrows).end(xlup).row dataws.range("j:j" & lastrow).copy copyws.range("a6").pastespecial paste:=xlpastevalues dataws.autofiltermode = false with following changes, code should work. i've noted changes in ...

Laravel Headers and Caching in php -

i have small image generator part of laravel4 application. takes 700ms generate image , have started caching generated result on server , returning browser instead saves time. as image never change once generated wanted tell browser cache image locally , have done following code: $path = $cachefolderpath . $cachefilename; if (file::exists( $path )){ $response = response::make(file::get($path)); $response->header('content-type', 'image/png'); $response->header('content-disposition', 'inline; filename="'.$cachefilename.'"'); $response->header('content-transfer-encoding', 'binary'); $response->header('cache-control', 'public, max-age=10800, pre-check=10800'); $response->header('pragma', 'public'); $response->header('expires', date(date_rfc822,strtotime(" 2 day")) ); $response->header('last-modified', date(...

c# - dropdown selectedindexchanged issue within modalpopup extender -

i'm having dropdown in modalpopupextender . dropdown values updated dynamically. the problem while clicking on button in modal popup...the dropdown values refreshed. tried take selected value of dropdown within sectedindexchanged event. if put breakpoint control not coming. can tell me fix this? selectedindexchanged event triggered when selection changed, not when change items in dropdown . may use datasourcechanged if change datasource property or other, or other events, depend on code ( please share it).

How to diagnose Segmentation Fault on Node.Js -

my node.js application fails "segmentation fault" , @ loss how diagnose cause. mentioned below have dramatically reduced frequency raising maxlisteners not made problem go away. the application runs on beaglebone black under node v0.8.22 , uses socket.io communicate realtime data browser pages displayed on bbb's lcd display. collects data sensor connected via i2c using korevec/node-i2c library. have, however, isolated library , still have failures. the failures occur when have streamed data while client though occasionally/rarely happen @ other times well. not surprising app uses socket.io communicate on pages streaming page @ higher volume. i getting below message: (node) warning: possible eventemitter memory leak detected. 11 listeners added. use emitter.setmaxlisteners() increase limit. trace and have been doing since day 1. seeing symptoms of memory leak since raised maxlisteners memory usage stays constant. failure rate after making chang...

android - Is it possible to only call Viewport Meta tag at 768px and below? -

the basic question: is there away can set viewport meta tag come effect @ 768px , below? reason: i've built responsive e-commerce site using standard @media browser sizes: over 1200px 1025px 1199px 980px 1024px 768px 979px due complexity of site it's not viable, time or layout wise, me use @media queries make site usable mobile browsers i'd use viewport meta tag force small mobile browsers display 768px 979px layout. to can use: <meta name="viewport" content="width=768px; /> the problem over-rides 980px 1024px @media queries designed ipad landscape, , forces ipad landscape display smaller layout designed ipad portrait, i.e. 768px 979px layout. the answer prayers if set viewport meta tag come effect @ 768px , below - possible? boom! fixed! right, miserable waste of 6 hours it's done , working now, hope helps someone! first of all, included pretty standard viewport meta tag in functions.php file: <meta name=...

javascript - Inserting rows into table which rows are sorted by some value attribute -

i have simple html table , want insert new rows table jquery. each row has custom val attribute unix timestamp inside, example: <tr data-val="1356998400"><!-- row content --></tr> i want insert new rows jquery, , want them sorted val attribute after insertion. the obviuos solution set id -s rows , manually scan rows array (performing time values comparison) before every single insertion find correct place insert, may there more jquery-like solution? guess kind of one-line solution should exist case. initially, sort table basic sort function (if rows haven't been sorted already): markup (note: added custom val attribute data attribute) <table> <tbody> <tr data-val="1"><td>1st</td></tr> <tr data-val="4"><td>3rd</td></tr> <tr data-val="7"><td>4th</td></tr> <tr data-val="2"><td...

php - How can I post data through a form with ajax and get it working? -

this question has answer here: jquery ajax submit form 14 answers i have piece of ajax script trying post form me. without ajax form post , send data. want ajax post not refresh page , posts data too. there multiple forms on 1 page. my js script looks this: function post_form(action) { var token = $('.forms').attr('id'); var itemid = $('.forms').find('input.id').val(); var instaurl = 'https://api.instagram.com/v1/media/'+itemid+'/likes?access_token='+token+''; console.log(token); console.log(itemid); console.log(instaurl); var datastring = token; $.ajax({ type: "post", url: instaurl, data: datastring, crossdomain: true, ...

.net - BackgroundWorker threading issue -

i'm getting infamous "cross-thread operation not valid" exception when trying implement simple backgroundworker. i've spent hours reading can find on subject, including many related questions on so, i'm not getting it. i have simple winform has dowork() method: it takes delegate representing work done. it creates backgroundworker , assigns delegate dowork event. it calls runworkerasync() . the function invoked runworkercompleted() tries update label on form, throws cross-thread exception. public class myform public sub dowork(worktodo doworkeventhandler) dim worker new backgroundworker() worker.workerreportsprogress = true worker.workersupportscancellation = true addhandler worker.dowork, worktodo addhandler worker.runworkercompleted, addressof workercompleted worker.runworkerasync() end sub private sub workercompleted(byval sender object, byval e runworkercompletedeventargs) ...

How can we modify almost any algorithm to have a good best-case running time? -

this question introduction algorithms cormen. isn't homework problem instead self-study. i have thought lot , searched on google. answer can think of are:- use algorithm. give best-case inputs use better computer run algorithm but don't think these correct. changing algorithm isn't same making algorithm have better performance. using better computer may increase speed algorithm isn't better. question in beginning of book think simple overlooking. so how can modify algorithm have best-case running time? you can modify algorithm have best case time complexity of o(n) adding special case, if input matches special case - return cached hard coded answer (or other obtained answer). for example, sort, can make best case o(n) checking if array sorted - , if is, return is. note not impact average or worst cases (assuming not better o(n) ), , improve algorithm's best case time complexity. note: if size of input bounded, same optimization mak...

php - How to get only the first result from getElementsByTagName? -

this question has answer here: php domdocument, require first item only 2 answers hi there using code adress of images url adress. want ask how can first result not matches? here code using: <?php $url="http://grabo.bg/relaks-v-pamporovo-0gk5b"; $html = file_get_contents($url); $doc = new domdocument(); @$doc->loadhtml($html); $tags = $doc->getelementsbytagname('img'); foreach ($tags $tag) { echo $tag->getattribute('src'); } ?> so please tell me how can 1 result - first! thanks in advance. $tags domnodelist object created domdocument 's getelementsbytagname method. can access first element returned domnodelist::item ( int $index ) . for code do: $tags->item(0);

asp.net - Identity column increment jump -

this question has answer here: identity increment jumping in sql server database 6 answers i experiencing funny in database. primary key increases like: 1 2 3 4 5 6 7 8 1001 i'm using entityframework or linq sql. it happens when sql server 2012 loses pre-allocated sequence numbers. if want rid of that, 1 option use traceflag: dbcc traceon (272) another option use sequence (with no caching) instead of identity: create sequence myseq int start 1 increment 1 no cache; see this: http://www.big.info/2013/01/how-to-solve-sql-server-2012-identity.html

Parsing an XML and binding it to a dialog in an Eclipse plugin -

i trying write eclipse plug-in dialog parses xml file , displays fields using dialog. dialog should show values populated in xml file might - <customer> <name>erwin schrodinger</name> <address>vienna,austria</address> <profession>physicist</profession> </customer> also, need allow user edit these values , write updated values xml file. i trying achieve using java. current approach use dom/sax parser parse fields in xml file , display on jface dialog. not have experience in java, , looking advice on topic. nice approach or there better way it? rather building solution scratch, may want take @ frameworks makes easier. instance, sapphire, provides xml binding , rendering of forms backed xml. http://www.eclipse.org/sapphire/ http://www.eclipse.org/sapphire/documentation/latest/introduction/index.html http://www.eclipse.org/forums/index.php?t=thread&frm_id=192

objective c - Drawing a 3D Cube and rotate it -

i want draw 3d cube , rotate it. found here project ( where start opengl es create , rotate cube in iphone? ) there 4 errors: /users/zyage/library/developer/xcode/deriveddata/cubeexample- cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 4: /developer/platforms/iphoneos.platform/developer/usr/bin/texturetool: no such file or directory /users/zyage/library/developer/xcode/deriveddata/cubeexample-cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 5: /developer/platforms/iphoneos.platform/developer/usr/bin/texturetool: no such file or directory /users/zyage/library/developer/xcode/deriveddata/cubeexample-cpuqdsorzrsxfcckeaidfhlprjed/build/intermediates/cubeexample.build/debug-iphonesimulator/cubeexample.build/script-bc9587f7117f8cf400bbb1c8.sh: line 7: /developer/platforms...

Mysql join columns from multiple tables -

i have 1 main table , 2 tables hold multiple dinamyc information first table. the first table called 'items' holds main information. there 2 tables (ratings , indexes) holds information values dinamyc count of auditories , time period. what want: when query items, want result have additional column names ratings , indexes tables. i have code this select items.*, ratings.val rating, indexes.val idx items,ratings,indexes items.date>=1349902800000 , items.date <=1349989199000 , ratings.period_start <= items.date , ratings.period_end > items.date , ratings.auditory = 'kids' , indexes.period_start <= items.date , indexes.period_end > items.date , indexes.auditory = 'kids' order indexes.added, ratings.added desc the tables this items: `id` int(11) not null auto_increment, `name` varchar(200) default null, `date` bigint(40) default null primary key (`id`) ratings: `id` bigint(50) not null auto_increment, `period_start` bigi...

python - Pass Variable to Django Admin Form -

i have add form calibrationcertificates in django admin site. if link non-admin template, instrument_detail.html, possible pass context information default value add form. that is, choice in add form instrument certificate for. link associated instrument, there way pass value, such add certificate form default instrument user came from? my modeladmin follows: class certificateadmin(admin.modeladmin): exclude = ('issued_by', 'expires',) def save_model(self, request, obj, form, change): obj.issued_by = request.user obj.expires= datetime.date.today() + datetime.timedelta(days=obj.instrument.kind.duration) obj.save() not sure if understand question correctly think want: def add_view(self, request, form_url='', extra_context=none): extra_context = extra_context or {} extra_context['my_extra_content'] = self.something return super(mymodeladmin, self).add_view(request, form_url, extra_con...

android image layout size -

Image
from above image,how can remove white space surrounding image imageview layout is <imageview android:id="@+id/list_image" android:layout_width="@android:dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size" android:layout_gravity="center_vertical" android:scaletype="fitcenter"/> add image android:adjustviewbounds=true if still not working, change layout size wrap_content

functional programming - Transforming functions of type `a -> b` into those of type `String -> String` in Haskell -

my intention simple. want wrap functions of type a -> b string -> string (so bunch of heterogeneous functions can put in list). write: wrap :: (read a, show b) => (a -> b) -> (string -> string) wrap f = \s -> show $ f (read s :: a) however, ghc complaints: could not deduce (read a1) arising use of `read' context (read a, show b) bound type signature wrap :: (read a, show b) => (a -> b) -> string -> string i want know why piece of code won't work , kind of hacks needed achieve goal? thanks. your code won't work because haskell doesn't re-use or scope type variables; a in wrap :: (read a, show b) => (a -> b) -> (string -> string) different a 1 in read s :: a (and they're both universally quantified). source of a1 in error message; ghc alpha-converting program to wrap :: (read a, show b) => (a -> b) -> (string -> string) wrap f = \s -> show $ f (read s :: a1) ...

I'm getting 403 error using passenger for rails in apache -

i've installed needed tools, , followed several tutorials trying make passenger respond. i can access static files in public folder (public/500.html or 422.hml). yesterday entered through vhost, , found passenger errors. time later hosting restarted service, , since have not been able access rails app again. link link link these of links used configure server. i've read permission issue; i've checked that, i'm not sure it's fine. first of check error log. default, placed @ /var/log/apache2/ . if have client denied server configuration issue, check site conf file @ /etc/apache2/sites-available/your-site.conf . must in compliance phusion passenger user guide . take on require granted . <directory "/home/user/folder"> require granted options followsymlinks # relaxes apache security settings. allowoverride none # multiviews must turned off. order allow,deny allow </directory>

javascript - What is the best way to disallow a click to highlight a DIV? -

Image
i have 2 "buttons" made of div utf-8 arrow character in them. when user clicks on them, highlight. what best way suppress highlighting works in browers not affect click? here's markup: <div class="arrowcontainer"><div class="arrowleft">...</div></div> .arrowcontainer .arrowleft { background-color:#e0e0e0; width:15px; padding: 1px 0 0 0; height: 19px; text-align: center; float:left; margin: 0 2px 0 0; font-size: 9pt; cursor: pointer; } seems selected (like when select text), try disabling selection option: *.notselectable{ -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; /* ie 10. */ -ms-user-select: none; user-select: none; }

pdf generation - Create PDF Document in VBA -

using vba outside of ms-office suite of applications, there way create pdf document, or light-weight document can converted pdf? i have data within classes, want pdf, how do quickly, without resorting opening ms word, ms excel, etc? this link seems might helpful solving issue. http://forums.adobe.com/thread/840511 according information there can print adobe pdf virtual printer , generate file. people on forum doing emailing file afterwards , generating file access data, looks solution work vba project.

html - Header CSS breaking -

i'm pretty terrible @ css/design i'm struggling css here. the page looks fine when loaded in full screen browser @ 1920x1080, however, minimise or load page on mobile device header content loses placing body fine. here's css elements in question: #header { background: url(assets/header_bckg.gif) repeat-x ; height:120px; } #logo { display:inline-block; float:mid-left; padding:50px 0 0 570px; } #logo { color:#ffffff; text-decoration:none; font-weight:bold; height:12px; font-size:20px; text-transform:uppercase;} #login { display:inline-block; float:mid-right; padding-left:400px; padding-bottom: 7px; vertical-align:middle;} #login{ color:#ffffff; text-decoration:none; font-weight:bold; height:12px; font-size:12px; text-transform:uppercase;} #avatar { display:inline-block; position:absolute; margin-top:28px; float:mid-right; padding-left: 505px; padding-bottom: 15px; vertical-align:middle; } #avatar_online { background: linear-gradient(to bottom, #7bafd6 5...

c++ - Application boost::thread stuck on mutex lock when compiled for ARM running on BeagleBone Black -

i working on c++ app runs on pc fine , want make work on beaglebone black on have installed debian wheezy. i'm cross compiling using eldk v5.3 , qmake pc (intel celeron, debian wheezy, boost v1.49.0-3.2) beaglebone black (arm cortex a8, debian wheezy, boost v1.49.0-3.2). everything works should, every , then, app freezes (is stuck on __pthread_mutex_lock) when boost::thread created or app waiting boost::thread::join(). want understand what's going on. if have tips can me secure these calls boost::thread (try/catch, error status check ...) please share them :) thank !! here small source code freezes in similar fashion when executed on beaglebone black followed backtrace printed when app freezes (gdb) , .pro file used when executing qmake command : #include <stdio.h> #include <boost/thread.hpp> #define nb_threads 20 #define thread_life_duration 5 int g_nb_thread = 0; boost::thread * subregisterthread(boost::thread * pthread) { pr...

Get data-attribute jquery vs javascript -

i have custom data-attribute set default: data-equipment="0" if change jquery using .data() $(this).data("equipment", 10) and use getattribute() this.getattribute("data-equipment") i old value (0) , not new 1 (10). if use $(this).data("equipment") new value (10). is supposed work or missing something? thanks! .data() doesn't operate on data attributes in internal jquery cache. if no cache record found, data read corresponding data- attribute if 1 exists, end of co-operation. if operated on attributes, useless purpose because attribute values must strings.

sql - How to run procedure every week till end date in oracle -

i have procedure need execute every week date of deployment in production.it should run on day of deployment , subsequent weeks till end date stored in variable. i need incorporate @ procedure level rather creating separate scheduler or dbms_job suppose start date 11/1/2013 (day of deployment) , end date 04/30/2014 need run procedure every week once between period including start date. suppose proc run on 04/28/2014 , next week falls in may, till 4/30/2014 should run each day. help appreciated. begin in (select typename ....)-- give 3 output loop if typename = 'abc' -- run update every week start date end update test set test.a = ...., test.b = .... test.c in (....) elsif typename = 'pqr'then update test1 set test.a1 = ..., test.b1 = ..., test1.c in (....) ...

jquery - Accessing form values using javascript in Ruby on Rails -

let's have input box, on client-side, want access value of input box , check if exists record in model. if so, want data shown. however, want done without clicking submit button/reloading page. can show me sample code? sample code frowned upon in these parts, can give outline of do. use jquery value of input box, , submit using ajax request url. map url controller action checks see if record exists in db, , return json indicates whether or not. in javascript, when data returned, can display user.

windows - Tar and --newer / --after-date parameter -

my project structure following: -sprint41 -file1 -file2 -sprint40 -file1 -file2 all files(+ sprint41) in sprint41 folder have modified date 20130807 all files(+ sprint40) in sprint40 folder have modified date 20130610 i want create archive including files(+folder) after 20130715. command following: tar -cf test.tar --after-date 20130715 * after command, test.tar contains following: -sprint41 -file1 -file2 -sprint40 it keeping sprint40 folder though modified date before 20130715 i expecting have following: -sprint41 -file1 -file2 do have clue ? many thanks yeah, problem tar still include directories if empty. it's checking --newer option on files, not directories. going have either write small script or use find -cnewer , pipe output tar (with --no-recursion on tar command). create file timestamp want with touch -t 201307150000 timefile.txt then somthing like: find . -cnewer timefile.txt -print0 | xargs -0 tar --no-recursion -...

PHP/PDO/MySQL if statement in BETWEEN clause -

i'm trying return records records store within date range. however, if store opened after date, want use open date. possible this? i'm using php pdo , mysql: select store_name, daily_sales mytable date between (if(open_date > :start_date, open_date, :start_date) , :end_date so can this: select store_name, daily_sales mytable date between (select if(open_date > :start_date, open_date, :start_date)) , :end_date

Play definite frequency sound in visual c++ -

how convert sound() in turbo c++ visual c++ 2005? want play definite frequency sound through system speaker ? you might looking beep function

java - Can you record two MediaRecorder video streams at once? -

we looking @ writing android app , need create 2 copies of video record. each 1 require different settings (dimensions, etc). 1 'high quality' version (1280x720, high bitrate) , 1 'low quality' version (480x360, lower bitrate). both mp4 files. we have found using mediarecorder record higher quality version , using ffmpeg convert video afterwards lower quality version excruciatingly slow. getting speeds of 6 minutes 22 second video converted! so possible have 2 instances of mediarecorder @ once stream captured , encoded file on-the-fly, saving need encode after it's completed? alternatively there other suggestions how can achieve this, or maximise ffmpeg's performance?

directory - How to read this line in MATLAB? -

i came across following lines in matlab : m = dir(fullfile(dataset,'*.png')); m = {m(~[m.isdir]).name}; i understand first line trying obtain .png files directory. but, second line trying perform? isdir seems determine input directory. that's new part. but, line trying perform? thanks. the second line getting files not directory , getting respective names , storing them cell array m.isdir indicates if folder or not returns 1 if is, 0 if not. ~[m.isdir] indicate of values returned isdir 0. m(~[m.isdir]) grabs objects in m determined logical indexing done above m(~[m.isdir]).name gets names of of them {m(~[m.isdir]).name} stores them in cell array hopefully step step walkthrough helps. while not sure why second line necessary because fullfile(dataset,'*.png') should return paths end in .png , not folder, guess check.

Custom jQuery slider image calculation -

i using code jquery image slider found work custom post type in wordpress(pods). slider working perfectly, need limit number of times user can scroll next image based on how many images there are. <script type="text/javascript"> $(function() { $("img.enlarge").live('click', function (e) { e.preventdefault(); var src = this.src; $("#fullimage").attr("src", src); }); }); $(document).ready(function() { $('img').filter(function(index){return $(this).attr('src')==='';}).removeclass('enlarge'); $('img').filter(function(index){return $(this).attr('src')==='';}).hide(); var $item = $('img.enlarge'), //cache dom selector visible = 1, //set number of items visible index = 0, //starting index endindex = ( $item.length / visible ) ; //end index (note:: requires visible factor of $item.length... can improve rounding...) $('div#arrowr'...

windows 7 - Removing bad installs from Add/Remove programs -

i've created custom boot-strapper application using wix , burn, in time took learn managed install several variants in such way won't uninstall. think created problem running engine.apply before plancomplete had been called. where information builds list in add/remove programs , best way manually remove orphaned rows? update - should have said i'm on 64 bit windows 7 enterprise, service pack 1. hkey_local_machine\software\microsoft\windows\currentversion\uninstall or hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\uninst‌​all - location add remove programs gets populated. if remove entry registry take out entry. can delete key here described below , physically locate , delete files/folders. in registry editor, locate registry keys mentioned above. each key listed under uninstall in left pane of registry editor represents program displayed in installed programs list of add or remove programs tool.to determine program each key ...

flash - In ActionScript, is it possible to call a function on a Class that applies to all instances of that class? -

so - have bunch of instances of class , there's function want call on of them. i'm wondering if rather loop through every instance have, there way can declare function on class when called runs on each instance? example - if class looks this: public class myclass{ public var variable:string = ""; public function myclass(){} public function myfunction():void{ this.variable = "blore"; } } and have bunch of these: var class1:myclass = new myclass(); var class2:myclass = new myclass(); is there way can call myclass.myfunction() , have called on of instances? i don't know if i'm explaining well...but there is. i'd love suggestions have don't involve "put instances in array or vector , loop through them real man." here's quick example of how accomplish this: package { public class example { public static var instances:array; public function example() { ...

virtualenv - Distributing a python package along with module dependencies using RPM -

i've got several python applications consisting of scripts/modules should packaged , deployed rpms. the trickier bit each application should distributed along python module dependencies, , these should used in preference installed system wide. the target hosts of these rpms have limited network access, rpms should contain needed run app, rather downloading @ deploy time. i've looked @ packaging , distributing virtualenv , relocating virtualenv doesn't seem supported. i've looked @ zc.buildout , found documentation lacking. see how download dependencies during development, not how distribute them part of larger application. it's possible different apps require different versions of same module, these shouldn't installed system wide. another pain point python scripts in app need modified use different sys.path during development , after deployment, couldn't see obvious way around this. are suggestions on how best achieve this? ideal summary of ...

Hash and function parameters in ruby -

i'd write : class test def initialize(a,b,c) end def print() puts @a puts @b puts @c end end test.new({a=>1, b=>2, c=>3}).print() =>1 =>2 =>3 is there way instanciate object , map parameters hash table? thanks in advance. class test def initialize(options) options.each |key, value| instance_variable_set("@#{key}", value) end end def print puts @a puts @b puts @c end end test.new(:a => 1, :b => 2, :c => 3).print or use openstruct : http://www.ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/openstruct.html here's simple example: require 'ostruct' puts openstruct.new(:a => 1, :b => 2, :c => 3).inspect # outputs: "#<openstruct a=1, b=2, c=3>"

asp.net mvc - How to limit the amount of data from an OData request? -

i have users table of 76 users , usergroups table. using mvc, odata, generic repository , ef, trying optimize data retrieval when filtering based on user group: /api/users?$filter=usergroups/any(usergroup: usergroup/id eq 'group1') on client side, right number of users - 71 (as odata filtering based on result), want limit number of records being returned form actual query - ie. not want return records filter (not optimal large data sets). my api controller method follows: [queryable(allowedqueryoptions = allowedqueryoptions.all)] public iqueryable<user> get() { var unitofwork = new atms.repository.unitofwork(_dbcontext); var users = unitofwork.repository<user>() .query() .include(u => u.usergroups) .get() .orderby(order => order.username); unitofwork.save(); // includes dispose() ...