Posts

Showing posts from September, 2011

Javascript: calculating remaining time (and then rent) on a tenancy (Rent Calculator) -

i work @ corporate estate agency , i'm creating internal page staff use contain few small tools them use among other things. one of things i've been trying put rent calculator, which, given rental amount , lease expiry date user, needs determine time left (from today) on lease , advise how rent left pay on lease. i've got working, mostly, can see it's long (i'm assuming extent has be) , feel reasonably messy: //calculates remaining rent left pay terminated leases $("input[name='calcrent']").click(function() { //gets rent , daily rent later calculations var rent = $("input[name='rentrent']").val(); var dailyrate = (rent * 12) / 365; var leaseexpiry = $("input[name='leaseexpiry']").val(); var remrent = $("input[name='remrent']"); //breaks down lease expiry date , today's date day, month, year parts //so units can used in calculations var ldd = leaseexp

ios - uitableview inside multiple view controllers -

i have 'repeat' uitableview 2 or more view controllers. using uitableviewcontroller methods inside view controllers using methods/delegates/datasources uitablewviewcontroller. example: i've uitableviewcontroller wich displays twitter feed own style, need table in more 1 view controller , maybe changing twitteruser in each view controller (just example). try: i've done create (with storyboard) uiviewcontroller , uitablewviewcontroller, both own methods. , on uiviewcontroller viewdidload, try add uitablewviewcontroller.tableview subclass. , works! result empty table. tried set delegates/datasources ddnt work.. -(void)viewdidload { [super viewdidload]; //add table subview thetable *t = [[thetable alloc] init]; [self.view addsubview:t.tableview]; t.tableview.frame = cgrectmake(0, 100, 320, 2000); t.tableview.backgroundcolor = [uicolor bluecolor]; } this code works, displays empty uitable inside view controller.. *thetable uitableviewc

wordpress - Is it possible to deep link to Buddypress pages via login? -

i have wordpress installation on i'm using buddypress plugin. using plugin send daily digest e-mails users offer them links forums have had new posts. the problem if user follows 1 of these links when they're not logged in, they're taken 404 'page not found' page. is there way redirect them login page redirects them desired location after logging in? thanks! just take control of 404.php page theme's file. implement in theme's 404.php page redirect specific users page: if( http-referer == 'you-know-how-to-detect-buddypress-users' ) $redirect_to= 'http://example.com/'; //redirect_to main part here. details on parameter, see here: http: wp_redirect($redirect_to); exit(); /* rest of file 404.php, remain unchanged */ ref: http://codex.wordpress.org/function_reference/wp_redirect

Numerical integration in C++ -

hello need integrate function (of 2 variables). know can using fubini theorem integrate 1 variable functions using numerical methods such rectangle method or trapezoidal rule . but there pre-built functions in c++ ? need integrate on the unit r2 triangle ((0,0), (1,0), (0,1)) . you can use gnu scientific library , supports many "numerical analysis" functions including integration. a simple example of integration manual few lines of code: #include <stdio.h> #include <math.h> #include <gsl/gsl_integration.h> double f (double x, void * params) { double alpha = *(double *) params; return log(alpha*x) / sqrt(x); } int main (void) { double result, error; double expected = -4.0; double alpha = 1.0; gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000); gsl_function f; f.function = &f; f.params = &alpha; gsl_integration_qags (&f, 0, 1, 0, 1e-7, 1000, w, &res

Realtime android Google analytics without EasyTracker -

i'm trying figure out how track page views in real time without using easytracker singleton. i have following code: /** * how create tracker instance... */ private void createtracker() { if (tracker != null) return; tracker = googleanalytics.gettracker(googleanalyticssiteid); tracker.setanonymizeip(trackinglevel.isanonymous()); tracker.setappinstallerid(configuration.getinstallationuuid()); tracker.setsamplerate(dispatchintervalinseconds); trackupgradedapp(); } ... void someothermethod(activity activity){ tracker.sendview((string) activity.gettitle()); // easytracker.getinstance().activitystart(cyborgscreen.getactivity()); } while uncomment easytracker line, can track pages visited in realtime, after adding analytics.xml project (obviously). once commenting line, not receive realtime information... if following code here , should have done trick. am missing obvious, or there bug? thanks, adam. well, after tones of p

database - MySQL Workbench for SQL Server? -

Image
i use mysql workbench making er diagrams. now, have make diagram sql server. workbench have sql server export feature? if not, there free er diagram software should take at? edit 1: (screen shot) hake @ database diagram tool sql server in dbforge studio sql server. view , modify existing database online. you can try feature in free express or trial version.

sublimetext2 - Switch current tag to another -

i have tag like <p>this pa|ragraph</p> i want press button , change p tag. how can that? install emmet(previously zencoding) plugin. has shortcut super + shift + k (for mac, other oses, should ctrl instead of super) this. { "keys": [ "super+shift+k" ], "command": "rename_tag", "context": [ { "key": "emmet_action_enabled.rename_tag" } ] }, just highlight tag, press combo , both opening , closing tags selected simultaneously. can type new tag.

com - How do I instantiate CorRuntimeHost from mscoree.tlb in PowerShell? -

i want enumerate appdomains in current process powershell. process happens visual studio, hosting studioshell . need instantiate corruntimhost, part of mscoree.tlb, can adapt this c# code .. i tried proper name of corruntimehost , pass new-object -comobject "objectname" . based on this forum posting , searched registry , think correct name clrmetadata.corruntimehost . however, while new-object -comobject 'clrmetadata.corruntimehost' -strict return object, exposes methods intrinsic com object. based on this stackoverflow question tried [activator]::createinstance() . however, following 2 statements give me same problem new-object, namely can't call icorruntimehost::enumdomains() method. $corruntimehost = [activator]::createinstance([type]::gettypefromprogid('clrmetadata.corruntimehost')); $enumerator = $null; $corruntimehost.enumdomains([ref]$enumerator); method invocation failed because [system.__comobject] doesn't contain method named &

visual studio 2010 - Unresolved external between several projects in VS2010 C++ -

i have 2 c++ projects each form library referenced third project part of visual studio solution. the 2 libraries written else provided own vs solution included project acts demo of library functions. have gotten these compile , run. trying develop windows application using windows forms make use of libraries. upon including 2 necessary headers, #include "corelib.h" #include "corbit.h" and trying build code, receive 2 link errors: sattrack_v0.1.obj : error lnk2028: unresolved token (0a000010) "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __clrcall zeptomoby::orbittools::cgeo::tostring(void)const " (?tostring@cgeo@orbittools@zeptomoby@@$$fubm?av?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@xz) referenced in function "void __clrcall `dynamic initializer 'const zeptomoby::orbittools::cgeo::`vftable'''(void)" (???__e??_7cgeo@orbittoo

updateMyvCardTemp in xmppframework -

i try update myvcard,but receive error message , 《error code="400" type="modify"》 《bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/》《/error》 my code : xmppvcardtemp *mycard=[self.appdel.xmpphelper getmyvcard]; nslog(@"nickname:%@",mycard.nickname); nslog(@"name:%@",mycard.name); nslog(@"location:%@",mycard.location); nslog(@"jid:%@",mycard.jid); nslog(@"title:%@",mycard.title); mycard.title=@"lkasjdfl"; mycard.nickname=@"jdjdjdjd"; mycard.jid=[xmppjid jidwithstring:@"test@im.xujialiang.net"]; [self.appdel.xmpphelper updatevcard:mycard];

media player - How to set MediaContollerto MediaPlayer in android? -

how set mediacontoller mediaplayer in android , want show permanently ? you can extend mediacontroller class , programmatically set instance of videoview class. here's example showing how: https://stackoverflow.com/a/8409863/1369222

Fetching Data from XML using jQuery -

currently trying fetch data xml selectbox. xml output ; <1> <book_able>0</book_able> <code>af</code> <name>afghanistan</name> </1> <2> <book_able>1</book_able> <code>al</code> <name>albanie</name> </2> <3> <book_able>1</book_able> <code>dz</code> <name>algerie</name> </3> <6> <book_able>1</book_able> <code>as</code> <name>samoa americaines</name> </6> <8> <book_able>1</book_able> <code>ad</code> <name>andorre</name> </8> <9> <book_able>1</book_able> <code>ao</code> <name>angola</name> </9> <11> <book_able>1</book_able> <code>ai</code> <name>anguilla</name> </11> he

iis 7.5 - Regex URL rewriting for custom login page -

i'm implementing custom login page multitenant portal each client gets different login page styled according stored settings. achieve using iis 7.5 url rewriting module. idea capture requests " http://portal.com/client1/ " , rewrite them " http://portal.com/login.aspx?client=client1 ". what i'm struggling regex expression match url , extract "client1" bit out. examples: " http://portal.com/pepsi " = " http://portal.com/login.aspx?client=pepsi " " http://portal.com/fedex " = " http://portal.com/login.aspx?client=fedex " " http://portal.com/northwind " = " http://portal.com/login.aspx?client=northwind " " http://portal.com/microsoft/ " = " http://portal.com/login.aspx?client=microsoft " so match should found if requested url contains single word after first "/" , work whether there trailing "/" or not. "http://por

php - How to get value of a custom Attribute in magento through SOAP API -

i trying value of custom attribute of magento products through soap api. able standard attribute values. trying code below doesnt seem work. $user = 'user'; $password = 'pass'; $proxy = new soapclient('http://asd.com.au/api/v2_soap?wsdl'); $sessionid = $proxy->login($user, $password); //method 1 tried $ebaystock = new stdclass(); $ebaystock->key = 'ebay_available_qty'; $additionalattributes['single_data'][] = $ebaystock ; $ebay = $proxy->catalogproductinfo($sessionid, $sku,1,$additionalattributes); var_dump($ebay); //output object(stdclass)[4] public 'product_id' => string '3230' (length=4) public 'sku' => string 'test101' (length=7) public 'set' => string '9' (length=1) public 'type' => string 'simple' (length=6) public 'categories' => array (size=0) empty public 'websites' =>

Convert a matrix to a list of vectors in R -

what elegant way of converting matrix list, each element of list vector containing elements in row of matrix? a couple of approaches assuming matrix called foo lapply(seq_len(nrow(foo)), function(x) foo[x,]) or less efficiently. lapply(apply(foo,1,list), unlist)

php - Paginate issue with count in a query with group by -

ok use pagination code counts total pages, this $query = "select count(*) num $tablename `ganador2` = '1'"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; then call data query echo page contents. // page data $query1 = "select id,name,lastname,email,codigo, media, phone, pcode, birth $tablename `ganador2` = '1' limit $start, $limit "; this last part working code, ok, know im trying use querys, count how many times user has entered email. $query = "select count(*) num,id,name,lastname,email,codigo, media, phone, pcode, birth usuarios group email"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; and // page data $query1 = "select count(*) top,id,name,lastname,email,codigo, media, phone, pcode, birth usuarios group email order top desc limit $start, $limit"; the problem pagination, telling me query found (

jquery - 400 bad request while calling web service -

i'm getting bad request server while calling web service using jquery ajax post. code looks :- $("#dailyentryupdate").click(function(){ event.preventdefault(); var values = $("#dailyentryform").serialize(); var id = billingobject[localstorage.index].billingid; var parameters = values+"&id=" + encodeuricomponent(id); console.log(" values "+ parameters); $.ajax({ url: "http://localhost:8080/tims/rest/updateentry/update", type: "post", data: parameters, success: function(){ alert("record updated successfully"); }, error:function(){ alert("failure"); } }); }); and server side looks this @xmlrootelement @path("/updateentry") public class updateentryservice{ @post @path("/update") @consumes("application/x-www-form-urlen

c# - AjaxFileUpload inside a Panel not working -

hello i'm having trouble getting ajaxfileupload control work properly. have working on different page, using identical code, not inside of panel on page. functions , allows me select files , hits 'onuploadcomplete' function, crashing on .saveas giving me nullreferenceexception. put ghostupload control @ start of page @ recommendation after finding others similar problems , necessary or control doesn't work @ all. aspx code (outside panel) <div style="display:none"> <ajaxcontroltoolkit:ajaxfileupload id="ghostajaxfileupload" runat="server" onuploadcomplete="ajaxfileupload_uploadcomplete" /></div> aspx code (inside panel) <ajaxcontroltoolkit:ajaxfileupload id="ajaxupload1" runat="server" throbberid="loader123" allowedfiletypes="jpg,jpeg" maximumnumberoffiles="2" onuploadcomplete="ajaxfileupload_uploadcomplete" /><asp:image id=&q

bash - shell script sum in for loop not working -

size=`ls -l /var/temp.* | awk '{ print $5}'` fin_size=0 row in ${size} ; fin_size=`echo $(( $row + $fin_size )) | bc`; done echo $fin_size is not working !! echo $fin_size throwing garbage minus value. i'm mistaking? (my bash old , suppose work in linux kernel: 2.6.39) below should enough: ls -l /var/temp.* | awk '{a+=$5}end{print a}' no need run loop.this means: size=ls -l /var/temp.* | awk '{ print $5}'` fin_size=0 row in ${size} ; fin_size=`echo $(( $row + $fin_size )) | bc`; done echo $fin_size the whole above thing can replaced : fin_size=`ls -l /var/temp.* | awk '{a+=$5}end{printf("%10d",a);}'` echo $fin_size

java - Is the unbounded wildcard type used only to create references? -

i have seen lot of cases in, ? type used create references. , not able add objects other null. so, use of '?', create references? also, need / use of giving option add null? have implemented no add() method @ all, right? reason giving option of adding null list < ? > ? list generic interface , , same interface regardless of generic type. such, implementors required redefine methods in it. far being able add null "unbounded" list, it's not matter of methods as requisiste of respecting interface: the unbound generic wildcard allows reference list (or other generic class) passed around methods without requiring compile-time knowledge of specific type contain. however, contract of generic must still respected. poses no big problem read operations, since whatever in list, (also) java.lang.object . on other hand, insert operations impossible, since lacking informations accepted types, no type can accepted - e.g. list can accept strings, object

node.js - express app correct way to connect to mongo db? -

i have following directory layout contains node.js / express application: server.coffee server.js src ├── config │   └── index.coffee ├── controllers │   ├── index.coffee │   └── user.coffee ├── index.coffee ├── models │   └── user │   └── user.coffee ├── routes.coffee └── utils ├── dbconnect.coffee views ├── 404.blade ├── 500.blade ├── index.blade └── user ├── create.blade the /src/config/index.coffee has details of mongo url export db_url #### config file # sets application config parameters depending on `env` name logger = require "../utils/logger" logcategory = "server config" db_host = "localhost" db_port = "27017" db_name = "zmgc" db_url = null db_user = null db_pass = null # connecting dexies database on mongodb boundservices = if process.env.vcap_services json.parse(process.env.vcap_services) else null unless boundservices if db_user , db_pass db_url = "mongodb://#{db_user}:#{db_pass}@#

Python Runtime level error, -

i'm working through online tutorial alone , have no idea i'm missing. can't edit code below anymore 2 characters. of i've tried more 2 character changes. i need print "hello" on 1 line , on line "joe" this code given; print("hello") username = joe print(username) i've tried swopping second line around. i've tried removing second line altogether. i've tried syntax changes no avail. error: traceback (most recent call last): in line 2 of code submitted: username = joe nameerror: name 'joe' not defined can please guide me in right direction? thanks in advance use quotes around joe make string (similar "hello" ), otherwise python variable named joe , if not found nameerror raised: username = "joe" adding 2 quotes meets criteria of adding @ 2 characters.

css - Absolute positioning of elements produces an unwanted horizontal scrollbar on <html>, though no element exceeds the viewport -

i'm building web application occupies browser's visible area without scrollbars. window divided panes have own scrollbars when necessary. i've laid out elements neatly absolute positioning. demo: http://jsbin.com/adozul/6/edit extract: <body> <header id="header"></header> <div id="main"> <section class="pane"></section> <section class="pane"></section> <section class="pane"></section> <section class="pane"></section> </div> </body> #header, #main, .pane { bottom: 0; left: 0; position: absolute; right: 0; top: 0; } #header { bottom: none; height: 35px; } #main { top: 36px; } .pane:nth-child(1) { left: 0; right: 75%; } .pane:nth-child(2) { left: 25%; right: 50%; } .pane:nth-child(3) { left: 50%; right: 25%; } .pane:nth-child(4) {

metaprogramming - Ruby Object Model clarification -

in ruby, can write, dog = class.new so here, dog object instance of class . also, can write fido = dog.new which possible if dog class . is dog here class or object ? everything in ruby object (except blocks). , dog here class . dog = class.new fido = dog.new so answer is: both .

PHP GET or POST security -

good morning. i'm taking exam later today on web development. pretty confident of exam, looking on past paper came across question: b) developer decides use http get send user message message board system. explain potential security threats , discuss how overcome them. note should consider two situations: http must used. http changed. (15 marks) i know post , get , i'm not sure able discuss in enough detail achieve 15 marks. this attempt of me answering question, if suggestions can made in attempt direct me in correct direction, appreciated: get insecure, if message private message data sensitive , therefore should not used unless added security included. display user message in url allowing view this, looking on shoulder etc. post nature more secure, not show message in url , instead adds http header, secure if http protocol secure , encryption should considered sensitive data. if suggest written in response question, appreciated!

xpath - X-Path + RegEx matching pattern -

given following, <line> <supplier>fuel surcharge - 36</supplier> <supplier>fuel surcharge - 35</supplier> <supplier>46081 46150 46250 46280 46286</supplier> <supplier>fuel surcharge - 35451</supplier> <supplier>46081</supplier> </line> the idea here return "true" when node carries number of 5 digits iteration. this have done far, matches(./supplier, "[^(\d{5}\s*)+]"); the regex here extract value has 5 digits or without space regardless of iteration. the results getting true. means not right somewhere. can assist me this. thanks. there 2 problems expression: no semicolon in end of xpath expression (syntax error). your regex messed up, matches not contain out of character class parentheses, digits, curly brackets, digit 5, spaces, , star , plus character. fn:matches(xs:string?, xs:string) requires 2 strings parameters, you're passing sequen

`imagesc` in MATLAB: paper size and `colorbar` -

i using imagesc in matlab show nxm matrix image, warmer color higher value. using following command: f = imagesc(points, [0 1]); the matrix points displayed. nevertheless, legend showing coupling between colors , values missing. have found out command: colorbar can used display requested legend. however, when printing figure on pdf using following lines of code: set(gcf, 'paperunits', 'centimeters') set(gcf,'papersize',[12 8]) % set paper size figure size print('-dpdf',figurepath) i encounter 2 problems: the paper size not set properly the color bar not showing on pdf how can fix these problems? thanks in advance, eleanore. i've found solution in state of art, uses export_fig script ( https://sites.google.com/site/oliverwoodford/software/export_fig ). the following code needed: set(gcf, 'color', 'w'); % change background color set(gcf, 'position', [100 100 700 500

winapi - create toolbar with my bitmap images -

this example code of msdn create toolbar, example use standard images of system. need change in code use images resource file, example: idb_copy bitmap "copy.bmp" , , idb_cut bitmap "cut.bmp" , , idb_paste bitmap "paste.bmp" . himagelist g_himagelist = null; hwnd createsimpletoolbar(hwnd hwndparent) { // declare , initialize local constants. const int imagelistid = 0; const int numbuttons = 3; const int bitmapsize = 16; const dword buttonstyles = btns_autosize; // create toolbar. hwnd hwndtoolbar = createwindowex(0, toolbarclassname, null, ws_child | tbstyle_wrapable, 0, 0, 0, 0, hwndparent, null, g_hinst, null); if (hwndtoolbar == null) return null; // create image list. g_himagelist = imagelist_create(bitmapsize, bitmapsize, // dimensions of individual bitmaps. ilc_color16 | ilc_mas

jquery - Make pictures repeat using javascript -

i want create animation using javascript. the pictures should repeated (loop), problem when script reaches final picture there empty space. what want is: pic1 > pic2 > pic3 > pic4 > pic5 > pic1 > ... the code: <style type="text/css"> img { position: absolute; center: 0px; top: 0px; } #img3 { z-index: 3; } #img2 { z-index: 2; } #img1 { z-index: 1; } </style> <img style="top: 0px; height: 199px;" src="img1.jpg" id="img1"> <img img2.jpg" id="img2"><img src="img3.jpg" id="img3"> <script src="http://code.jquery.com/jquery.js"></script> <script> $(function() { $('img').first().fadeout(2000, function suivante() { $(this).next('img').fadeout(2000,suivante); }); }); </script> what found should use function bis() don't kn

$.extend with some condition in jquery -

how use $.extend condition? obj=[{..}, {..}, {....}]; this.model.axes=[{..}, {..}, {...}]; $.extend(true, this.model.axes, obj); obj array of json object , same this.model.axes . want extend or merge values obj model.axes skip first 2 indexes. means no need merge values this.model.axes[0] , this.model.axes[1] obj[0] , obj[1] . i want merge obj[0] this.model.axes[2] , obj[1] this.model.axes[3] that. how can skip first 2 json objects model.axes ? thanks, siva if want concatenate obj array this.model.axes without first 2 elements of this.model.axes , following you: this.model.axes = this.model.axes.slice(2).concat(obj); ( demo ) if want replace values of this.model.axes values of obj starting @ third element of this.model.axes , use following: this.model.axes = this.model.axes.slice(0, 2).concat(obj); ( demo ) finally, if want extend objects in arrays beginning third element of this.model.axes , continuing until last element of obj ,

how can I find an available COM port in FreeBASIC? -

i'm working on graphical com port monitor in freebasic, feel kinda wrong re-compiling every time change computer or adapter. there way scan available com port in freebasic? you can list of ports available using win32 api function enumports or can check registry branch hkey_local_machine\hardware\devicemap\serialcomm . the following 2 code snippets illustrate 2 ways mentioned above: freebasic example enumports freebasic example port listing via registry unfortunately, code snippet pages in german given source codes, of course, work on non german systems, too. ;-)

python - Python3 can not find module xmlrpc from unittests -

i working on python project 2 other people, can't run our tests. when run tests using python3 -m unittest output traceback (most recent call last): traceback (most recent call last): file "peer.py", line 1, in <module> file "peer.py", line 1, in <module> xmlrpc.client import serverproxy xmlrpc.client import serverproxy importerror: no module named xmlrpc.client importerror: no module named xmlrpc.client line 1 in peer.py is from xmlrpc.client import serverproxy the strange thing when run peer.py independently ( python3 peer.py ) there no problems. , works charm in shell python 3.3.1 (v3.3.1:d9893d13c628, apr 6 2013, 11:07:11) [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import xmlrpc.client >>> the 2 people work don't have problems, , running same code version control. same error

c# - Get an error, probably WebResource.axd -

Image
i have trouble, think problem webresource.axd file. using asp.net web form .net 4.5 , visual studio 2012 web developer express. i declare in aspx file treeview, , in codebehind allocate data treeview. working, there became missing pictures, use standard systemset. here code: .aspx: <asp:treeview id="treeview" runat="server" showlines="true" imageset="arrows"> </asp:treeview> .aspx.cs: protected void page_load(object sender, eventargs e) { if (!page.ispostback) { logic.treeview("file", treeview); } } web.config: <?xml version="1.0" encoding="utf-8"?> <!-- weitere informationen zum konfigurieren der asp.net-anwendung finden sie unter http://go.microsoft.com/fwlink/?linkid=169433 --> <configuration> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework=&quo

azure - Service Bus MessageSession accepted but Receive returns null -

we use azure service bus queue, , receive messages using acceptmessagesession (code below). accepting messagesession succeeds, when call receive on messagesession, null returned. this doesn't happen time, rather after time since creation of queue. verified queue isn't empty when happens. when close messagesession see queue shorten (in correct number of messages!) hadn't received messages... the code use: public ienumerable<t> receivebatch<t>(timespan waittime) { messagesession sessionreceiver = null; ienumerable<t> retval; queueclient queueclient = getqueueclient<t>(); try { sessionreceiver = queueclient.acceptmessagesession(waittime); retval = receivesessionmessages<t>(sessionreceiver); } { if (sessionreceiver != null) sessionreceiver.close(); } return retval; } private ienumerable<t> receivesess

database - Very large .csv file, -

i have large amount of data, 20 million rows , 6 columns. trying extract data large .csv file. tried r, error msg, using macbook 4 gb ram, i5 processor. there way can extract information, tried excel, can take 1 million rows. advise or useful file more 1.3 gb, want divide data base set of 2000-3000 based on parameter. tried r , when used read.csv.. tries moment but after 10 mints or r not responding – i want separate these data based on 3rd column. sha pct practice bnf code bnf name first of have tell mean extract data. if sort of aggregation functions or can divided, think easiest way split huge csv file many small one. if need else, have here: package storing big data on disk (not ram) http://ff.r-forge.r-project.org/ package allocates points unused memory or points swap file. https://r-forge.r-project.org/r/?group_id=556 paralelizing big data http://www.r-bloggers.com/taking-r-to-the-limit-parallelism-and-big

java - Unique Random Integer Generator -

i'm trying make random integer generator produces unique numbers. does has ideas how's possible? if have small-enough range of possible numbers, simple , useful: final list<integer> sack = new arraylist<>(range); (int = 0; < range; i++) sack.add(i); collections.shuffle(sack); now pull items out of sack in order.

build - Building a R package specifying the R version -

i upgraded r version 3.0.0. wa using r.2.15.2, tried load fasttime built previously. off course told me build old version of r , had again. first let me cannot use update.packages or install.packages (firewall), loaded .tar.gz sources , tried r cmd install --build fasttime_1.0-0.tar.gz , worked used old version of r have in path (i think see r 2.15.2 printed on screen). offcourse cannot change path question: how can tell r cmd install use r.3.0.0 , or how can otherwise

io - Two similar copy codes with Java, two behaviors -

so wanted implement function copies file new file of i'll specify directory (i'll create it) , then, found on stackoverflow, use files.copy function of apache.commons trick. my problem following : write 2 codes, 1 works , other don't, except similar seem not capture difference... here's code first method : public static void copytofile2 (string firmfoldername, string allfirmsfoldername, string copy_file_name, string copied_file_name) throws ioexception { file = new file(copied_file_name) ; string pathofdirectoryoftofile= "folder/" + allfirmsfoldername +"/" + firmfoldername ; //string pathofdirectoryoftofile = "folder/fomrs/firm/" ; string pathoftofile = pathofdirectoryoftofile + "/" + copy_file_name ; (new file(pathofdirectoryoftofile)).mkdir(); file = new file(pathoftofile) ; files.copy( from.topath(), to.topath() ); } in one, have specify few paramete

c++ - Last man standing , used circular linked list -

question : company hiring candidates, makes them sit in circle. select every second candidate , leaves circle (thus circle keeps getting smaller), till 1 left. so, if there 5 people, it'll :- 1 2 3 4 5 1 3 4 5 (2 selected) 1 3 5 (4 selected) 3 5 (1 selected) 3 (3 left, does'nt job!) jhon oversmart guy doesn't want part of spiteful company. where stand if knows there 560 people in total. ans : tried make program enter n(number of candidates) , it'll print value of 1 seat go unselected. i used circular linked list , deletion. please bear me , new coding . my program works inputs 2, 4, 8, 16, 32, 64 , on ans in these 1. other input , it's not working. #include <iostream> using namespace std; struct node { node* ptr; int data; }start; int main() { node *start=null; int n; cout<<"enter number of students : "; cin>>n; node *temp=new node; temp->data=1; temp

java - Looking Up Quotation marks with a array of Strings -

so have following string: dog "and" cat split array named: array1 with, {'d','o','g',' ','"','c','a',t','"'} boolean works = false; (int i=0; < array1.length;i++){ if (array1[i].equals("d"){ if (array1[i+1].equals("o"){ if(array1[i+2].equals("g"){ if (array1[i+3].equals(" "){ if (array1[i+4].equals("""){ //does work here if (array1[i+5].equals("c"){ if (array1[i+6].equals("a"){ if (array1[i+7].equals("t"){ works = true; } } } } } } } } } system.out.println(works); it doesnt work @ equals quotations. have ideas?

mysql - Selecting A Row Based On One Value In A Multi-Value Array Using IN Clause -

i have column in database values stored comma separated array; let's sample entry in database be: 1, 5, 8, 15 i trying use data in select statement allow user select entry in database array contains value select (the values tied look-up table join in actual application, user not see integers). my simplified select statement essentially: $arrayvalue = "1"; $query = "select * table tablearray in ($arrayvalue)"; for example put in 1 array value 1 searching for; in actuality variable populated post form input user has control of. 'tablearray' name of column containing comma separated array said contain 1, 5, 8, 15 example (though varies in reality). this statement in clause works fine me right data in table column has 1 value, or multiple values in array when select first value in array, not return second value if select i.e. if set $arrayvalue 1 works, 5 not return row in results. i not need select multiple values array @ time, want wo

puppet - Ruby how to extend method to accept new parameter -

i hope can me this. i have method in ruby: def puppetrun_oneclass! proxyapi::puppet.new({:url => puppet_proxy.url}).runsingle fqdn end which call within other method: def update_multiple_puppetrun_oneclass_deploy if @hosts.map(&:puppetrun_oneclass!).uniq == [true] notice "successfully executed, check reports and/or log files more details" else error "some or hosts execution failed, please check log files more information" end end where @hosts array of hostnames. now, extend puppetrun_oneclass! accept @mydeploy parameter, @mydeploy parameter variable containing string. how that?? , how should call modified method? thanks!! you should add argument, means need declare long-form block map loop. new method: def puppetrun_oneclass!(deploy) # ... code using `deploy` variable end new call: @hosts.map { |h| host.puppetrun_oneclass!(@mydeploy) }.uniq note uniq pretty heavy handed approach here if

Android layout "3 columns" imageview + textview + imageview -

maybe simple question, i'm trying achieve such layout linearlayout: imageview textview imageview ----fixed width--- + ---------- fill ---------- + ----fixed width (right align)--- the problem textview maybe take space on right, making second imageview disappearing. try put android:layout_width="0dip" , android:weight="1" textview while having 2 imageviews no weight property. ensure area in between 2 imageview s filled textview .

Sphinx killlist query -

i don't know why killlist not working ? my sphinx.conf looks that: source main { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = sphinx sql_port = 3306 # optional, default 3306 sql_query_pre = set names utf8 sql_query_pre = replace sph_counter select 1, max(id) documents sql_query = \ select id, group_id, unix_timestamp(date_added) date_added, title, content \ documents \ id<=( select max_doc_id sph_counter counter_id=1 ) sql_attr_uint = group_id sql_field_string = title sql_attr_timestamp = date_added sql_query_info = select * documents id=$id } source delta : main { sql_query_pre = set names utf8 sql_query = select id, group_id, unix_timestamp(date_added) date_added, title, content \ documents \ id>( select max_doc_id sph_counter counter_id=1 ) sql_query_killlist

Is it possible to improve speed in ODE solvers from matlab? (ode45 ode15s etc) -

i wrote code solve system using ode45 , ode15s in matlab. wondering if can improve speed of code using multiple core (or parallel code) in script. anyone have tried ?? thanks no, can't. all numerical integrators, ode45 , friends included, use form of iterative scheme solve user-implemented (coupled) non-linear (partial) differential equations. each new step in iterative schemes of ode45/15s/.. (to compute new state of system) depends on previous step (the old state of system), therefore, these numerical integrators cannot parallelized effectively. the speedup can that's have big impact optimize implementation of differential equation.

validation - JQuery Validator plugin: Remote call not working -

i'm trying validate user name remote validation. here js code $('#form_reg').validate({ rules: { username: { minlength: 6, required: true, remote: { url:"validate_usr.php", async:false } }, }, highlight: function(element) { $(element).closest('.control-group').removeclass('success').addclass('error'); }, success: function(element) { element .text('ok!').addclass('valid') .closest('.control-group').removeclass('error').addclass('success'); } }); and php file <?php include("bd_conex_mysql.php"); if (!empty($_request['username'])) { $usrname = $_request['username']; $checkname = mysqli_query("select count(*) cuentas ctausr = '".$usrname."'"); if($checkname->fetch_row() > 0){ echo 'false'; } else{ ech

JSF extending the UIInput does not invoke UPDATE_MODEL on the bean -

i have created custom components extendeds uiinput , overwrites constructor , getfamily() follows: public htmlinputdatetime() { super(); setrenderertype(renderer_type); } @override public string getfamily() { return comp_family; } the created appropriate renderer overwrites getendtexttorender . problem although local value set , passed among requests (and value fetched model) never updates actual backing bean. hints why? thanks using jsf mojarra 2.2 when creatinf custom components (or forms in general) idea render h:messages see if there validations failed. as turns out component working fine since value date failed conversion. after added <f:convertdatetime/> , works fine.

css - Unwanted margin issue in Internet Explorer 7 -

Image
i have weird problem in internet explorer 7 shows heading lot of distance top. problem not exists in other browsers or newer versions of ie. what should make right? chrome version: ie 7 version: html <div class="box"> <header class="module-title"> <h2 class="title">گزارش و مصاحبه</h2> </header> <section class="module-content"> <ul class="sidebar-news"> <li> <div class="image-holder"> <img src="img.jpg" alt="test item"> </div> <h3><a class="moduleitemtitle" href="#">copy of مصاحبه با معاون صدا درباره راديو كتاب</a></h3> . . . </li> </ul> </section> </div> css .module-title h2 { ma

c# - Counting occurrences in Array -

i counting occurrence of each element in array error "value cannot null" doesn't make sense me because arr1 populated no null values except last 5 elements null. here code. using dictionary first time may have logic error somewhere. reading textfile. string[] arr1 = new string[200]; streamreader sr = new streamreader("newworksheet.txt"); string templine1 = ""; int counter = 0; while (templine1 != null) { templine1 = sr.readline(); arr1[counter] = templine1; counter += 1; } sr.close(); // dictionary, key number list , associated value number of times key found dictionary<string, int> occurrences = new dictionary<string, int>(); // loop test data foreach (string value in arr1) { if (occurrences.containskey(value)) // check if have found key before { // key exists. add number of occurrences key 1 occurrences[value]++; } else { // new key add it. number 1 indicates key has been fo

oracle11g - Oracle external table logfile showing file not found when table not accessed -

we're using in oracle 11g release 2 oracle_loader type external table import data csv file table. external table has dummy filename set location value, users entering correct filename parameter when package run. package code set location via alter statement. there 1 package - , nothing else - using external table, , package run - once week. however, external table's logfile being updated every 4 hours, saying dummy file wasn't found (which, of course, wouldn't be): log file opened @ 05/10/13 22:00:12 kup-04040: file dummy_input_csv.csv in dir_extdir not found log file opened @ 05/11/13 06:00:13 kup-04040: file dummy_input_csv.csv in dir_extdir not found log file opened @ 05/11/13 10:05:07 kup-04040: file dummy_input_csv.csv in dir_extdir not found from oracle documentation i've seen regarding managing , using external tables, thought external table's logfile updated when external table used via select statement retrieve data. what else,

file io - python overwrite bytes from offset1 to offset2 -

i've seen multiple tutorials in python, played around bit python file write(), tell(), seek() functions , os.write(), lseek() functions. but still don't how can following: have: in file know start_offset , end_offset bytes. , need replace bytes start_offset end_offset different set of bytes. how do this?? ftell() returns me start_offset , regex + ftell() returns me end offset have bytes overwrite original ones in file. but write() takes string write. how overwrite start_pos end_pos?? appreciate pointers/suggestions despite shouted denial, can use mmap here. if @ mmap constructor in docs , takes parameters offset , length . on platforms, both have multiple of pagesize or similar value, that's not hard. so: try: pagesize = mmap.pagesize except nameerror: pagesize = mmap.allocation_granularity def overwrite(fileobj, start, end, newbytes): startoffset, startremainder = divmod(start, pagesize) offset = startoffset * pagesize

Achieve similar hardware acceleration optimization in Android 2.3 - Avoid multiple onDraw call -

by referring http://developer.android.com/training/custom-views/optimizing-view.html#accelerate , know can avoid multiple system call on busy ondraw using setlayertype(view.layer_type_hardware, null); . i tested on android 4, performing home -> restore -> home. realize ondraw called once stated in above android documentation. however, how can achieve similar optimization in android 2.3? android 2.3 doesn't support hardware optimization. public class piechart extends view { @suppresslint("newapi") public piechart(context context) { super(context); mpiepaint = new paint(); mpiepaint.setantialias(true); mpiepaint.setstyle(paint.style.fill); mpiepaint.setcolor(0x88ff0000); if (android.os.build.version.sdk_int >= android.os.build.version_codes.honeycomb) { if (!isineditmode()) { setlayertype(view.layer_type_hardware, null); } } } @override

vb.net - Refreshing an ASP.Net GridView if an ASP.Net button and the GridView are in different asp:Content blocks -

we refresh asp.net gridview if asp.net button , gridview in different asp:content blocks in working asp.net web form had datasource, gridview, detailsview, various other controls, asp:textbox , asp:button searching data based on user enters textbox. of these in single asp:content block , had asp:updatepanel. we decided change layout of form , separate gridview , detailsview , place them asp:content block. when form run, showed in correct locations on screen , showed data database expected. we discovered if user entered search criteria , clicked search button, code in code-behind file did execute gridview did not refresh. i'm going assume coding needs added in code-behind file that. here markup search button 1 of asp:content blocks: <asp:content id="contentbody" contentplaceholderid="bodyplaceholder" runat="server"> <% '-- ajax enable area flicker cut down minumum. -- %> <% '------------------------------------