Posts

Showing posts from April, 2012

ios4 - Launch Settings from app? -

anyone know if it's feasible launch 'settings' app app? google maps when don't have location services enabled , try locate yourself. i've seen lots of folks post , answers point adding bug in radar. in wild, know of 2 apps show dialog ""turn on location services allow [app] determine location" along side cancel , settings buttons 'settings' button take general settings. 1) facebook app version 3.3.2 runs on ios 3.1.3 shows alert on start. looked @ three20 source code in git-hub project not full source of app more of library app's components. 2) groupme shows same alert when adding current location new message. you mean settings of app see in settings? first create settings.bundle in xcode>newfile>settings.bundle. create prop lists can edit out of settings.app or app self. exact code google can lot further can. if have specific questions; don't hesitate ask.

php - Encoding from a textarea tag -

suppose in form, type within textarea character "ぎ" at momment of submit text , send page process (i.e. action="site.php" ): page send text encode text? or page recieve text? the point is: form send characters encoded(sequences of bytes) or characters encoded page recieve text form. is page encoded again when going sended form? cuz text typed not part of source code encoded. you'll want utf8 encode that look @ utf8_encode() , utf8_decode() you'll want multibyte-safe functions

CVS Checkout Problem -

i set cvs repository on server. then used eclipse sync repository local computer, using ext ( not extssh ). updates/commits eclipse work fine. however, when try commit or update using tortoise cvs, following error - cvs [checkout aborted]: end of file server (consult above messages if any). could tell me how solve issue? make sure paths set correctly. 1 thing learned hard way eclipse though added .jar files eclipse, when ran outside of eclipse, failed miserably because classpath variables not set correctly. i'm not sure if experiencing similar issue, may perhaps. i dig around bit , see if can find else in meantime.

Rails 3 - Potential Race Condition? -

i have simple rails 3 application users can reserve 1 of finite number of homogeneous items particular day. i'm trying avoid race condition 2 people reserve last item available on particular day. model (simplified) follows: class reservation < activerecord::base belongs_to :user attr_accessible :date max_things_available = 20 validate :check_things_available def check_things_available unless things_available? errors[:base] << "no things available" end def things_available? reservation.find_all_by_date(date).count < max_things_available end end the reservation being created in controller via current_user.reservations.build(params[:reservation]) it feels there better way this, can't quite put finger on is. on how prevent race condition appreciated. not sure answers question, might point towards solution: http://webcache.googleusercontent.com/search?q=cache:http://barelyenough.org/blog/2007/11/act

c# - HyperLink field in Gridview (Url Navigation) -

at work there gridview , has following syntax <asp:hyperlinkfield datanavigateurlfields="nameid" datanavigateurlformatstring="names.aspx?nameid={0}" datatextfield="name" headertext="client name" sortexpression="name" itemstyle-width="100px" itemstyle-wrap="true" /> so added line datanavigateurlformatstring... link showing address looks this http://.....clients/clientnames/names.aspx?nameid=123 this gridview in clientsnames folder.. want use names.aspx of maintenance folder... want url redirect this httpl//....clients/maintenance/names.aspx?nameid=123 i tried add datanavigateurlformatstring="maintenance/names.aspx?nameid={0}" instead create url this http://......clients/clientnames/mainteanance/names.aspx?nameid=123 how can make url looks grid view? http://.....clients/maintenance/names.aspx?nameid=123 thank you try setting datanavigat

real time - windows c++ and possibility of a microsecond sleep -

is there anyway @ in windows environment sleep ~1 microsecond? after researching , reading many threads , various websites, have not been able see possible. since scheduler appears limiting factor , operates @ 1 millisecond level, believe can't done without going real time os. it may not portable, , i've not used these functions myself, might possible use information in high-resolution timer section of link , block: queryperformancecounter

.net - SimpleGeo - Obtaining the Longitude and Latitude from response -

i have following response in json format, but, can't seem figure out how obtain logitude , latitude it i tried dim result = jsonconvert.deserializeobject(of dictionary(of string, object))(response.content) but when try obtain an item key "address"...i nothing here json response {"query":{"latitude":37.779278,"longitude":-122.416582,"address":"san francisco, ca"},"timestamp":1311197030.697,"features":[{"handle":"sg_4or6cqyuxzveotm8nclk80_37.780722_-122.417364","name":"06075012400","license":"http://creativecommons.org/publicdomain/mark/1.0/","bounds":[-122.421050,37.775147,-122.413365,37.784657],"href":"http://api.simplegeo.com/1.0/features/sg_4or6cqyuxzveotm8nclk80_37.780722_-122.417364.json","abbr":null,"classifiers":[{"category":"us census","type

actionscript 3 - Flash CS5 compiler options broken? -

(haven't received love on adobe forums, trying here) so, i've formally logged bug against adobe i've been beating head against wall trying understand why won't work, i'm hoping it's perhaps within flash ide i'm setting incorrectly (or not setting @ all) causing issue i'm encountering: i've created container .fla uses classes defined in externally loaded swc, child.swc. i've added .swc in container's library path (publish settings > 3.0 settings > library path) , have set "link type" "exernal". according adobe's docs : "external: code resources found in path not added published swf file, compiler verifies in locations specified." however, when using flashdevelop's swf browsing utility after publishing fla (and having used reference class in container class), see class definition still being added container.swf. now, if use compc , mxmlc appropriate options (-link-report , -load-

encryption - CRAM-MD5 Implementation -

i'm looking @ implementing cram-md5 authentication imap , smtp server. problem cram seems require clear text password available @ times. server sends client unique challenge , client returns: md5( md5(password, challenge), md5( password ) ) i can't see way check without having clear text password, specification doesn't has have 1 available seems logical. the solution can come encrypt (properly encrypt, not hash) password database (probably using rsa key based aes, have deal that) , decrypt when need compare, seems slow way around though need decrypting , hashing every single login on smtp , imap. is best solution / efficient solution? or, better, cram out-of-date because less secure authentication on wire secured ssl now? the trick need unfinalized md5 of password same intermediate state of md5 context before finalizing. md5_ctx ctx; md5init(&ctx); md5update(&ctx, password, length); if , store value of ctx hashed , 1 can use copies of in

In javascript, what are the trade-offs for defining a function inline versus passing it as a reference? -

so, let's have large set of elements want attach event listeners. e.g. table want each row turn red when clicked. so question of these fastest, , uses least memory. understand it's (usually) tradeoff, know best options each. using table example, let's there's list of row elements, "rowlist": option 1: for(var r in rowlist){ rowlist[r].onclick = function(){ this.style.backgroundcolor = "red" }; } my gut feeling fastest, since there 1 less pointer call, memory intensive, since each rowlist have own copy of function, might serious if onclick function large. option 2: function turnred(){ this.style.backgroundcolor = "red"; } for(var r in rowlist){ rowlist[r].onclick = turnred; } i'm guessing going teensy bit slower 1 above (oh no, 1 more pointer dereference!) lot less memory intensive, since browser needs keep track of 1 copy of function. option 3: var turnred = function(){ this.style.backgroundco

javascript - How to: Swap options with jQuery while using jQuery UI -

i've been trying find way swap option values between them while using jquery ui. made simple fiddle swap options works when i'm not using jquery ui. working fiddle without jquery ui loaded on options: http://jsfiddle.net/mbmrp/ working fiddle with jquery ui loaded on options: http://jsfiddle.net/fuuyq/ thanks alot you'll need distroy selectmenu , rebind check out fiddle $('select').selectmenu(); $('.swap a').click(function() { var opt1 = $(this).parent().prev('.forms').find('option'); var opt2 = $(this).parent().next('.forms').find('option'); // remove them dom. opt1.detach(); opt2.detach(); // , put them back. $(this).parent().prev('.forms').find('select').append(opt2); $(this).parent().next('.forms').find('select').append(opt1); $('select').selectmenu('destroy').selectmenu(); });

c# - How to model a non-standard relationship in EDMX? -

i'm trying model non-standard relationship using .net entity framework 4 consumption on restful wcf data service. consider following simplified data structure metadata stored in single table, may associated different entities stored in different tables (identified type column) metadata table -------------- id fk_id type value -- ---- ----- ----- 1 100 product foo 2 101 product foo 3 101 service bar 4 102 service bar product table ------------- id name -- ---- 100 101 b 102 c 103 d service table ------------- id name -- ---- 100 w 101 x 102 y 103 z the problem facing want create property product.list<metadata> for product object , service object. since not associated single fk single table don't know how can model relationship in edmx file. my end goal able call method on wcf data service, , return json response has

c++ - In shared library's constructor (_init section), how to know what function is interrupted? -

on x86 linux, process a.exe invokes dlopen() load shared library b.so. in b.so, there's constructor, wants know function in process a.exe interrupted right before dlopen() invoked. how can constructor (_init section) in b.so know? if understand question correctly (the 'interrupting' might misleading), application has several locations might call dlopen() , want know of these locations called. first of all, smells wrong, because shared library should not supposed make assumptions loading it. if so, instance not run application in valgrind, because in case valgrind loading instead of standard dynamic linker , results might screwed. second, if need ( why? ), might take backtrace in constructor function. search upwards until find dlopen() , on next higher stack frame find function called dlopen. edit: map addresses in stack trace functions, need debug info of involved binaries or other way map function addresses symbol names.

javascript - how to describe or highlight certain points in charts and give hyperlink on that points -

i using protovis charts....i kind of new here... want want show area charts . , in want show few points different color or highlight point...and when click on point want open new page or show panel on same page...any idea how protovis? if not possible protovis can suggest other framework that? i think you're looking this: vis.add(pv.area) .data(data) .left(function(d) x(d.x)) .height(function(d) y(d.y)) .anchor("top").add(pv.dot) .size(20) .event("click", function (d) alert("clicked point " + this.index)); the important part .event("click", function (d) some_code()) bit. if you're using pure javascript, .event("click", function (d) { return some_code(); }) . here's working (albeit sloppy) example. you might want note protovis being superseded mike bostock's d3 .

ios - Xcodebuild: library not found for subproject -

i've been fighting 1 while , i've brought myself asking question. in xcode4 have project subproject, , subproject has series of products made top level project needs run. when compiling project using build, run, achieve or using xcode4, code runs fine , built correctly. however, when using xcodebuild build fails, have been able subproject build adding targets top level project's target dependencies, hower following error: ld: library not found -lsubproject has run before? thank you. basically fixed converting project use workspaces , setting various header search settings , configuring same build directories each workspace.

ASP.NET MVC get header -

what efficient way headers in asp.net mvc basically, trying approach validate youtube url: check if youtube , vimeo-clips valid basically, link talks using get_headers in php validate youtube url. the problem using c#.net (asp.net mvc) not php. how should efficiently header? i'm assuming want server-side , use httpwebrequest . accepted answer on why httpwebrequest return 400 bad request? should started. essentially, you'll want verify request succeeds , check relevant headers. if want headers, set method head instead of get .

.net - An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll -

i'm working in windows project (done long time visual studio 2003 .net 1.03**). when try run forms getting strange error: an unhandled exception of type 'system.reflection.targetinvocationexception' occurred in mscorlib.dll additional information: exception has been thrown target of invocation. the inner exception this: unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.web.services.protocols.soapexception: server unable process request. --> value either large or small uint16. @ system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse response, stream responsestream) @ system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters) @ sabre.sabrerts.ui.forms.organizationservice.organizationservice.getworkcentre() in f:\tenddevnew\ui\forms\web references\organizationservice\reference.cs:line 928 @

Controller in Kohana 3 does not appear to work, but has in the background -

my client finding when hit delete nothing happens, if it again error that 'id' doesn't exist anymore. i find hard believe because it's leaving page , being redirected post. the link in view: <h4>current logo image <span class='del'> (<?= html::anchor("playlist/imgdelete/$playlist->id/$logo->type", 'delete'); ?>) </span></h4> the controller process: public function action_imgdelete($id, $type) { db::delete('images')->where('playlist_id', '=', $id) ->where('type', '=', $type)->execute(); message::success('image deleted'); request::current()->redirect("playlist/edit/$id"); } does know how can possible? this due double chokehold cache between kohana , browser of choice. the delete action have occurred, because of aggressiveness, cache of page not show change. hitting again invalid

html - CSS: 2nd iframe won't render -

only iframe1 rendered. iframe2 hidden. wanted iframe2 start @ lower border of iframe1 , fill rest of page. (live example: http://flippa.com/auctions/2627927/site ) <style type="text/css"> #iframe1 { position: fixed; width: 100%; height:100px; margin:0px; z-index:2; } #iframe2 { position: fixed; width: 100%; margin:0px; top:100px; z-index:3; } </style> <body> <iframe src="http://www.google.com" id="iframe1" scrolling="no" frameborder="0"><iframe/> <iframe src="http://www.yahoo.com" id="iframe2" scrolling="no" frameborder="0"> </iframe> </body> is problem first iframe has closing tag this: <iframe/> instead of this: </iframe>

c# - How to Randomly Set Initial Index Declaratively or in Code? -

i have dropdownlist , want randomly set selected index @ pageload. can done declaratively in aspx file? if so, how? if not, how do in pageload() in c#? thanks. no idea how in aspx... on pageload this: mydropdownlist.selectedindex = new system.random().next (mydropdownlist.items.count);

iphone - Ignoring Local Notification when device is off -

i need local notification. when device active can tap "ok", , "action" buttons, when device turned off, can slide unlock iphone, automaticly app behave i've tap "action" button. knows how can put there "ok" button, in system alarm clock. i hope know the doc says that, "if notification alert , user taps action button (or, if device locked, drags open action slider), application launched". and, doesn't talk other option change behavior. tried change couldn't find way. feel there no way other stick that.

python - NumPy: use 2D index array from argmin in a 3D slice -

i'm trying index large 3d arrays using 2d array of indicies argmin (or related argmax, etc. functions). here example data: import numpy np shape3d = (16, 500, 335) shapelen = reduce(lambda x, y: x*y, shape3d) # 3d array of [random] source integers intcube = np.random.uniform(2, 50, shapelen).astype('i').reshape(shape3d) # 2d array of indices of minimum value along first axis minax0 = intcube.argmin(axis=0) # 3d array i'd use indices minax0 othercube = np.zeros(shape3d) # 2d array of [random] values i'd assign in othercube some2d = np.empty(shape3d[1:]) at point, both 3d arrays have same shape, while minax0 array has shape (500, 335). i'd assign values 2d array some2d 3d array othercube using minax0 index position of first dimension. i'm trying, doesn't work: othercube[minax0] = some2d # or othercube[minax0,:] = some2d throws error: valueerror: dimensions large in fancy indexing note: i'm using, not numpythonic: for r

inheritance - Why do we use Base classes in Java -

while doing desing/framework usual practice have base class value objects, services, daos etc. example if create new vo, extends basevo. if create new dao, should extend basedao. reason why have such base class? inheritance, encapsulation , polymorphism, 1 of 3 primary characteristics of object-oriented programming. inheritance (inheriting base class) enables create new classes reuse, extend, , modify behavior defined in other classes. it easy add common methods , properties base class. that's not correct way cases. design patterns (like strategy pattern ) uses above mentioned oop concepts real designing.

mediaelement.js - mediaelement js - show poster and play icon when finished playing -

i'd poster play icon show when video has finished playing. did try achieve yet? yes, tried myself project client wanted poster image come when video had completed. here's code: jquery("video").mediaelementplayer({ features: ["playpause","progress","current","duration","volume","fullscreen"], success: function (mediaelement, domobject) { mediaelement.addeventlistener("ended", function(e){ // revert poster image when ended var $thismediaelement = (mediaelement.id) ? jquery("#"+mediaelement.id) : jquery(mediaelement); $thismediaelement.parents(".mejs-inner").find(".mejs-poster").show(); }); } }); the mediaelement player instantiated in usual way. i've added 'success' function listen "ended" event, takes our mediaelement object

c# - Why a Static Constructors do not have any parameters -

as per msdn: a static constructor not take access modifiers or have parameters. a static constructor called automatically initialize class before first instance created or static members referenced. a static constructor cannot called directly. can 1 please explain why static constructor can not have parameters. as msdn says, a static constructor called automatically initialize class before first instance created . therefore can't send parameters. if clr must call static constructor how know parameters pass it?

c# - Clickable row in GridView and edit the row -

i have problem here regarding editable gridview. want replacing edit button function using single clickable row. when click row, should forwarding me new page editing row data. how can achieve this, without using edit button? protected void gridview1_rowcreated(object sender, gridviewroweventargs e) { // apply changes if datarow if (e.row.rowtype == datacontrolrowtype.datarow) { // when mouse on row, save original color new attribute, , change highlight yellow color e.row.attributes.add("onmouseover", "this.originalstyle=this.style.backgroundcolor;this.style.backgroundcolor='#eeff00'"); // when mouse leaves row, change bg color original value e.row.attributes.add("onmouseout", "this.style.backgroundcolor=this.originalstyle;"); } } protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrow

Linux: simulating/masking user ownership upon mount of 'external' partitions? -

this problem: have partition on ubuntu system, let's call myhdrive , not automounted upon boot (so use disk mounter applet, or nautilus mount manually). when mounted, listing partition looks in ubuntu: $ ls -la /media/myhdrive/ total 5743740 drwxr-xr-x 8 myusername myusername 4096 2011-07-21 08:19 . drwxr-xr-x 4 root root 4096 2011-07-21 04:13 .. -rw-r--r-- 1 myusername myusername 98520 2011-07-21 08:19 file1.txt -rw-r--r-- 1 myusername myusername 3463 2011-07-21 08:19 file2.txt now, let's shutdown ubuntu os - , boot, let's say, opensuse usb key on same machine. myhdrive partition again not automounted, , have mount manually (again file manager there). thing is, when mounted under opensuse, same drive displays following listing: $ ls -la /media/myhdrive/ total 5743740 drwxr-xr-x 8 1000 1000 4096 2011-07-21 08:19 . drwxr-xr-x 4 0 0 4096 2011-07-21 04:13 .. -rw-r--r-- 1 1000 1000 98520 2011-07-2

c# - sharepoint : Add existing site column to existing content type Programatically -

var objweb = properties.feature.parent spweb; spcontenttype contenttype = objweb.contenttypes["wiki page"]; if (!contenttype.fields.containsfield("keywords")) { spfield field = objweb.fields["keywords"]; spfieldlink fieldlink = new spfieldlink(field); contenttype.fieldlinks.add(fieldlink); contenttype.update(true); } i use code in feature activation add site column "keyword" site content type "wiki page" problem "keyword" add in "wiki page" not existing site column it's add new site column. there problem in code? one other thing code works fine on moss server when deploy on office365 problem found you should try code below: if (objweb.isrootweb) { spcontenttype contenttype = objweb.contenttypes["wiki page"]; if (!contenttype.fields.containsfield("keywords")) { spfield field = objweb.fields["keywords"]; spfieldlink fi

asp.net - Convert date time format from dd/MM/yyyy to MM/dd/yyyy -

possible duplicate: convert dd-mm-yyyy mm/dd/yyyyy in c# i want convert date time format dd/mm/yyyy mm/dd/yyyy in c# is there suggestion how that? please try: string oldstr = "03/12/2011"; string strdate = datetime.parseexact(oldstr, "dd/mm/yyyy",null).tostring("mm/dd/yyyy"); console.writeline(strdate);

android - define Bitmap bytes count and set limit to bitmap buffer -

in application have image viewer , getting bitmaps web server. in order increase performance of app, have buffer of bitmaps. max size of 1 bitmap can 0.5mb. have buffersize variable want store buffer bytes count , therefore need know each bitmap size going add in buffer.and if bites count exceed x number delete bitmap front of buffer. , here problems: i don't know how define bitmap bytes count i need suggestion x number . thanks in advance. you can number of bytes in bitmap using getbytecount() method. depends on how memory app using, how many images retrieving web server, , how need display them. use fraction of system.maxmemory(). in case

sqlite - Android Database creation error. -

Image
i have written create database code;i error/androidruntime(7193): @ com.android.xont.db.databasehelper.createdatabase(databasehelper.java:43) this code : public class databasehelper extends sqliteopenhelper { private static string db_path = "/data/data/com.android.xont.controller/databases/"; private static string db_name = "demouserventura_hema.db"; private sqlitedatabase demouserventura_hema; private final context mycontext; private databasehelper mydbhelper; public databasehelper(context context) { super(context, db_name, null, 1); this.mycontext = context; } /** * creates empty database on system , rewrites own * database. **/ public void createdatabase() throws ioexception { boolean dbexist = checkdatabase(); if (dbexist) { } else { this.getreadabledatabase().close(); //this.getreadabledatabase().getpath(); //system.out.println( " ===== " + this.getreadabledatabase().getpath(

android - SQLite Database Problem while delete -

hi new android. using sqlite database in application meanwhile written queries using + delete tablename value = + value; this query string delete_query = "delete " + tablename + " title = '" + title + "'"; database.execsql(delete_query); i want write query using placeholder ?. tried database.delete(tablename, title + "?" , new string[] {title}); instead "?" tried (?)/('?')/'?' giving me error.... can 1 tell me how write appropriate query using ?..... thanks in advance. mahaveer make sure have put equal sign:- database.delete(tablename, title + "=?" , new string[] {title});

javascript - Displaying nested HTML ul list in columns -

i have autogenerated nested list structure, so <ul> <li>aaa</li> <li>bbb <ul> <li>111 <ul> <li>xxx</li> </ul> </li> <li>222</li> </ul> </li> <li>ccc</li> ...etc... </ul> i want layout in columns so: aaa 111 xxx bbb 222 ccc using jquery , few css tags, it's relatively easy create navigation style menu. e.g. select bbb first column, makes children appear in second column. other second level depth uls hidden. what's leaving me stuck how style list in first place put depths columns. can add tags each ul or li show depth. if use relative positioning , move each column left, column 1 leave vertical gap each of entries have been moved across. absolute positioning works, doesn't seem neat. better ideas? using recursive functions can quite straight-forward: http://jsfiddle.net/u

java - Joining to a collection in a JPA-QL query -

i'am using jpa mapping ,i have entity class @entity @table(name = "h_pe") @xmlrootelement @namedqueries({ public class hpe implements serializable { private static final long serialversionuid = 1l; @embeddedid protected hpepk hpepk; @column(name = "pe_timeout") private integer petimeout; @column(name = "pe_status") private boolean pestatus; @onetomany(cascade = cascadetype.all, mappedby = "hpe") private collection<hpesp> hpespcollection; @joincolumn(name = "pe_env", referencedcolumnname = "env_url", insertable = false, updatable = false) @manytoone(optional = false) private henv henv; @joincolumn(name = "pe_platform", referencedcolumnname = "platform_name", insertable = false, updatable = false) @manytoone(optional = false) private hplatform hplatform; } i want write request jpa following(i have wrote sql ),i have tried write haven't understood how use pe_env because r

java - How can I store enums with fixed values in play -

i'm trying convert grails-project playframework. in grails can define id the id stored in database (see enhanced enum support in release notes ). saw similar question , no acceptable solution. if change type crud-module problem, because information enum should shown lost. so wonder if there exists nice solution play, based on hibernate. perhaps hacking jpaplugin? [update 1] started try second solution @type -annotation. unfortunately become broken hibernate 3.6 (which used play 1.2.2). typefactory.basic() not available more. following documentation can't find work around. [update 2] there solution hibernate 3.6.1, it's clumsy define type @ each usage of enum. @type(type="hibernatehelper.genericenumusertype", parameters= { @parameter( name = "enumclass", value = "models.geschlecht"), }) public geschlecht geschlecht = geschlecht.weiblich

C# - Data Type for value 0.5 -

i have calculation example 2/4 = 0.5, except can't find data type store value! every time make calculation says 0. anyone have suggestions? either double or decimal work fine. however, if write: // wrong double x = 2 / 4; then still use integer division - because both of operands division operator of type int . you can either cast either or both of operands double, or use double literal either or both of them: // of these... double x = (double) 2 / 4; double x = 2 / (double) 4; double x = (double) 2 / (double) 4; double x = 2.0 / 4; double x = 2 / 4.0; double x = 2.0 / 4.0; double x = 2d / 4; double x = 2 / 4d; double x = 2d / 4d; note both double , decimal floating point types. don't represent arbitrary rational numbers (fractions). example, neither can accurately represent 1/3. if need rational number type, you'll have write own or third party implementation.

regex - URL rewriting for images with different domains -

i want use urls followings : http://mydomain.com/320x200/server/path/to/my/image.jpg where can find 3 parameters retrieve rewriting : 320x200 : optional parameter, can 2 numbers (like "320x200"), or single number (like "320x") or empty (only "x") server : required (this specific parameter find server image hosted, not matter case) path/to/my/image.jpg : required and rewrite domain followings : http://myotherdomain.com/320/200/server/path/to/my/image.jpg i tried following rewrite rules not working : rewriterule ^([0-9]+)x([0-9]+)/([a-za-z0-9]+)/([a-za-z0-9/.]+)$ htp://myotherdomain.com/$1/$2/$3/$4 [l] rewriterule ^([0-9]+)x/([a-za-z0-9]+)/([a-za-z0-9/.]+)$ htp://myotherdomain.com/$1/$2/$3 [l] rewriterule ^x/([a-za-z0-9]+)/([a-za-z0-9/.]+)$ htp://myotherdomain.com/$1/$2 [l] why not working ? the 3 regex working when tested through website regexplanet.com i tried clear browser cache, restart apache, remove cookies, ... st

.net - SqlDataReader.GetSqlBinary vs SqlDataReader.GetSqlBytes? -

under namespace system.data.sqlclient , have both sqldatareader.getsqlbinary , sqldatareader.getsqlbytes . both seems give "raw data". if so, what's difference between them? the getsqlbytes stored in inside buffer more manipulation, binary stream , use is. this 2 return sqlbytes , sqlbinary , see 2 types can see full different of them , how store data. http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.storage.aspx http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.aspx

SQLite record read in iPhone -

i getting different value (in case of unicode value) should suppose be. here explanation: storing value 'îî' , when run select command terminal (connected .sqlite file) able see the exact value. when trying fetch value programmatically seeing complete different value. code reading , storing value in char pointer. generally, should utf-8. can try different encoding ascii,macroman etc. [nsstring stringwithcstring:st encoding:nsutf8stringencoding] note: can verify unicode value printing value in console.

android - Reading LightSensor from LG P990 -

i trying develop light sensor app lg p990 detect laser (don't ask why). the code looks this: package soma.de.light; import android.app.activity; import android.content.context; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; public class lightsensoractivity extends activity { sensormanager mysensormanager; sensor mylightsensor; textview textlightsensordata; textview textlightsensor; button start; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textlightsensor = (textview)findviewbyid(r.id.tvlight); textlightsensordata = (textview)findviewbyid(r.id.tvacc); mysensormanager = (sensormanager)getsystemservice(context.sensor_serv

How to pass variable from JSP/Jboss to Apache -

i'm running apache on webservers , jboss on appservers, using mod_jk integration. want run jsp , return flag (variable) apache. how this? tia, vitaly ajp13 not support this, these referenced future enhancements in ajpv13 extensions proposal seem you're looking for: quote: context information passed servlet engine web server. part of configuration of jk, web server connector, indicate web server uri handle. mod_jk jkmount directive, told web server uri must forwarded servlet engine. servlet engine allready knows uri handle , tc 3.3 allready capable generate config file jk list of available contexts. state update of contexts servlet engine web server. big site farm of tomcat, isp , virtuals hosters, may need stop context admin purposes. in case front web server must know context down, relay request tomcat

hibernate generator increment confict with table auto increment -

i set generator 'increment' in hbm file, , put auto_increment thing in database table also. creteria showing issue .... this both thing conflicting ? ? yes conflicting, makes no sense.. when using hibernate built-in generator 'increment', it's hibernate generate identifiers counting maximum primary key value @ startup, not safe in multi jvm , using database auto_increment it's database generate unique identity new rows. in mysql db, if using auto_increment should use identity in mapping let database safely generate unique identity. from hibernate documentation increment generates identifiers of type long, short or int unique when no other process inserting data same table. not use in cluster. identity supports identity columns in db2, mysql, ms sql server, sybase , hypersonicsql. returned identifier of type long, short or int. more information hibernate doc section 5.1.4.1. generator my sql auto_increment docume

c# - Problem with ImageField in GridView -

i've got gridview loads data datatable. 1 of columns in datatable called 'icon', , stores small icons .png files. must noted fields generated @ run-time. what i've done able load images in gridview, i've created imagefield through format wizard on gridview, , i've selected 'icon' field datatable dataimageurlfield. images load in manually generated new column, 'icon' column of datatable still displayed in gridview. whenever try hiding column, imagefield column hidden too. what can display imagefield column? thanks set autogeneratecolumns="false" gridview.

php - Problem displaying query results -

Image
i have mysql table set using phpmyadmin can view in images below: and here populated table: the problem have when issue following query, no results returned. struggling work out why. <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = 'root'; $db_database = 'bbg_db_2'; $dbc = mysql_connect($db_host,$db_user,$db_pass); $sdb = mysql_select_db($db_database); $query = "select category_name, category_desc categories"; $result = mysql_query($sdb, $dbc, $query) or die (mysql_error($dbc)); while ($row = mysql_fetch_array($result)) { $catname = $row["category_name"]; $catdesc = $row["category_desc"]; echo "<li>$catname</br><span>$catdesc</span></a></li>"; } ?> when issue query no error messages , no results displayed. trying list of these categories descriptions. ideas? your parameters mysql_query wrong. results of mysql

java - JNLP + proxy + downloading file via stream problem -

i'm writing application downloading csv file web , inserting data table in database. problem need setup proxy via system.setproperty("http.proxyhost", "http-proxy.domain.com"); , on. application works fine when i'm running on local system, problem when launch jnlp. @ first have had problems signing jars (i've managed it, somehow) , i'm facing problem, application running, not connect web - throws exception message "connection timeout: connect". jnlp file looks this: <?xml version="1.0" encoding="utf-8" standalone="no"?> <jnlp href="launch.jnlp" spec="1.0+"> <information> <title>testimporter</title> <vendor>hol</vendor> <homepage href=""/> <description>testimporter</description> <description kind="short">testimporter</description> </inform

c# - merging two lists<T> and compare -

possible duplicate: comparing 2 list<> emp_db_snapshot - loading db fresh copy of user have selected in past: emp_selected_by_user - user selected list, user may change selected or may add more list of may remove list: //let have 2 rows in list. list<employee> emp_db_snapshot = new list<employee>(); emp_db_snapshot = employeelistfromdb ; //loads list db //let have 2 rows in list. list<employee> emp_selected_by_user = new list<employee>(); emp_selected_by_user = myselectedemployee //loads list selected user. //merging 2 lists: //got total of 4 rows. list<employee> allemployee = emp_db_snapshot.union(emp_selected_by_user).tolist(); so question is: how can differentiate or compare ? i make attempt answer question. you make collection of differences between each collection if happen have of same data. var differenceslist = lista.where(x => !listb.any(x1 => x1.id == x.id)).union(listb.where(x => !lista.a

url rewriting - How to include Plus sign in mod rewrite. I need + sign in rewritten url -

i need use + character in url. i'm using apache php. ([a-za-z0-9/_%-@\+]*) doesn't work. what need www.domain.com/c++/ => index.php?category=c++ any appreciated. if url encoded, need escape + because "+" in url encoded equal space.

socket receive loop never returns -

i have loop reads socket in lua: socket = nmap.new_socket() socket:connect(host, port) socket:set_timeout(15000) socket:send(command) repeat response,data = socket:receive_buf("\n", true) output = output..data until data == nil basically, last line of data not contain "\n" character, never read socket. loop hangs , never completes. need return whenever "\n" delimeter not recognised. know way this? cheers updated include socket code update2 ok have got around initial problem of waiting "\n" character using "receive_bytes" method. new code: --socket set above repeat data = nil response,data = socket:receive_bytes(5000) output = output..data until data == nil return output this works , large complete block of data back. need reduce buffer size 5000 bytes, used in recursive function , memory usage high. i'm still having problems "until" condition however, , if reduce buffer size size r

sql server - is "NOT EXISTS" bad SQL practice? -

in sql server, using "not exists" in queries considered bad practice , i've heard microsoft code reviews test not exists , flag these warnings. why not exists considered bad practice , join operators preferred on not exists? given that: any reasonably query optimizer able convert between “not exists”, “exists” , "joins", there no performance difference these days. “not exists” can easier read joins. therefore don’t consider “not exists” bad practice in general case.

playframework - Bind a Date in milliseconds representation -

i need bind date using milliseconds representation in controller (i.e. milliseconds 01.01.1970). tried using @as("s") had no success, fails value @ least 1000. there no way without writing custom binder? edit: seems writing custom binder way go because play's datebinder uses simpledateformat , because of this bug . simpledateformat doesn't accept these kinds of formats. afaik there's no way, because binder trying parse expecting date fields (and date millisec field 3 digit), , not calculate anything. it's better bind millisecs long , create date it.

List all index names, column names and its table name of a PostgreSQL database -

what query list index names, column name , table name of postgresql database? i have tried list of indexes in db using query how list of indexes, column names , table names? select * pg_class, pg_index pg_class.oid = pg_index.indexrelid , pg_class.oid in ( select indexrelid pg_index, pg_class pg_class.oid=pg_index.indrelid , indisunique != 't' , indisprimary != 't' , relname !~ '^pg_');` this output indexes details (extracted view definitions): select i.relname indname, i.relowner indowner, idx.indrelid::regclass, am.amname indam, idx.indkey, array( select pg_get_indexdef(idx.indexrelid, k + 1, true) generate_subscripts(idx.indkey, 1) k order k ) indkey_names, idx.indexprs not null indexprs, idx.indpred not null indpred pg_index idx join pg_class on i.oid = idx.indexrelid join pg_am on i.relam = am.oid; optionally add

c# - Linq to Entity - How to concatenate conditions -

i writing linq query. there way can concatenate query based on if conditions? like on query is res in _db.person res.departments.id == deptid select res; and if have condition true, like from res in _db.person res.departments.id == deptid && res.departments.type == depttype select res; assuming condition in variable condition from res in _db.person res.departments.id == deptid && (!condition || res.departments.type == depttype) select res; version or requested from res in _db.person res.departments.id == deptid || (condition && res.departments.type == depttype)) select res; alternatively may wish use predicate builder

linux - Launching authorization dialog while running one application -

in application need write files linux file system folder, requires super user access permission. so, how can invoke dialog current user have super user permission until write operation finishes. using glib related apis. regards, lenin you need use gksu or newer policykit . gksu library provides gtk+ frontend su , sudo. supports login shells , preserving environment when acting su frontend. useful menu items or other graphical programs need ask user's password run program user.

Is it possible to implement a small Disk OS in C or C++? -

i not trying such thing, wondering out of curiosity whether 1 implement "entire os" (not big linux or microsoft windows, more small dos-like operating system) in c and/or c++ using no or little assembly. by implementing os , mean making os scratch starting boot-loader , kernel graphics drivers (and optionally gui) in c or c++. have seen few low-level things done in c++ accessing low-level features through compiler. can done entire os? i not asking whether idea, asking whether remotely possible? obligatory link osdev wiki , describes of steps needed create os described on x86/x64. to answer question, gonna extremely difficult/unpleasant create boot loader , start protected mode without resorting @ least assembly, though can kept minimum (especially if you're not counting stuff using __asm__ ( "lidt %0\n" : : "m" (*idt) ); 'assembly'). a big hurdle (again on x86) processor starts in 16-bit real mode, need 16-bit code. acco

php - get info from 2 tables at once? -

i need info 2 tables in 1 query, searched on google , came joins? got code mysql_query("select code, url apilinks, links apilinks.code='$code' , links.code='$code'"); but doesn't seem work, outpus mysql error warning: mysql_num_rows(): supplied argument not valid mysql result resource in /home/codyl/public_html/projects/tests/tirl/code.php on line 18 i need have find url , code, in both links table , apilinks table, because url has variable, , 'apilinks' setup differently 'links' have same looking url has check both tables i don't think error sql query, anyway: your sql query generates cartesian product. every row in apilinks joined every row in links. want. need add join condition clause. from query, guess code column want join on. select links.code, url apilinks, links apilinks.code=links.code , links.code='$code' or using explicit join, may more obvious you: select links.code, url apilinks

objective c - Store global local time variables in the database in iphone -

i have been trying store global variables in form of nsdate seems gives error. trying grab current date @ start of application , store date once application finished in database. reason download current date: downloading data may take time , lose seconds in between. in appdelegate.h nsdate *today; @property (nonatomic, retain) nsdate *today; in appdelegate.m today = [nsdate date]; when view date today in view controller, stops functioning. in viewcontroller.m appdelegate *appdelegate= [[uiapplication sharedapplication] delegate]; [appdelegate today]; // error here what correct way in retrieving date variable delegate method? in code example looks redefining today. should not assigned today directly either way, need set property this. self.today = [nsdate date]; the reason because [nsdate date] autoreleased object , when use property retain you.

excel vba - Creating a column chart from dictionary values in VBA -

i need create column chart values have stored in dictionary (set dict = createobject("scripting.dictionary")) in vba. x-axis keys , y axis values. there way this? try this: public sub writedictionary() dim dict variant dim currrow integer set dict = createobject("scripting.dictionary") currrow = 1 dict.add "key 1", "data 1" dict.add "key 2", "data 2" each key in dict.keys range("a" & currrow).formula = key range("b" & currrow).formula = dict(key) currrow = currrow + 1 next key set dict = nothing end sub if find helpful, please accept.

iphone - How can i get the count of the files in a folder? -

this question has answer here: get count of files in directory 3 answers how can number of files in folder on ios? nsfilemanager *filemgr = [nsfilemanager defaultmanager]; nsarray *filelist= [filemgr directorycontentsatpath: yourpath]; int count = [filelist count]; nslog ("%i",count);

reporting services - Passing Parameters To report using url address -

i'm developing reports main page in dynamics ax, problem i've got connected ssrs. typical scenario have report , report b, need open report when clicking on report b. opening report correct, passing parameters more tricky. after research got point when want run report in browser using adress http://(server address)/reports/pages/report.aspx?itempath=/dynamics/reports.vendorsopentransactionscount.autodesign1&rs:command=render&vendopentrans_dataareaid=dor&vendopentrans_p1=2011-07-21&vendopentrans_p2=2011-07-21 and report displayed(main window) non of parameters validated proper textboxes, , changing value of them doesn't have impact. can here me "challenge" actually, believe critical difference whether passing parameters (via url) report using database engine or ssas - analytical engine data source. if data source analytical engine parameter should given in 'dimension format', rather in precise format, &parmname

iphone - How to reload UITableView step by step? -

i working on application , have show 10 records in table view 1 time if user want see more records user have click on "see more records" cell, user able see more records. if 1 know please give me solution. thanx this simple prototype of can do: -(nsinteger)numberofsectionsintableview:(uitableview *)tableview{ return 1; } -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ if ([self.tabledata count]>window) { return window+1; } else{ return [self.tabledata count]; } } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } if (indexpa

linux - What's optimal march & mtune options for gcc for "Pentium4 and above" processors -

my c++ application (compiled using g++) needs work on pentium-4 (32-bit) , above. however, it's typically used core2duo or better processors. i'm using: -march=pentium4 -mtune=pentium4 . reading has prompted me think -march=pentium4 -mtune=generic might better. can shed light on this? optimal values march & mtune options in case? platform: gcc 4.1.2 on rhel 5.3 (32-bit). that -march=pentium4 -mtune=core2 , can seen on gcc manual .

postgresql - Django AutoField not returning new primary_key -

we've got small problem django project we're working on , our postgresql database. the project we're working on site/db conversion php site django site. used inspect db generate models current php backend. it gave , added primary_key , unique equals true: class company(models.model): companyid = models.integerfield(primary_key=true,unique=true) ... ... that didn't seem working when got saving new company entry. return not-null constraint error, migrated autofield below: class company(models.model): companyid = models.autofield(primary_key=true) ... ... this saves company entry fine problem when do result = form.save() we can't result.pk or result.companyid to newly given primary key in database (yet can see has been given proper companyid in database. we @ loss happening. ideas or answers appreciated, thanks! i ran same thing, during django upgrade of project lot of history. pain... anyway, proble