Posts

Showing posts from January, 2015

objective c - Check string containing URL for "http://" -

i trying check url entered user, fighting against errors , warnings. -(bool) textfieldshouldreturn:(uitextfield *)textfield { //check "http://" nsstring *check = textfield.text; nsstring *searchstring = @"http://"; nsrange resultrange = [check rangewithstring:searchstring]; bool result = resultrange.location != nsnotfound; if (result) { nsurl *urladdress = [nsurl urlwithstring: textfield.text]; } else { nsstring *good = [nsstring stringwithformat:@"http://%@", [textfield text]]; nsurl *urladdress = [nsurl urlwithstring: good]; } // open url nsurlrequest *requestobject = [nsurlrequest requestwithurl:urladdress]; they : nsstring may not respond -rangewithstring unused variable urladdress in condition "if … else" (for both) urladdress undeclared : in urlrequest does have idea do? nsstring responds rangeofstring: , not rangewithstring: . the variable urlad...

SQLite with Ansi C and xCode -

i'm starting bottom-up learn ipad development after 15 years cold fusion. i'm getting comfortable ansi c , xcode, stumped taking next step sqlite. i've built database (airports.sqlite) razorsql , installed in same directory main.c i've installed amalgamated sqlite3.h , sqlite3.h files. everything compiles ok, following message when run... error in select statement select length runways order length desc limit 5 [no such table: runways]. the database has runways table in it. can set me straight? here's code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include "sqlite3.h" #include "weightbalance.h" sqlite3* db; int first_row; int select_callback(void *p_data, int num_fields, char **p_fields, char **p_col_names) { int i; int *p_rn = (int*)p_data; if (first_row) { first_row = 0; for(i=0; < num_fields; i++) { printf("%20s", p_col_names[i]); ...

multithreading - Ruby, simple "threading" example to update progress in console app -

i trying implement simple console app lots of long processes. during these processes want update progress. cannot find simple example of how anywhere! still "young" in terms of ruby knowledge , can seem find debates thread vs fibers vs green threads, etc. i'm using ruby 1.9.2 if helps. th = thread.new # here start new thread thread.current['counter']=0 11.times |i| # loops , increases each time thread.current['counter']=i sleep 1 end return nil end while th['counter'].to_i < 10 # th long running thread , can access same variable inside thread here # keep in mind not safe way of accessing thread variables, reading status information # works fine though. read mutex better understanding. puts "counter #{th['counter']}" sleep 0.5 end puts "long running process finished!"

Get yesterday date in Unix - KSH script -

the below command used getting yerterdays date in unix ksh on hp ux date_stamp=`tz=cst+24 date +%m/%d/%y` can let me know "cst + 24 date " in above command do? that command sets timezone cst+24 , returns date in timezone. if looking command find out yesterday's date, better of using tz trick esp. if in timezone observes dst. use perl 1 liner instead. #this takes local time , substracts day(24*60*60 seconds) , formats time. echo `perl -e 'use posix; print strftime "%m/%d/%y%", localtime time-86400;'` just guess on command - since yesterday @ cst+24 timezone command returns yesterday's date , if use cst-24, retunrs tomorrow's date since date translates tomorrows date @ cst-24 timezone.

Running git commands using subprocess.Popen in python -

i writing small python script needs execute git commands inside given directory the code follows: import subprocess, os pr = subprocess.popen(['/usr/bin/git', 'status'], cwd=os.path.dirname('/path/to/dir/'), stdout=subprocess.pipe, stderr=subprocess.pipe, shell=true) (out, error) = pr.communicate() print out but shows git usage output. if command doesn't involve git eg. ['ls'] shows correct output. is there missing ? python version - 2.6.6 thanks. subprocess.popen : on unix, shell=true : […] if args sequence, first item specifies command string, , additional items treated additional arguments shell itself . you don't want shell=true , list of arguments. set shell=false .

Get outgoing IP address in Java RMI -

in java rmi application, can have instances behave servers both locally , on different hosts. in latter case, how can outgoing ip address can set argument of system property java.rmi.server.hostname? right it's hard wired, that's not desirable solution. you can use classic java way: try { inetaddress addr = inetaddress.getlocalhost(); // ip address byte[] ipaddr = addr.getaddress(); // hostname string hostname = addr.gethostname(); } catch (unknownhostexception e) { }

jquery remove text between tags -

i have such html: <li> <a href="#">2012: ice age</a> <br> <a href="#"> blah blah </a> <br> text should disappear!!! </li> how remove text jquery? don't have control on code, cannot add ids easier selection.. $('li').contents().last().remove(); if @ end, can use contents() [docs] method (which gets children, including text nodes, , last() [docs] method target last one. example: http://jsfiddle.net/kttfq/ edit: you empty content of text node: $('li br:last-child')[0].nextsibling.nodevalue = ''; example: http://jsfiddle.net/kttfq/2/

excel - What is the best way to say format is mm/dd/yyyy - but in the local format? -

excel appears not have (unless missed it), we're getting demand it. , since try match excel cell formatting syntax, i'd add in in way makes sense. so suggestions on how specify want short/medium/long date/time/datetime formatted in local layout? in other words can spec in mm/dd/yy , in germany yyyy mm dd. thanks - dave actually, can use asterisk in cell format menu choose cell display depending on current system regional settings. for instance : *06/30/2011 display differently depending on system regional settings : 06/30/2011 or uk (for instance) 30/06/2011 france (for instance) see here more information.

how to work with and draw resize images WPF C# -

hello need know how can manage resize , draw pictures in given space , top , left values ​​are stored in database or xml. elements need use? i put pictures of software works perfection, need create shown in following images: imagen 2 imagen 3 thanks!! you want canvas resizing adorner tells elements size , placement draw. here one such example .

jquery - Clone a tr, but preserve width -

i'm trying clone row in table, , insert row empty table. easy. but possible preserve original width of cells in tr (that may perhaps expanded due other cells in same column)? edit realized should iterate through matching cells after clone , sync width. still curious if there more direct way though... clone row, iterate on children of row, setting width of each child each child of original @ corresponding index. var target = $('#target'); var target_children = target.children(); var clone = target.clone(); clone.children().width(function(i,val) { return target_children.eq(i).width(); }); $('<table>',{border:1}).append(clone).appendto('body'); example: http://jsfiddle.net/z7hwh/ i'm unsure of browser support setting width on <td> .

How to Inject session bean in custom spring security login success handler -

i'm unable inject spring session bean in custom success handler: @component public class customsavedrequestawareauthenticationsuccesshandler extends savedrequestawareauthenticationsuccesshandler { @resource private sessioncontroller sessioncontroller; @override public void onauthenticationsuccess(httpservletrequest request, httpservletresponse response, authentication authentication) throws servletexception, ioexception { super.onauthenticationsuccess(request, response, authentication); sessioncontroller.setutenteonline(); } that return null pointer exception on sessioncontroller. thank in advance your success handler singleton can inject singletons reliably. can solve problem using scoped dependencies . basically, involves spring injecting singleton dynamic proxy manages fetching real bean session scope , delegating calls it.

java - Good way to make a launcher screen for sub-apps within your app? -

i'm making app company, , want main screen when first enter app couple sub-apps (right they're separate activities) can go (glossary, faq, calculator, etc). any ideas best way is? i'm new this. thanks use gallery or grid, depending on number of sub-apps talking about. example of gallery: https://ssl.gstatic.com/android/market/com.ihaapp/ss-480-0-0 the grid view launcher app on android phone.

c - Custom Find/Replace dialog box -

first of all, please bear in mind i'm new windows programming. i'll try cover question in great detail, answer too. a short introduction: i'm copying writing notepad-like application using win32 api , pure c. of familiar petzold's windows programming, modified version of poppad program used describe common dialog boxes. i'm writing strictly educational purposes, please refrain posting comments "why using old technology, use .net", comments not me solve problem :). description of problem: petzold in poppad program used common dialog boxes write notepad-like application. used edit control provide functions of basic text editor. poppad, notepad, had find , replace dialog boxes could, well, find stuff , replace it! mind boggling, know. so wanted test newly acquired knowledge reading past chapters, decided write own find , replace dialog box. granted, in simplest form possibly. how hard can be? have 1 text field enter text , have 1 fancy button s...

Android ImageView with Rounded Corners not working -

Image
this question has answer here: how make imageview rounded corners? 35 answers i have definied file thumb_rounded.xml , placed inside res/drawable folder in android application. file want rounded corners in imageviewthat contains news thumb, <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="13.0dip" /> </shape> and setting background of imageview, however, dont rounded corners, image remains rectangle. have idea on how that? want achieve same effect screen: many thanks t you're lacking couple of tags. here's new sample: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android...

How do I write sbit in C# -

i porting c code of firmware c# , not sure how keyword "sbit" can written in c#. in advance. link @ben robinson, "(...)with typical 8051 applications, necessary access individual bits within sfr. sbit type provides access bit-addressable sfrs , other bit-addressable objects. example: sbit ea = 0xaf; this declaration defines ea sfr bit @ address 0xaf. on 8051, enable bit in interrupt enable register.(...)". sbit name = sfr-address ^ bit-position; this low level, might try use c++.net, matter. c# high level language, using pointers can little tricky, can done, escapes c# real intent. use c++.net made functions, final code of both same [clr (common language run-time)], machine not note diference.

google places api help c# -

i dont have experience google apis @ , need implement , appreciate if me i have implement google places api(?) results form google places , details associated place for example if type pizza london in google places search you'll 10 places per page. need " link site " , xml(preferable) type of result details place, such address, contact, link website, , payment options. i dont know if possible if appreciate if post example of how works thanks in advance basically need register , key use google places. once have key can access ... https://maps.googleapis.com/maps/api/place/search/xml?location=31.1556451,-93.7761955&radius=7500&sensor=false&key=enter-google-key-here&types=bar which lists bars within 7.5km of place latitude: 31.1556451 , longitude: -93.7761955 --- additions in response comment below --- if have place (like london) , not latitude , longitude go it, can try 2 step process -- use google geocoding api lat lon , use se...

what technologies to use to create excel/spreadsheet-like web app? -

trying create excel-like tool groups csv's , has specific rules each column, , columns can insert images/paths associated. user should able login difference permissions, export/import spreadsheets, see older versions of them, , customize new/existing columns different rules. any advice/ideas should use backend/frontend? starting out cappuchino. have tried table-tools? http://www.datatables.net/

Trying to get a jQuery event to Fire onClick on a select/option form -

i have form, 1 of fields select field, 5 options. when 5th option clicked, want hidden div shown. want nothing happen other 4 clicked. it works on firefox, no else. after researching little, seems chrome/ie don't let onclick firing select. far suggestions have been use onchange on select whole, haven't been able figure out fire code when 5th option clicked using onchange. appreciated. custom proptions set display: none; default. want div id'd *custom_proptions* show when option id'd *custom_proptions_option* clicked, , want re-hide if shown first, , 1 of other options clicked. <div class="proptions_container"> <select name="proptions" id="proptions" class="proptions"> <option value="0" class="default_proptions" id="choose_prompt">choose proptions&#8230;</option> <option value="1" class="default_proptions">yes <strong>or</strong...

iphone - Fmod listener position -

is possible have several sounds on different places in 3d sound world in fmod? plot sounds in 3d world , move around player. i developing iphone. to place channel or event in 3d location use either channel::set3dattributes or event::set3dattributes, these functions take 3d world position , direction vector. if want "walk" around 3d world, need adjust listener position either system::set3dlistenerattributes or eventsystem::set3dlistenerattributes (depending on if using fmod low level api or fmod event system api. these functions take position vector, velocity vector, forward vector , vector. i recommend referring 3d example ships fmod , checking fmodex.chm more details above functions.

php - basic mysql/data storage question: information architecture, not as much code itself -

i'm trying figure out first "more complex" sql application , having bit of hard time conceptualizing best way go simple. understand code, think, around various concepts want know best way think way proceed, , more importantly what terms/how call method , can more research on myself without needlessly bothering people! i building wp plugin let add number of boxes number of "transactions". basically, transaction 1 can have box 3 boxes called apples, fruits, organes. transaction 2 can have 10 boxes. , on. want way show end user in best way. beginner, (bad, i'm sure) instinct have 1 key called, say, transactions, comma separated list "1,2,3,4,5". then, have table index 1,2,3 , each of these keys have various boxes. grab first csv list db, "explode" array , cycle through, grabbing keys second table reflect #. in second table, each "key" point other keys? confused. best way proceed? kind of code need for? edit: here visua...

jquery - Need to update the check box value to db table when i click the checkbox() without post back in MVC2 -

<input type="checkbox" name="n" value=1 /> <input type="checkbox" name="n" value=2 /> <input type="checkbox" name="n" value=3 /> i have above checkbox when select need update db table without post back. please explain.. if possible can jquery or ajax method solve problem you have sort of request server, whether it's post form button or ajax post or request. form button: <form action="/myapp/handleclick/" method="post"> <input type="checkbox" name="selectedobject" value="cbvalue"/> <button type="submit">submit</button> </form> or, ajax (with jquery): jquery('input[name=selectedobject]').click(function() { jquery.ajax({ url: '/myapp/handleclick/', data: { selectedobject: this.value, } success: function() { ...

objective c - kCAFilterNearest maginifcation filter (UIImageView) -

Image
i using qrencoder library found here: https://github.com/jverkoey/objqrencoder basically, looked @ example code author, , when creates qrcode comes out no pixelation. image library provides 33 x 33 pixels, uses kcafilternearest magnify , make clear (no pixilation). here code: uiimage* image = [qrencoder encode:@"http://www.google.com/"]; uiimageview* imageview = [[uiimageview alloc] initwithimage:image]; cgfloat qrsize = self.view.bounds.size.width - kpadding * 2; imageview.frame = cgrectmake(kpadding, (self.view.bounds.size.height - qrsize) / 2, qrsize, qrsize); [imageview layer].magnificationfilter = kcafilternearest; [self.view addsubview:imageview]; i have uiimageview in xib, , setting it's image this: [[template imagevqrcode] setimage:[qrencoder encode:ticketnum]]; [[[template imagevqrcode] layer] setmagnificationfilter:kcafilternearest]; but qrcode blurry. in example, comes out crystal clear. doing wrong? thanks! update: i...

c# 2.0 - ASP.net Session in SQL or cookie -

i deployed asp.net web site 2 servers , put them behind load balanced environment. problem performance slow. simple button event, takes long time finish simple button event. however, if access site separately (by server’s address), performance good. our system engineer told me application handles session state in process if runs on 1 server, not handle clustering. so, suggested should use session object in code store session in sql server, or cookie. i using session variables store session. i kind of new asp.net , not sure mean , how can accomplish in .net code (c#)? thanks. here link start off: asp.net session state you want go out of process mode servers access 1 session process on designated server, if speed top priority or sql server mode servers access 1 database if reliability top priority out of process mode if process dies session data lost similar how in-process session handling works. no coding changes storing session data needed, initial configu...

asp.net mvc 3 - mvc3 Routes setup as id, id2 id3 -

i have following area routes setup. context.maproute( "admin_default3", "admin/{controller}/{action}/{id}/{id2}/{id3}", new { action = "index" } ); context.maproute( "admin_default2", "admin/{controller}/{action}/{id}/{id2}", new { action = "index"} ); context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { action = "index", id = urlparameter.optional } ); when controller action hit following place params readable variable names. public actionresult search(guid? id, int? id2, bool? id3) { guid? source = id; int daysold = id2; bool includenonenglish = id3; //.... action! } should continue way? should create plethora of routes? thank i create more routes. way, have things like: html.actionlink(title, "action", "controller", new { source = <value>, daysold = <value>, inc...

How to synchronize two git-svn repos -

i have use subversion repository , i'd use git-svn. switch computer , @ moment need commit changes , update other computer. changed code wouldn't work, idea create 2 git-svn repos , synchronize them push/pull, , sync them (or 1 of them) svn repository. possible? switching repository git no option. (sadly) if need sync svn git repo both of computer, yes: each repo "git-svn" one. create 2 repos, , create own set of git branches on top of git-svn ones. but must not merge/push/pull branch dcommit'ed svn: need pay attention caveats section of git-svn : for sake of simplicity , interoperating subversion, recommended git svn users clone , fetch , dcommit directly svn server, , avoid git clone / pull / merge / push operations between git repositories , branches. recommended method of exchanging code between git branches , users git format-patch , git am, or 'dcommit’ing svn repository. running git merge or git pull not recommended on ...

ruby on rails - How can I use will_paginate on a collection of partials away from an index page? -

i have users page displays reviews user has written. each review displayed partial (named _profile) , shown on page of accordian. how can add pagination these review partials? users show page <div class="profile_reviews_container"> <div id="accordion"> <h3><a href="#">reviews written</a></h3> <div class="profile_reviews_cont"> <% @user.reviews.each |review| %> <%= render "reviews/profile", :profile => review %> <% end %> </div> <h3><a href="#">favourites</a></h3> <div> </div> </div> </div> which controller add .paginate call , view contain <%= will_paginate @reviews %> or <%= will_paginate @profiles %> ? thanks appreciated! i paginate reviews in users#show action. like: @reviews = @user.reviews.paginate page: params[:page] an...

php - MySQL User defined variable within Doctrine and Symfony -

i have following doctrine statement works fine. $query = $this->createquery('r') ->select('u.id, concat(u.first_name, " ", left(u.last_name,1)) full_name, u.first_name, u.last_name, u.gender, r.run_time') ->innerjoin('r.challengeuser u') ->orderby('run_time') ->execute(array(), doctrine::hydrate_array_shallow); i need add row count this. know raw sql can this; set @rank=0; select @rank:=@rank+1 rank, u.id, u.first_name ....etc so question is, how can run symfony 1.4 , doctrine? using mysql project. edit... figured out.. doctrine_manager::getinstance()->getcurrentconnection()->standalonequery('set @rank=0;')->execute(); $query = $this->createquery('r') ->select('r.run_time, @rank:=@rank+1 rank, r.user_id, concat(u.first_name, " ", left(u.last_name,1)) full_name, u.first_name, u.last_name, u.gender') ...

iphone - Is there a way to limit how many items scrolled per swipe in UITableView? -

i thinking of putting uitableview on it's side make carousel, i'd limit number of item gets scrolled every swipe. think screenshot carousel in apple app store, when swipe, scrolls 1 item @ time. doable? uitableview right control use? you can set pagingenabled yes , way uiscrollview (or uitableview, subclass of uiscrollview) stop on multiples of scroll view’s bounds when user scrolls. take here http://developer.apple.com/library/ios/documentation/uikit/reference/uiscrollview_class/reference/uiscrollview.html#//apple_ref/occ/instp/uiscrollview/pagingenabled

Foreach Iterator Behavioral Difference in PHP 5.2.0 versus PHP 5.3.3 -

$test = array(1, 2, 3, 4, 5); foreach($test $element) { echo $element; $element = next($test); echo $element; } this produces output "122334455" in php 5.2.0 output "13243545" produced in php 5.3.3 how reproduce output of 5.2.0 in 5.3.3 efficiently means of controlling iterator? this may bug iterator works in 5.2 inside foreach, not in 5.3's foreach. it seems bug related php. can use more explanatory "for" loop: $c = count($test); for($i=0; $i < $c; $i++) { echo $test[$i]; if(isset($test[$i+1])) { echo $test[$i+1]; } else { echo $test[$i]; } }

jquery - What does "this" refer to in the following javascript? -

disclaimer: asking specific use of this , not this used in general. so, please no google/copy/paste speed answers (: i have javascript/jquery code below: var req = {}; function getdata() { var frompage = 0; var topage = 1; req = $.ajax({ url: "/_vti_bin/lists.asmx", type: "post", datatype: "xml", data: xmldata, complete: onsuccess, error: function (xhr, ajaxoptions, thrownerror) { alert("error: " + xhr.statustext); alert(thrownerror); }, contenttype: "text/xml; charset=\"utf-8\"" }); req.frompage = frompage; req.topage = topage; } function onsuccess(resp) { alert(this.frompage); } i find pretty confusing code using frompage in 2 places (sorry not code). does thi...

shell - Can gdb debug suid root programs? -

i did program call setuid(0) , execve("/bin/bash",null,null). then did chown root:root a.out && chmod +s a.out when execute ./a.out root shell. when gdb a.out starts process normal user, , launch user shell. so... can debug suided root program? only running gdb root. (in other words, no.) for security reasons, normal users not allowed trace processes belonging other users, root.

Maven config for RESTEasy 2.2.0.GA -

i can't seem find resteasy 2.2.0.ga in jboss repos. know of repos in can find version of resteasy? the atlassian repository has copy: https://maven.atlassian.com/content/repositories/jboss-releases/org/jboss/resteasy/

javascript - Typewriter Text with Underscore that types and erases (In a Cycle) -

i found amazing typewriting effect @ website: http://www.9elements.com the header shows brilliant typewriter effect want duplicate, code not work in explorer. script types each letter, erases via backward delete, , types next sentence separately. more importantly, loops. i need find script comparable if not same. does have suggestion? erik here's start with: http://plugins.jquery.com/plugin-tags/typewriter http://davidwalsh.name/mootools-typewriter

jQuery .click() event for CSS pseudoelement (:before/:after)? -

i want trigger jquery animation when content inserting through css pseudoelements :before: , :after clicked. however, i'm not sure how this; first guess, $(#id:before).click() didn't work. part of jquery's functionality? if so, how select before / after content? jquery not support css :before , :after selectors. to select siblings, use .siblings() , filter there. http://api.jquery.com/siblings/

php - number_format() causes errors in Apache log -

i using number_format round floats 2 decimal digits. problem of inputs dont have more 2 decimals digits begin with. code: number_format($value, 2) instead of peacefully adding 0 in case doesn't have enough decimal digits, raises errors inside apache log , that's not desirable. how fix this? edit: so number_format(2.1, 2) or number_format(0, 2) raise error in apache log. [thu jun 30 17:18:04 2011] [error] [client 127.0.0.1] php notice: non formed numeric value encountered in /home/tahoang/desktop/projects/weatherdata/weatherdata.php on line 41 try type casting first parameter of number_format() float: $format = number_format((float)0, 2); or $format = number_format(floatval(0), 2);

objective c - How to add a toolbar to a UIPickerView subclass? -

i've created uipickerview subclass, i've completed implementation of picker view itself. what add toolbar above picker view part of new class. how , should in subclass implementation? i add both picker , toolbar view , use "control"

java - How to get DI working with Guice and Webapps? -

how di work in webapp? far i've done following: 1) annotate setter method @inject 2) extend abstractmodule binds interface class implementation class attribute setter annotated in step 1 3) extend guicecontextservletlistener , overrode getinjector returns guice.createinjector(new extendedabstractmodule()) 4) registered extended guicecontextservletlistener in web.xml listener i've verified extended guicecontextservletlistener.getinjector() method called when webapp started. attribute setter annotated not being injected , remains null . i went ahead , created servletmodule serves servlet instantiates object @inject setter. after instantiating object injector servletcontext , call injectmembers method passing instantiated object.

javascript - How extend a function declared inside "options" in mootools? -

i want extend " showerror " function of " form.validator.inline " in mootools. function declared inside " options ". i tried below code, not working. var exformvalidator = new class({ extends: form.validator.inline, options: { showerror: function(element) { var error = element.getprevious(); if(error != null){ error.dispose(); } this.parent(element); } } }); i can make work copying code " mootools-more " below: var exformvalidator = new class({ extends: form.validator.inline, options: { showerror: function(element) { var error = element.getprevious(); if(error != null){ error.dispose(); ...

C# Winforms, no resize arrow using GrowAndShrink -

i have winform picture box, button, , menustrip. picture box anchored sides when resize form, picture box resizes well. set form have minimum size of 700x600. but works when form set autosizemode = growonly. if change autosizemode = growandshrink, diagonal <=> resize arrow doesn't show up. if set sizegripstyle = show on form, can arrow show , "resize" drag resize, flickers fast , goes default size. how can make growandshrink instead of growonly? make sure form properties have following: autosize: false (sounds should true, set false). autosizemode: growonly (like above, sounds should growandshrink) minimumsize: not important. set 1, 1 now. stop resizing getting small. maximumsize: not important. set 1, 1. above (minimumsize). sizegripstyle: not important. set show. lastly, ensure use anchoring or docking adjusting control widths when form resizes. setting controls width may prevent resizing form.

python - Structure for large volume of semi-persistent data? -

i need track large volume of inotify messages set of files that, during lifetime, move between several specific directories, inodes intact; need track movement of these inodes, create/delete , changes file's content. there many hundreds of changes per second. because of limited resources, cant store in ram (or disk, or database). luckily, of these files deleted in short order; file content- , movement-history need stored later analysis. files not deleted end staying in particular directory known period of time. so seems me need data structure partially stored in ram, , partially saved disk; part of portion saved disk need recalled (the files not deleted), not. not need query data, access identifier (the file name, [a-z0-9]{8}). helpful able configure when file data flushed disk. does such beast exist? edit: i've asked related question . why not database? sqlite. while sqlite isn't efficient storage mechanism in terms of space there number of adv...

MVC architecture in Android -

possible duplicate: mvc pattern in android? i want follow mvc architecture in android . how can achieve ? thanks. mvc implemented in android you define user interface in various xml files resolution/hardware etc. you define resources in various xml files locale etc. you extend classes listactivity , tabactivity , make use of xml file inflaters you can create many classes wish model a lot of utils have been written you. databaseutils , html , etc. copied from: mvc pattern on android see example here

java - Problem creating a properties file -

this ended doing. works great use fine tuning. file file = new file("c:/users/mike home/desktop/"+filename+".properties"); fileinputstream instream = null; fileoutputstream outstream = null; properties config = new properties(); try{ if (file.exists()){//checks if exists. instream = new fileinputstream(file); if (instream.available() >= 0){//cheacks if has in it. config.load(instream); system.out.println(config); } } config.setproperty(property , score);//new property outstream = new fileoutputstream(file); config.store(outstream, "property");//names properties in file property config.list(system.out);//prints out properties. } catch (ioexception ioe){//handles problems system.out.println("you pooped pants"); } finally{//closes both input , outp...

c++ - Problem in erasing element in list -

struct scheduletaskinfo { unsigned int ntaskid; __time64_t timestarttime; __time64_t timeendtime; }; typedef list<scheduletaskinfo> schedulerlist; schedulerlist::iterator itrschedulerlist; for(itrschedulerlist = gschedulerlist.begin();itrschedulerlist != gschedulerlist.end();itrschedulerlist++) { systemtime st; getlocaltime(&st); ctime ctsyatemtime(st); if (itrschedulerlist->timeendtime == ctsyatemtime.gettime()) { itrschedulerlist = gschedulerlist.erase(itrschedulerlist); } } i doing crashing in loop.i think due erase(); doing wrong here??please suggest me on you should write itrschedulerlist++ in else-block as: for(itrschedulerlist = gschedulerlist.begin(); itrschedulerlist !=gschedulerlist.end();) { systemtime st; getlocaltime(&st); ctime ctsyatemtime(st); if (itrschedulerlist->timeendtime == ctsyatemtime.gettime()) { itrschedulerlist ...

java - Android thread stime,utime? -

what mean , what's difference? stime , utime in ddms utime - cumulative time spent executing user code, in "jiffies" (usually 10ms). available under linux. stime - cumulative time spent executing system code, in "jiffies" (usually 10ms). please more detail check link http://www.linuxtopia.org/online_books/android/devguide/guide/developing/tools/ddms.html

jquery mobile - How to use joehewitt scrollability? -

can me out in implementing joehewitt's scrollability plugin.( https://github.com/joehewitt/scrollability.git ) trying develop mobile web app! thanks in advance! right so, 1)include javascript file , css file (its in static folder) 2) head http://scrollability.com/ , following structure create 2 divs: <div id="overflow"> <div id="scrollysection"> </div> </div> with following css #overflow overflow:hidden position:absolute top:0px left:0px width:100% height:100% #scrollysection position:absolute top:0px left:0px 3)then need apply fix here: https://github.com/joehewitt/scrollability/issues/29 to code running comment out or remove of exports stuff (lines 77-84). on line 94 require mentioned, pull 2 lines of code out of ready function , comment ready function out. thats did , worked.

javascript - Dynamically added fields not working with calendar field -

i trying attach calendar field dynamically added html code. initially, code shows 3 input fields (as shown in "p_scents" div). when "add employer" clicked, should generate 3 inputs( ones above). working fine me generate first 2 fields (without calendar field), when add calendar field, not working. <body> <h2><a href="#" id="addscnt">add employer</a></h2> <div id="p_scents"> <p> <label>employer name</label><input class="dynamic" type="text" name="employern" id="employern" /> <label>job title</label><input class="dynamic" type="text" name="jtitle" id="jtitle" /> <label>start date </label> <input type="text" name="startd" class="textfield" /> <script language="javascript"> new tcal ({...

Facebook Graph php -

i'm trying basic informations facebook page code: <?php $fb = file_get_contents("https://graph.facebook.com/exemplename", "rb"); $fb_array=json_decode($fb,true); echo $fb_array['id']; echo $fb_array['name']; echo $fb_array['picture']; ?> this work perfect on xampp local server when upload on webserver show blank page. knows reason why doesn't work on webserver ? does remote server allow fetch data via remote urls? see allow_url_fopen configuration directive in php.ini . if not , if can't change configuration have refactor code use ext/curl (if installed).

SQLite Beginner Question. Android Content resolver.update(...) insert(...) -

do explicitly write where clause insert/updates? like so: cr.update(uri, values, "where _id="+id, null); contentresolver.update() about where parameter: a filter apply rows before updating, formatted sql clause (excluding itself).

Django catch-all URL without breaking APPEND_SLASH -

i have entry in urls.py acts catch-all loads simple view if finds appropriate page in database. problem approach url solver never fail, meaning append_slash functionality won't kick in - need. i'd rather not have resort adding prefix static page urls stop being catch-all. know flatpages, uses 404 hook rather entry in urls.py, , had kinda hoped avoid having use it, guess problem might kind of reason why 1 use it. any way round problem or should give in , use flatpages? make sure catch-all url pattern has slash @ end, , pattern last in urlconf. if catch-all pattern doesn't end slash, match stray urls before middleware tries appending slash. for example, use r'^.*/$' instead of r'^.*' last pattern. to same, pass url view named argument, use r'^(?p<url>.*)/$' .

Is java.util.logging.Logger.log() is an chain of responsibility pattern? -

is java.util.logging.logger.log() chain of responsibility pattern?if how log method call getting chained next call? here relevant code : // post logrecord our handlers, , // our parents' handlers, way tree. logger logger = this; while (logger != null) { handler targets[] = logger.gethandlers(); //... if (!logger.getuseparenthandlers()) { break; } logger = logger.getparent(); } } as can see each logging record passed every handler assigned given logger and, if useparenthandlers true , same algorithm applied parent way top. so chain of responsibility pattern each element in chain might handle piece of request.

html - JQuery UI Autocomplete: how to strip tags from label before inserting into the input field? -

i'm using jquery ui autocomplete, have set of items returned via ajax terms highlighted search engine (so label contains html). problem every time choose item value html tags inserted text box of course not nice. wonder if there anyway can strip tags label before inserting text box var cache = {}, lastxhr; $('#location_name').autocomplete({ source: function( request, response ) { var q = request.term; if ( q in cache ) { response( cache[ q ] ); return; } lastxhr = $.getjson( "location_search/", {q: q}, function( data, status, xhr ) { $.each(data, function(i, v){ data[i].label = v.name + (v.address !== null ? ', ' + v.address : ''); }); cache[ q ] = data; if ( xhr === lastxhr ) { ...

sql server 2008 - How to create a new index on a massive SQL table -

i have massive (3,000,000,000 rows) fact table in datawarehouse star schema. table partitioned on date key. i add index on 1 of foreign keys. allow me identify , remove childless rows in large dimension table. if issue create index statement take forever. do sql gurus have fancy techniques problem? (sql 2008) --simplified example... create table factrisk ( dateid int not null, tradeid int not null, amount decimal not null ) --i want create index, straightforward way take forever... create nonclustered index ix_factrisk_tradeid on factrisk (tradeid) i have plan... switch out daily partitions tables index empty fact table index individual partition switch partitions in initial investigation implies work. report back...

iphone - Problem with Reachability: invalid conversion from 'BOOL' to 'NetworkStatus' -

good morning, i trying use reachabily libraries , when try compile obtain same error: error: invalid conversion 'bool' 'networkstatus' this produced in: bool retval = notreachable; if((flags & kscnetworkreachabilityflagsreachable) && (flags & kscnetworkreachabilityflagsisdirect)) { retval = reachableviawifi; } return retval; // error: invalid conversion 'bool' 'networkstatus' i saw post : how compile specific files in objective-c++ , rest of project in objective-c not work. i made new proyect libraries , works perfect , think problem others linkings flags: -lstdc++ -all_load could me this? thank much. your method should return networkstatus . think variable retval should not of type bool of type networkstatus . in fact, setting reachableviawifi on bool considered bug.

How can I set the value of C# Custom Attibutes? -

possible duplicate: how set attributes values using reflection how can set value of custom attribute, custom attribute used in member of class object. consider below member attribute. [datamember] [decorater(false, false)] [decroraterupdt(false, false)] [pricingschema(false, false)] public string uniqueid { { return uniqueid; } set { uniqueid = value; } } i want set pricing schema attribute's value. thanks its not possible please check answer on how set attributes values using reflection

filesystems - Acyclic Graph directory and General Graph Directory -

i need simple explanation or introduction acyclic graph directories , general graph directories. google it, explanations technical. acyclic graph directories: allow directories link 1 another, allow multiple directories contain same file i.e., 1 copy of file exists , change in file can viewed directories in contained. results in acyclic graphs two users can name same file or same directory duplicate paths may complicate task of backing periodically general graph directories: allow cycles more flexible more costly need garbage collection (circular structures) there subset of directories reference count > 0, none of these reachable root

cookies - Outputting getcookie variable in PHP without browser refresh -

i using following code output block of content without cookie, , number if cookie has been set. problem getcookie variable doesn't work until page has been refreshed, or user navigates next page. i happy use header redirect not sure put within code (unless has better solution code itself): if (is_page(817)) { setcookie("phonecookie", 1, time()+3600, cookiepath, cookie_domain); } if ($_cookie["phonecookie"] =="") { echo "no cookie here"; } else { echo "cookie stored!"; } also, code above sets cookie if visitor lands on specific page within wordpress. is there way via query string e.g. example.com/?src=affiliate try this if ((is_page(817) && (!isset($_cookie["phonecookie"]) { setcookie("phonecookie", 1, time()+3600, cookiepath, cookie_domain); //your redirect code here header("location:yoururl); } elseif (isset($_cookie["phonecookie"])) { ...

Have an issue using .htaccess to change HTML to PHP -

i have site loads of html files of them require little php functions. have heard .htaccess can handle , tried code below ... removehandler .html .htm addtype application/x-httpd-php .php .htm .html ... when if open page asks me download .php file this suggests not have mod_php installed or enabled. the web server needs know how handle php files want handle php.

SQL Server query execution very slow when comparing Primary Keys -

i have sql server 2008 r2 database table 12k address records trying filter out duplicate phone numbers , flag them using following query select a1.id, a2.id addresses a1 inner join addresses a2 on a1.phonenumber = a2.phonenumber a1.id < a2.id note: realize there way solve problem using exists , not part of discussion. the table has primary key on id field clustered index, fragmentation level 0 , phone number field not null , has 130 duplicates out of 12k records. make sure not server or database instance issue ran on 4 different systems. execution of query takes several minutes, several hours. after trying 1 of last steps removed primary key , ran query without , voila executed in under 1 second. added primary key , still ran in under 1 second. does have idea causing problem? is possible primary key gets somehow corrupted? edit: apologies had couple of typos in sql query out of data statistics. dropping , recreating pk give fresh statistics. ...

can not navigate to code in eclipse -

all, had imported source code jbpm project in eclipse. earlier able navigate through code holding down ctrl key on class name , clicking on it... i had re-structure code base , had re-import jbpm4 code base project... strangely navigation not work more, suggestion might missing? there bug on eclipse versions 'go declaration' stops working. workaround i've found close , open editor window, work again

javascript - How to sort a dynamically rendered table...? -

i using ajax display table, need sort rendered table @ client side using javascript or jquery best... i tried jquery working fine when page loaded dynamically writing html content div , there sorting rendered table not working... can 1 me out in solving this... i think problem javascript not working while rendering, wrote script alert while rendering html these tags works while rendering page... thanks in advance... by using tablesorter plugin: $("table").tablesorter(); re-running each time table affected (i.e not enought run command once when page loading complete)

How to edit .LAN Files with delphi 7 -

i want edit .lan files delphi 7. can open them using notepad. question can same using delphi also? or there in-built functions tinifile,tregistry etc. has inbuilt functions? ideas appreciated. thanks if can open .lan file in notepad (and content makes sense), means .lan file plain-text file. and, of course, plain-text files can opened in delphi. open way open 'normal' .txt file (using tstringlist , instance). doesn't matter extension different, long plain-text file. now, have no idea .lan file contains. not common file format, pretty sure rtl/vcl has no parser it. however, if .lan file has structure of .ini file, -- of course -- can treat .ini file , use tinifile (or tmeminifile ). one word of caution, however. using old version of delphi. delphi 7 doesn't support unicode in vcl, if .lan files unicode, need apply trix when reading , writing it. (if utf-8 without bom, might lose special characters, it. if there bom, remove it. if file using 2 by...

asp.net mvc 2 - When i select CheckBox().I need to update its value into DB - MVC2,AJAx,JQuery -

please find code tried update db using mvc2.but unable update view page ajax code <script src="../../scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="../../scripts/microsoftajax.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> $('#cbid').click(function(){ $.ajax({ url: 'home/about', type: 'post', data: { checkbox: $('#cbid').attr('checked') }, success: function(o) { alert('saved'); } }); </script> <div class="bgdiv"> <input id="cbid" type="checkbox" name="selectedobject" value="cbvalue" /> controller page code public actionresult about(string str) { aboutmodels objam = new aboutmodels();//model class name polloptions = objam.dbvalue(s...

php - Manipulate select multiple -

Image
is there way make happen when folder 2 selected selects it's subs subfolder 2a , subfolder 2aa when creating folder list, must keep 2 fields, 1 checking if item self parent, , second field , if child parent. when use clicks parent loop through list , finds item child, matches, change "selected" true. loop can use javascript.

Is there a simple way to have external properties for an android APK? -

i have android application gets invoked through adb on desktop machine. have properties file on desktop machine android application somehow needs aware of, need external apk. on desktop (which invoke activities within apk via adb) cannot repackage apk .properties file , re-install apk on phone (i tried via aapt, not preferable because removes signature on apk , cannot resign apk on particular desktop machine). i rather not pass them via intent extras, there lot of them, , cannot use adb shell setprop because doesn't work while phone running. cannot put them on external storage because not guaranteed phone have sd card. can put them in "internal storage" somewhere (if exists) ? i need able pass numerous properties onto device when install apk, cannot put them in apk itself, , not devices have sd cards. any ideas ? take @ method used here: android: transfer sqlite database pc device via usb programatically

Emmiting llvm bytecode from clang: 'byval' attribute for passing objects with nontrivial destructor into a function -

i have source c++ code parse using clang, producing llvm bytecode. point want process file myself... encoudered problem. consider following scenario: - create class nontrivial destructor or copy constructor. - define function, object of class passed parameter, value (no reference or pointer). in produced bytecode, pointer instead. classes without destructor, parameter annotated 'byval', not in case. result, cannot distinguish if parameter passed value, or pointer. consider following example: input file - cpass.cpp: class c { public: int x; ~c() {} }; void set(c val, int x) {val.x=x;}; void set(c *ptr, int x) {ptr->x=x;} compilation command line: clang++ -c cpass.cpp -emit-llvm -o cpass.bc; llvm-dis cpass.bc produced output file (cpass.ll): ; moduleid = 'cpass.bc' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target...