Posts

Showing posts from July, 2010

asp.net - How to determine css's class with if statement -

<div class="<%#((int)eval("cevaplanma_sayisi")>0) ? "divcevaplanmasayisiozel" : "divcevaplanmasayisinormal" %>"> my code above.the code runs when use access database doesnt run sqlserver2008 error.it says when runs code invalid exception handled try this: <div class='<%#(((int)eval("cevaplanma_sayisi"))>0) ? "divcevaplanmasayisiozel" : "divcevaplanmasayisinormal" %>'> the first problem need convert object value of "cevaplanma_sayisi" int . the second problem must wrap eval statement within ' , ' , otherwise malformed html.

python - debug wrapper for external functions -

i looking way simultaneously print , execute function/method in similar wrapping function. issue can not directly decorate function function calling part of jython module. have along lines from jythonmodule import fun, obj fun(a,b,c) o = obj o.method(e,f) i looking away run , print code show fun(a,b,c) o.method(e,f) and execute commands. how without having access jython module? cheers you can use sys.settrace : # trace.py import sys def trace_function(frame, event, arg): if event == "call": # report function calls code_name = frame.f_code.co_name code = frame.f_code print "function call: {0} @ {1}:{2}".format(code.co_name, code.co_filename, code.co_firstlineno) print "locals:", frame.f_locals print return trace_function # continue tracing new scope def f0(arg): print "in f0: ", arg print "done" def f1(arg): print "in f1: ", arg f0(a

api - android.app.ActionBar class not being recognized -

the problem i'm facing right android studio doesn't recognize import classes api level 11 , above. , in manifest minsdk version i'm using 14, fustrating. i'm trying import android.app.actionbar can't, going use support library there's no sense if i'm using api level 14. thanks. i resolved modyfing build.gradle in section {android,defaultconfig} :-)

css3 - Blur Part of the Image Background Behind a DIV with bgStretcher using JQuery -

how can blur part of image behind specific div. using bgstretcher jquery plugin stretch large imaeg across browser window, when resized image stretch fit. the plugin creates following html: <div id="bgstretcher" class="bgstretcher" style="width: 1920px; height: 534px;"> <ul> <li class="bgs-current" style="display: list-item;"> <img src="images/backgrounds/bg-2.jpg" alt="" style="width: 1920px; height: 1280px;"> </li> </ul> </div> i have div position absolute floats on top of bgstretcher div , has content in it. want part of image behind div blurred out in degree elements within div sill more readable. i want blur updated , consistent when resize browser window. tried blur.js following code doesn't work: $('.blur').blurjs({ source: '.bgstretcher img', radius: 7, overlay: 'rgba(255

Date format for PHP sorting with Mysql (Datepicker) -

i'm using datepicker allow users add events calendar db table want able let other users search database , pick dates between 2 values, wondering best date format @ moment it's not ordering them correctly (at moment i'm using d-m-y). have put in timestamp , decode php format in website or there easier way? mysql's default format dates yyyy-mm-dd ( iso 8601 ). if work dates in format can use mysql's default sorting order them you.

ruby - Don't create view folder on rails generate controller -

this trivial question, i'm curious: is there way usual generators config turn off creation of view folders , action templates when run rails generate controller ? i can't find option anywhere , code here doesn't show me pointers. we going building our own controller / resource generators @ point anyway, our api, curious if there way turn off annoyance in meantime. it's not documented feature, try add --skip-template-engine (alias --no-template-engine ) option command. rails generate controller foo bar --skip-template-engine demo on dummy app: rails g controller my_controller index show --no-template-engine create app/controllers/my_controller_controller.rb route "my_controller/show" route "my_controller/index" invoke test_unit create test/functional/my_controller_controller_test.rb invoke helper create app/helpers/my_controller_helper.rb invoke test_unit

How to tag a person to a photo on a facebook Page? -

i'm trying tag person photo has been posted facebook page (not profile). https://graph.facebook.com/{photo_id}/tags?to={person_id}&access_token={access_token} the above works if photo_id 1 has been posted profile, however, if use id of photo posted page get www-authenticate: oauth "facebook platform" "invalid_request" "(#322) invalid photo tag subject" i've tried using authenticated user's access token page access token (as documentation states) both produce same error response. i'm using following scopes publish_stream,photo_upload,manage_pages,user_photos is possible? if so, in world doing wrong? you need user_photos permission tag photo, guess cannot work page!

javascript - Smoother filtering of ng-repeat in AngularJS -

i have table , tr generated ng-repeat . when filter them (in case change page), rows replaced new ones. split second, see both old filtered rows (page 3 instance) , new filtered rows (say page 4). pretty ugly screws design tenth of second. is there way make transition seamless? had ng-repeat animated before (angularjs 1.2.0rc1), same thing happened (for longer though) , thought fixed disabling animations. unfortunately, didn't fix it. have ideas? [edit] this css used animations, before disabling it .animate.ng-enter { -webkit-animation: enter_sequence 0.2s linear; /* safari/chrome */ -moz-animation: enter_sequence 0.2s linear; /* firefox */ -o-animation: enter_sequence 0.2s linear; /* opera */ animation: enter_sequence 0.2s linear; /* ie10+ , future browsers */ } @-webkit-keyframes enter_sequence { { opacity:0;} { opacity:1;} } @-moz-keyframes enter_sequence { { opacity:0;} { opacity:1;} } @-o-keyframes enter_sequence { { opacity:0;} { opacity:1;}

asp.net mvc 4 - MVC 4 Razor If splitting div tags -

i have following mvc 4 razor code: @for (int = 1; <= 100; i++) { if (currentcol == 1) { html.raw("<div class=row>"); @*need because can't have open div within if compiler doesnt *@ } if (currentcol == maxcol) { html.raw("</div>"); } currentcol++; } i trying generate contents of every div class row conditionally start , end tags in different paths of if statements. when use straight html, compiler doesn't , thinks brackets off. seems html.raw solution searches online, when use html.raw , div doesn't show when view source. does know what's going on? try prefixing html.raw calls @ : @for (int = 1; <= 100; i++) { if (currentcol == 1) { @html.raw("<div class=row>"); } if (currentcol == maxcol) { @html.raw("</div>"); } currentcol++; }

python - Optimize leastsq execution order -

i found weird thing problem. put whole file here replacing previous one. import pandas pd import numpy np option_pricer import bs_call, r_input scipy.optimize import leastsq ## function returns error vector def res_bs(p): sigma = p err = np.zeros(len(k)) in range(len(k)): err[i] = (calleu[i]-bs_call(sigma, r[i], t[i]/360, s[i], k[i] ))/sqrt(len(k)) return err ## function returns root mean squared error def rmse_bs(p): return sqrt(sum(res_bs(p)**2)) ## function converts raw data variables used def params_in(options): k = options.strk_prc k = pd.np.array(k) t = options.tmy t = pd.np.array(t) s = options.undl_prc s = pd.np.array(s) calleu = options.eur_call_prc calleu = pd.np.array(calleu) callam = options.ame_call_prc callam = pd.np.array(callam) r1 = unique(options.r1) r1 = pd.np.array(r1) r2 = unique(options.r2) r2 = pd.np.array(r2)

asp.net - Format of the initialization string does not conform to specification starting at index 0 visual web developer -

i have read several of responses error , have tried of them without success. here have in web.config file: <connectionstrings> <add name="srm_metricconnectionstring" connectionstring="data source=c3srmsql01t;initial catalog=srm_metric;persist security info=true;user id=**;password=**" providername="system.data.sqlclient" /> </connectionstrings> here call in aspx.cs: private void bindgridview() { // connection string web.config. // when use using statement, // don't need explicitly dispose object in code, // using statement takes care of it. using (sqlconnection conn = new sqlconnection("srm_metricconnectionstring")) { // create dataset object. dataset dsanno = new dataset(); in of responses sqlconnection(configurationmanager.connectionstrings["testdataconnectionstring"].tostring()); seems format. w

javascript - With CasperJs, how to print log in the DOM environment? -

i new casperjs. have code , wondered how log messages getlog function. var casper = require('casper').create({ verbose: true, loglevel: "debug" }); function getlog() { console.log('inside getlog'); return 111; } casper.start('http://google.fr/', function () { this.log('page loaded', 'info'); }); casper.then(function() { this.log('calling getlog', 'debug'); value = this.evaluate(getlog); this.log('value = ' + value, 'info'); }); casper.run(); the function getlog() got called because got info message 'value = 111'. not able message 'inside getlog' printed out on console. thx! just add right after initialize casper casper.on('remote.message', function(msg) { this.echo(msg); });

infosphere spl - Datastage.. I have a field which has the value say 59.0900..I want to convert it to 05909 -

i have field has value 59.0900..i want convert 05909 can me that..im working on datastage ibm infosphere convert field string trim trailing zeros , decimal point convert decimal or integer

c# - Repeater Inside ModalPopup extender -

i having repeater displayed inside modal popup extender,i able bind values , works fine,but when popup showing up,it doesn't show repeater. here code: <div id="dummy" runat="server"> </div> <ajaxtoolkit:modalpopupextender runat="server" id="mpeoir" targetcontrolid="dummy" popupcontrolid="pnloir_view" dropshadow="true" cancelcontrolid="btn_modal_cancel" /> <asp:panel id="pnloir_view" runat="server" backcolor="whitesmoke" height="600px" width="600px" style="display: none"> <div class="titl-bg" style="width: 580px;"> <div class="cont-title" style="width: 580px;"> list of oir created </div> </div> <div id="rpt"> <table cellpadding="0" cellspacing="0"> <asp:rep

ios - Phonegap Camera Api won't work (failed to load resource) -

i'm using phonegap version 3. i installed cordova , phonegap, reason console shows phonegap.js , cordova.js fail load. not in js folder either thought pretty weird, phonegap has worked me, until today when tried use camera api function. ran plugin install commands camera , added config.xml file: <feature name="camera"> <param name="ios-package" value="cdvcamera" /> </feature> but camera not work in ios emulator nor work on web browser. in web console i'm getting these errors. failed load resource: requested url not found on server: file:///users/thomas/dev/myapp/www/cordova.js and when click on of buttons error typeerror: 'undefined' not object (evaluating 'navigator.camera.getpicture') here code: (copied straight phonegap website) <!doctype html> <html> <head> <title>capture photo</title> <script type="text/javascript" charset="utf-

Identifying the last item in a JavaScript object or associative array -

i'm putting javascript that'll pulling in multiple json files data used in graphs. ultimately, need identify when i've reached absolute end of associative array being processed in $.each() loop (jquery involved) in order trigger next json file. i've bumped various solutions one-tiered object...but multi-tiered object? how last row in last column know it's last? here's example json i'm working with: { "network":{ "hardware":262464, "software":53016, "internal personnel":440202, "external personnel":188658, "outside services":1344100, "facilities , overhead":16172, "other":92588, "total":2397200 }, "wide area network":{ "hardware":75600, "software":18900, "internal personnel":132300, "external personnel":56

javascript - issues with changing color of google map api markers -

i've looked @ suggestions asked questions similar mine, following google maps api developers info page on overlays, no answers have helped - i'm trying change color of markers standard green, every time try , add fillcolor, etc. code either won't show marker or won't show map @ all. have idea i'm doing wrong? function createmap() { // map options var options = { zoom: 4, center: new google.maps.latlng(39.909736, -98.522109), // centered maptypeid: google.maps.maptypeid.roadmap, maptypecontrol: false }; // init map map = new google.maps.map(document.getelementbyid('map_canvas'), options); } function addmarker() { fetchnewquote(); var indext; (indext = 0; indext <array.length; ++indext) { splitarr = array[indext].split(":"); geosplit = splitarr[1].split(", "); if (indext < 50) { $('

Netty, SSL and memory usage -

i stress testing netty 4.0.4 project loosely based on securechat example. when connect 15k clients server see using 800mb of memory! i've been tweaking can lower since i'll need support 100k clients. test, removed ssl handler , memory usage fell on 200mb. par course? there way reuse sslengine or sslhander or must both instantiated each channel? an sslengine specific single channel. it's not sslengines taking memory, it's sslsessions , associated secrets, keys, certificates, etc.

sql - Microsoft Access can't represent the join expression -

i received error mentioned in title, , access query not open in design view. checked sql statement reserved characters, can't seem find any. leaves me stumped, , input (or explanation) helpful! the sql query follows: select dbo_rep_profile.crd_number, dbo_contact.first_name, dbo_contact.middle_name , dbo_contact.last_name, dbo_rep_alias.firm_id, dbo_rep_alias.office_id , dbo_rep_alias.trade_rep, dbo_contact_address.address_line_1 , dbo_contact_address.address_line_2, dbo_rep_alias.contact_id , dbo_rep_alias.primary_yn, dbo_contact.business_phone , dbo_contact.email_address [salespage reps] ((dbo_contact inner join dbo_rep_alias on dbo_contact.contact_id=dbo_rep_alias.contact_id) inner join dbo_rep_profile on dbo_rep_alias.contact_id=dbo_rep_profile.contact_id) inner join dbo_contact_address on (dbo_contact.contact_id=dbo_contact_address.contact_id) , (dbo_contact_address.contact_address_id=dbo_contact.address_1_id) (((dbo_rep_profile.crd_number) not null) , ((dbo_rep

c++ - Function Matching for parameters of type const T& and T -

Image
i have question regarding c++ function matching parameters of types t , const t& . let's have following 2 functions: void f(int i) {} void f(const int &ri) {} if call f argument of type const int call of course ambiguous. why call of f argument of type int ambiguous? wouldn't first version of f exact match , second 1 worse match, because int argument must converted const int ? const int ci = 0; int = 0; f(ci); // of course ambiguous f(i); // why ambiguous? i know such kind of overloading doesn't make sense, because calls of f ambiguous unless parameter type t doesn't have accessible copy constructor. i'm studying rules of function matching. regards, kevin edit: make question more clear. if have 2 functions: void f(int *pi) {} void f(const int *pi) {} then following call not ambiguous: int = 0; f(&i); // not ambiguous, first version f(int*) chosen although both versions of f called &i first version chosen, because sec

postgresql - Deg Min Secs in database -

what best data format store in database gps position this: 38°57'33.804" 95°15'55.739" i can't convert other formats. db: pozstgrsql 9.4 did check postgis? it's made dat this

css - How can i change the position of an image in Jquery? -

Image
i have image this: and want change position in jquery on hover make the image changing. i dont want use .animate function shift image but, have image scroll each frame. right have width set, , overflow hidden can see 1 image @ time. my html <ul class="icons"> <li id="trasklogo"><img src="img/icons/nav-se1aec3ccea.png" width="75" height="823" /></li> <li><img src="img/icons/sprite_about.png" width="1050" height="70" /></li> <li><img src="img/icons/sprite_genetics.png" width="1050" height="70" /></li> <li><img src="img/icons/sprite_innovation.png" width="1050" height="70" /></li> <li><img src="img/icons/sprite_media.png" width="1050&qu

oracle10g - PHP Drop Down List Populated By Oracle Database Rows -

i'm getting empty drop down list while trying populate values oracle 10g website. the drop down list appears, there no values inside of it. have error reporting on, not getting errors. can point out error? <tr> <td>unit list</td> <td> <select name="unit"> <?php $conn = oci_connect("user", "password", "db"); $sql = 'select organization_name organization@something'; $stid = oci_parse($conn, $sql); while ($row = oci_fetch_array($stid, oci_return_nulls+oci_assoc)) { echo "<option value=\"unit1\">" . $row['organization_name'] . "</option>"; } ?> </select> </td> </tr> you're not executing query, after parsing query need execute before fetching results, function need oci_exe

Oracle SQL - Comparing Multiple Rows with Dates -

i'm working in oracle sql. suppose have table lists following. table purchaseid custid location date 1 1 8/23/2013 12:00:00 2 1 b 8/15/2013 12:00:00 3 2 5/15/2013 12:00:00 4 2 b 1/01/2005 12:00:00 5 3 1/15/2001 12:00:00 6 3 1/30/2001 12:00:00 7 3 b 8/23/2013 12:00:00 8 4 5/05/2012 12:00:00 9 4 b 8/15/2010 12:00:00 10 4 9/20/2008 12:00:00 i'm trying write query compares purchases customer output every instance particular customer makes purchase @ 2 different locations within 2 years of each other. i'm getting particularly tripped on custid=3 , custid=4 type cases, there difficult combinations of location/date. output of

Html disconnected nodes -

this jquery migration guide mentions disconnected nodes. meaning of disconnected node in html ? that means dom node not "connected" actual document. in other words, dom node or subtree created or parsed, did not append document itself.

c++ - gcc with -isysroot creates include path that starts with equal sign "=" and compile fails -

i cross-compiling using codesourcery toolchain arm (arm-none-linux-gnueabi). use -isysroot point @ /usr/include folder on rootfs folder, run trouble when compiling. have verified include folder accessible. below gcc call , output. of output removed because don't think relevant. the preprocessor comes include path correct except "=" character starts with, , indicates path not exist. fails find header files. how can make work? willem@jacta:~/projects/button/debug$ arm-none-linux-gnueabi-gcc -isysroot=/home/willem/projects/rootfs -nostdinc -i=/usr/include -o0 -g3 -wall -c -fmessage-length=0 -v -o src/smd/button/button.o ../src/smd/button/button.c -h using built-in specs. target: arm-none-linux-gnueabi configured with: [ ... stuff omitted ... ] thread model: posix gcc version 4.4.1 (sourcery g++ lite 2010q1-202) collect_gcc_options='-isysroot=/home/willem/projects/rootfs' '-nostdinc' '-i' '=/usr/include' '-o0' '-g3'

ios - Will Apple reject my application if it does not run on an iPad 1? -

i'm beginner programmer , have universal application works on iphone , ipad ios 6.0 , up. however, has features cannot run on ipad 1 because device can upgrade ios 5.1.1. whenever run on ipad 5.1 simulator, application crashes. not problem since expect that. will apple reject application since not run on ipad 1? there other ipad applications leave out ipad 1's? of course not! obviously, apple thinks ipad 1 owners should buy new ipads. :) btw, should check out apple's page on approval process , approval guidelines information on looking in app submission.

Where to place API key for Google Geocoding API? -

we use google geocoding api map address latitude , longitude. here sample url encoding (which returns json) - http://maps.googleapis.com/maps/api/geocode/json?address=dallas&sensor=false message: over_query_limit ok, makes sense, because exceed on 2500 daily limit place api key - http://maps.googleapis.com/maps/api/geocode/json?key=xxxxx&address=dallas&sensor=false message: request_denied i'm wondering where/how place api key. looks in version 3 need pass clientid in url , not key in free version: https://developers.google.com/maps/articles/v2tov3#newkey so url should like: http://maps.googleapis.com/maps/api/geocode/json?client=xxxxx&address=dallas&sensor=false not lucky enough have paid account cannot test - think on correct path. relevant link: https://developers.google.com/maps/documentation/business/webservices/ client id you must include client id in api requests. client id identifies maps api business custo

javascript - Ajax using jquery works on IE but not Firefox -

my end goal have home page pulls rss feeds , displays them on home page personal website. done client side , i'm not looking build server site script (i though if no other way possible). below page load code. (i don't think problem area nice see starting point) $(document).ready(function () { // here loadpagef(); //<- problems in function getbackground(document.body); //this messes css of site }); function loadpagef() { addtablefeed("http://www.npr.org/rss/rss.php?id=1001"); addtablefeed("http://news.yahoo.com/rss/odd"); addtablefeed("http://www.nfl.com/rss/rsslanding?searchstring=team&abbr=dal"); addtablefeed("http://www.npr.org/rss/rss.php?id=1007"); $(".mainarea").css("width",$("iframe").length * (270)); } //this function sets rss data place after formatting function addtablefeed(feedlink) { var numofcell = maintb.getelementsbytagname("iframe"

java - Android Application with Database remote -

i developing application in information stored in remote database, applications have been local data using sqlite, wonder more feasible in relation performance of crud application. shaping dao seek , record information using webservice , json response? or use jdbc?

git - How to skip "Hit return to start merge resolution tool" and open mergetool automatically -

git asking hit return button open mergetool each conflict file 1 one: > git mergetool normal merge conflict '...': {local}: modified file {remote}: modified file hit return start merge resolution tool (opendiff): how can avoid hitting return step project , open configured merge tool automatically? use -y flag. documentation : -y --no-prompt don’t prompt before each invocation of merge resolution program.

android - Why my ListView inside a Fragment doesn't get updated? -

i have listview inside fragment: public class editorfragment extends sherlockfragment { private edittext editor = null; private listview lv = null; private edittext et = null; private file root = null; private string[] nomi={"test1","test2"}; private arrayadapter<string> aa; @override public view oncreateview(layoutinflater inflater, viewgroup parent, bundle savedinstancestate) { sethasoptionsmenu(true); view result = inflater.inflate(r.layout.editor, parent, false); editor = (edittext) result.findviewbyid(r.id.editor); lv = (listview) result.findviewbyid(r.id.list); root = getactivity().getexternalfilesdir(null); aa = new arrayadapter<string>(getactivity(), android.r.layout.simple_list_item_1, nomi ); lv.setadapter(aa); return (result); } when user clicks button on actionbar following method gets called. since contains notifydatasetchanged() ex

amazon web services - AWS PHP SDK - The instance ID 'i-xxxxxxx' does not exist -

i use php awssdk , cannot stop instance. i can list of instances , parse data. instance in list, when try stop "the instance id xxxx not exist. win2008 server. tia discovered needed set the region host name if server not in default zone. $ec2->set_hostname($info->region_endpoint); then starting/stopping worked without errors $instanceaction = $ec2->stop_instances($instanceid) ;

how to add text to an email I'm forwarding using python/outlook without breaking original formatting? -

i'm trying open email add text , forward using python windows extensions. this have: import win32com.client outlook = win32com.client.dispatch("outlook.application").getnamespace("mapi") inbox = outlook.getdefaultfolder(6).folders('subfolder') messages = inbox.items message = messages.getlast() newmsg = message.forward() newmsg.to = "email@email.com" #i want forward address newmsg.body = "new text"+newmsg.body when copy front of email doing this: newmsg.body = "new text"+newmsg.body, breaks hyperlinks in original message , removes original formatting. there anyway keep original formatting(bolded/colored words/hyperlinks) , add new text? in outlook object model, body property of [ mailitem ] represents "the clear-text body of outlook item". there's separate rtfbody property represents "the body of microsoft outlook item in rich text format." if rewrite either 1 of these, re-

c# - Open file with tabs -

here's code opening new file: private void opentoolstripmenuitem_click(object sender, eventargs e) { openfiledialog openfd = new openfiledialog(); string chosen_file = ""; openfd.initialdirectory = "c:"; openfd.title = "open text file"; openfd.filename = ""; openfd.filter = "text files|*.txt|word documents|*.doc"; if (openfd.showdialog() != dialogresult.cancel) { chosen_file = openfd.filename; getrichtextbox().loadfile(chosen_file, richtextboxstreamtype.plaintext); } i'm using tabs also. can open files when have tab opened. how can set open new tab file? works when open tab , open file. you have add new tabpage tabcontrol before loading file (the way in code): tabpage tab = new tabpage(){text = system.io.path.getfilename(chosen_file)}; tabcontrol1.tabpages.add(tab); tabcontrol1.selectedtab = tab; richtextbox rich = new richtextbox{parent = tab, dock =

subquery - MySql: Calculate a value based on multiple sub-queries -

i have query calculates value based on several sub-queries. sub-queries based on specific timestamp. calculate value records many different timestamps. can't quite figure out how it. the basic formula (s11s4createsessionreqrcvd - s11s4createsessionrespaccsent) * 100 / s11s4createsessionrespaccsent select ((((select ref_data test.sgw_s5s11 timestamp = "2013-08-21 00:00:06" , ref_type = "s11s4createsessionreqrcvd" ) - (select ref_data test.sgw_s5s11 timestamp = "2013-08-21 00:00:06" , ref_type = "s11s4createsessionrespaccsent")) * 100) / (select ref_data test.sgw_s5s11 timestamp = "2013-08-21 00:00:06" , ref_type = "s11s4createsessionreqrcvd")) mycalc i don't know how paste in table here's sample of data in csv format here's sample of data. (i don't know how put table in here it's in csv format) mykey,timestamp,ref_type,ref_data 1016101,"2013-08-21 00:00:06",s5s8createsessionre

windows - Watch drive or folder for writes/changes? -

i application informed when file copied, created/written to, deleted, moved, etc. i'd on drive or folders. how do on windows? your first port of call should filesystemwatcher class . you tell folders want watch, , want watch - creations, deletions, changes, etc. be warned however, in time takes event raised , handled application contents of folder may have changed again should use event guide something has happened interested in , check contents of folder make sure process things correctly. another thing bear in mind that, pointed out in this blog , file created event fired @ start of creation process, not end. means if have large file need able either wait created or cope partial file.

android - Reusing bitmaps for BitmapFactory.decodeFile and BitmapFactory.Options.inBitmap -

my app decodes lot of bitmaps sd card, want reuse existing bitmaps decrease gc work. see examples android training , this video , works perfect bitmapfactory.decoderesource , not bitmapfactory.decodefile . use next code: private void testbitmapreusing() { bitmapfactory.options options = newoptions(); bitmap bitmap = decode(options); options.inbitmap = bitmap; bitmap = decode(options); } private bitmapfactory.options newoptions() { bitmapfactory.options options = new bitmapfactory.options(); options.insamplesize = 1; options.inmutable = true; return options; } private bitmap decode(bitmapfactory.options options) { return bitmapfactory.decodefile("/mnt/sdcard/sun.jpg", options); // return bitmapfactory.decoderesource(getresources(), r.drawable.sun, options); } commented code ( bitmapfactory.decoderesource ) works expected, decodes new bitmap using existing bitmap.

ios - Sectioned table view indexpath issue -

i have table view controller states listed in alphabetical sections. clicking on state returns detailed information state via web service call. first attempt @ sectioned or grouped table view , having trouble index path on rows past 'a'. for instance, if click on 'california' first item in 'c' group, indexpath.row property 0 instead of 4, which, since ca fifth state in alphabetical order, should have indexpath.row of 4. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; //get letter in current section nsstring *letter = [stateindex objectatindex:[indexpath section]]; //get states beginning letter nspredicate *predicate = [nspredicate predicatewithformat:@"self beginswith[c] %@", letter]; nsarray *states

Access to assets android -

i'd access access in android class. i know can use getassets i'm working on util class not activity can't access context. i can add param in constructor or setter not proper il there solution access assets in util class ? thanks edit: file file = new file("file:///"); string[] list = file.list(); for(int = 0; i<list.length; i++){ system.out.println(list[i]); } but list null you can use file:///android_asset/assetname.extension refers asset. create file path above asset.

How sum grouped in Cuda -

i know techniques apply add dimensions of array , save new vet lower in following example: a -> [1,2], [3,4], [5,6] b -> [3], [7], [11] figure: http://snag.gy/83qwl.jpg if want write own cuda kernel, take @ vector add sample . instead of passing 2 input vectors kernel, pass a , provide loop sum on "rows" of a : __global__ void mykernel(int *a, int *b, int rows, int cols){ int idx=threadidx.x+blockdim.x*blockidx.x; if (idx < rows) { int sum = 0; (int i=0; i< cols; i++) sum += a[(idx*cols)+i]; b[idx] = sum; } } this won't terribly efficient, can improve efficiency if can store a array in column major order: a -> [1,3,5], [2,4,6] then modification above kernel becomes pretty efficient: __global__ void mykernel(int *a, int *b, int rows, int cols){ int idx=threadidx.x+blockdim.x*blockidx.x; if (idx < rows) { int sum = 0; (int i=0; i< cols; i++) sum += a[(i*cols)+idx]; b[i

iphone - Unwind ViewController -

i trying unwind view controller when user clicks cell. error unrecognized selector sent instance ... 2 nslogs inserted not show when click cell, crashes error. here code prepareforsegue method - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nsstring *pointspath = [[nsstring alloc] initwithformat:@"totalpoints"]; nsstring *primarypath = [[nsstring alloc] initwithformat:@"type"]; int primarytype = [[nsuserdefaults standarduserdefaults]integerforkey:primarypath]; int totalpoints = [[nsuserdefaults standarduserdefaults]integerforkey:pointspath]; [[nsuserdefaults standarduserdefaults] setinteger:1 forkey:@"classtype"]; if([sender row] == 0) { nslog(@"chose 0"); if(primarytype > 0) { [[nsuserdefaults standarduserdefaults]setinteger:0 forkey:primarypath]; int newpoints = totalpoints - 1; [[nsuserdefaults standarduserdefaults]setinteger:newpoints forkey:pointspath]; [[nsuserde

php - Mod_Rewrite Apache Remove 2 Files -

i making social network companies intranet. have been able utilize htaccess remove index.php file url, however, there "profile.php" file allow user pull users profile. there way use .htaccess , mod_rewrite remove both index.php, , profile.php? this current htaccess file: rewriteengine on rewritecond $1 !^(index\.php|css|images|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [l] again, want able remove profile.php index.php. edit: running on cpanel's latest version on centos server. since no 1 answered on week, did roundabout way. redirected 404 requests 1 profile.php excluding existing files , directories. i removed profile.php, since index.php listed directoryindex. upon completion, profile.php located profile , displayed necessary information.

python - Use a module installed by another user -

i'm running python script on remote machine , asks pyfits , technically installed on machine, python doesn't find it. i've tried adding supposed directory it's installed in paths (i have access folder too) sys.path.append('folder') method. still doesn't find it. here's thought process illustrate: the user installed modules has source @ "/otheruser/code/pyfits" i've tried adding folder or folder pyfits , init file (that have access to) in it, without success. so main questions are: should looking elsewhere module? should install modules again --myuser? or should mess site-packages? if 1 add module there? according pyfits documentation, looks actual modules installed in lib/python or possibly lib/python<version>/site-packages (depending on flags used install) under top-level pyfits install directory. so, you'd want this: sys.path.append(r'/otheruser/code/pyfits/lib/python') # might sys.path.ap

parsing - Python timestamp for pcap files -

i new python, , came across code parsed through pcap file. problem code contained line datetime.datetime.now() use print out time stamp connections in file, prints out times stamp of when accessed. want print out original time stamps connections in file. for example, if used code parse through pcap file now, first connection have time stamp of august 23, 2013 9:04 (or specific gets). file has original time stamp of july 3, 2008 3:05 (which want print out). i wondering if knew simple python solution or other appreciated. edit i looking time stamp packets in file not time stamp file itself.

iphone - How to identify a "hw.machine" identifier reliable? -

i'm looking official source complete/maintain method: -(nsstring*)platformstring { nsstring *platform = [self platform]; if ([platform isequaltostring:@"iphone1,1"]) return @"iphone 1g"; if ([platform isequaltostring:@"iphone1,2"]) return @"iphone 3g"; if ([platform isequaltostring:@"iphone2,1"]) return @"iphone 3gs"; if ([platform isequaltostring:@"iphone3,1"]) return @"iphone 4"; if ([platform isequaltostring:@"iphone3,2"]) return @"iphone 4 (other carrier)"; if ([platform isequaltostring:@"iphone3,3"]) return @"iphone 4 cdma"; if ([platform isequaltostring:@"iphone4,1"]) return @"iphone 4s"; if ([platform isequaltostring:@"iphone5,1"]) return @"iphone 5"; if ([platform isequaltostring:@"ipod1,1"]) return @"ipod touch 1g";

grails - Better approach to solving filters than if/else -

in list method passing several filters client side. have long list of if/else blocks executed based on params coming in. i'm wondering if there better way approach this? def list () { println params def list = [] if (params["column1"] != null) { list = mymodel.createcriteria().listdistinct { eq("somecolumn", params["column1"]); } } else if (params["column2"] != null) { list = mymodel.createcriteria().list { eq("someothercolumn", params["column2"]); } } else if (params["filter"] == "failed") { list = mymodel.createcriteria().list { eq("status", false); } } return list json } below params i'm getting few of requests: [column1:somevalue, action:[get:list], controller:somecontroller] [somecolumn:someothervalue, action:[get:list], controller:somecontroller] is there pattern can use solve problem before gets out of han

c - What aspects of signed left shift are undefined with GCC? -

basically asking translation of: gcc not use latitude given in c99 treat aspects of signed `<<' undefined, subject change. ( gcc 4.8.1 manual, paragraph 4.5 ) what 'latitude' given? aspects? other answers have pointed out aspects of << undefined behavior. guess want "translation" of gcc common language. if behavior undefined c standard, compiler implementors can take "latitude" suits them if such case occurs. in particular, don't have implement diagnostic or detection of case, , may pretend never happens. responsability of programmer write program such behavior defined. in case of left shift, means compiler not have check overflow , can pretend loop like for (int = 1; > 0; <<= a) { .... change in complicated way ... } would never terminate. the sentence citing indicates don't such thing, yet, future versions of gcc might so.

ios - coredata metaData fetch error -

in ios app, in statement nsdictionary *x = [nspersistentstorecoordinator metadataforpersistentstoreoftype:nssqlitestoretype url:<url> error:&error]; i getting following error , x nil: "sqlite error code:3850, 'not error' errno:9" what mean? it #define sqlite_interrupt 9 /* operation terminated sqlite3_interrupt()*/ ( source )

Facebook and Android sdk -

i want share image, on phone's sd card, on facebook. my problem after run application can see following message myapplication access public profile , friend list. but when press ok , go facebook page can not see images there. i following instructions on this link , code below public class photoactivity extends basefragmentactivity { private static final string mime_type = "image/jpeg"; private uri uri; private imageview mphotoview; private session.statuscallback mstatuscallback = new sessionstatuscallback(); private boolean mposttowall = false; private imagebutton retakebtn; private class sessionstatuscallback implements session.statuscallback { @override public void call(session session, sessionstate state, exception exception) { if (session.isopened() && mposttowall) { share(); } } } @override public void onstart() {