Posts

Showing posts from July, 2013

dependency injection - Passing in the type of the declaring class for NLog using Autofac -

dependency injection - Passing in the type of the declaring class for NLog using Autofac - following on this question autofac inject type of declaring object constructor of nlog service, can correctly log type logging entries. my nlogservice class looks this... public class nlogservice : ilogservice { private readonly logger _logger; public nlogservice(type t) { var consumertype = t.declaringtype.fullname; _logger = logmanager.getlogger(consumertype); } however fails on app startup because cannot work out inject constructor of nlogservice next error... none of constructors found 'public binding flags' on type 'myproduct.domain.services.logging.nlogservice' can invoked available services , parameters: cannot resolve parameter 'system.type t' of constructor 'void .ctor(system.type)'. so, question - how instruct autofac inject type of calling class? i tried this... public nlogservice(ty...

javascript - Pass selected elements from jQuery UI Selectable to Rails controller -

javascript - Pass selected elements from jQuery UI Selectable to Rails controller - i using rails 3. map has , belongs many collection s, , vice-versa. what there ... i have form allows user select several maps go in collection. that, utilize jquery ui selectable method in grid. this how grid constructed: <ol id="selectable"> <% map in @user.maps %> <li class="ui-state-default"> <strong><%= map.title %></strong><br> <%= image_tag(map.thumbnail_url) %> </li> <% end %> </ol> it looks this: when user finished selecting, selected maps (their <li> tag) have class .ui-selected . what need ... how pass controller ids of selected maps in order add together them new collection? , should in controller? best practices here? what thought doing ... i've thought writing custom submit handler form, go through of li.ui-selected , somehow seek extract ...

android - Text viewed as HTML -

android - Text viewed as HTML - hey update previous question [android] showing edittext text in webview i got webview see text within edit text field displaying text coding im using case r.id.preview: intent j = new intent(this, preview.class); j.putextra(com.afajje.htmlzero.preview.url, myedittext.gettext().tostring()); startactivity(j); } homecoming false;} want im trying have view edit text, text html for illustration if set in edittext field <html> <head> </head> <body> <p>this preview</p> </body> </html> in web view itll just "this preview" here ya go, working demo: package com.stackexchange.test; import android.app.activity; import android.os.bundle; import android.text.html; import android.text.spanned; import android.widget.edittext; public class home extends activity { @override public void oncreate(bundle savedinstancestate...

C# string to integer conversion issue -

C# string to integer conversion issue - awhile ago, started making programme in vb.net. since i've lost code, , started using c#. have converted, except update scheme had gives me "cannot implicitly convert type 'string' 'int' streamreader". heres old code: seek dim build integer build = 3 dim url string url = "###link###" dim request system.net.httpwebrequest = system.net.httpwebrequest.create(url) dim response system.net.httpwebresponse = request.getresponse() dim sr system.io.streamreader = new system.io.streamreader(response.getresponsestream(), system.text.encoding.getencoding("windows-1252")) dim online integer online = sr.readtoend() if build >= online label10.visible = true else linklabel1.visible = true end if grab ex exception me.close() end seek here's code ...

mongodb - Best way query a database for nearby lat/longs? -

mongodb - Best way query a database for nearby lat/longs? - i have set or lat/longs stored in db. want query db , homecoming documents within range of lat/long. know how determine distance between 2 sets don't want have every entry in db. best way accomplish this? thanks much. perhaps utilize geospatial indexing accomplish this... if that's no good, built node.js addon perform nearest neighbour searches called node-kdtree. used find closest n points, , quick since wrapper underlying c library. sounds poor selection needs because have pull of info out of db first in order process it. limited info have, suggest seek using built-in functionality of mongodb first. database mongodb node.js geolocation geospatial

How to add a view on uinavigationcontroller covering navigation bar in iphone? -

How to add a view on uinavigationcontroller covering navigation bar in iphone? - i have navigation based application. want add together image covering entire screen. if add together on top of pushed view controller won't cover navigation bar. how solve it?. you should able utilize [self presentmodalviewcontroller: animated:]; wrapp uiimage uiviewcontroller , nowadays it. display in total screen. iphone uinavigationcontroller

How to do mobile app sync with cloud service like amazon (sqs/sns) or azure -

How to do mobile app sync with cloud service like amazon (sqs/sns) or azure - i want implement couple of mobile app (windows phone/ios/android) ideas. of them require getting user info updates on other grouping of devices. for example, 1 scenario not need immediate update sent group: let's family fellow member can track expenses in app. newly added expense automatically synced other family fellow member devices automatically (or manually when take sync). 2nd scenario requires immediate update sent group: let's consider cards games or in game scenario of blackjack, need notify players on table card did dealer open each of them. question: have started looking amazon sqs(queue), sns (notification) services. initial reading did not me conclusion yet. going read azure. what service(s) should help me accomplish above scenarios? sqs question: how sqs work? if read 1 item queue, guessing removed queue. so, if 1 device gets new expense added, other devices in fami...

Facebook comments plugin: sorting comments by default -

Facebook comments plugin: sorting comments by default - by default comments shown "social ranking". is possible set default value "reverse chronological"? the official docs social plugins not mention option... if using social plugin given fb, think there no such alternative available.. what u mean social ranking? if ready utilize fql can seek below suggestion. normally fb info rendered based on timestamps , if u want latest comments specific page, can utilize fql query desired results.. sample query http://www.facebook.com/restserver.php?format=json&pretty=1&method=fql.query& query=select post_fbid, fromid, object_id, text, time comment object_id in (select comments_fbid link_stat url ="http://developers.facebook.com/docs/reference/fql/comment/") order time desc facebook facebook-social-plugins

dll - Run framework 4.0 application without installing on client machine -

dll - Run framework 4.0 application without installing on client machine - is there way run windows application in client machine without installing .net framework 4.0? seek set "copy local" true on dll's doesn't work. thanks! .net 4.0 new version of clr, there isn't binary compatibility between assemblies compiles 4.0 vs. 3.5 , 2.0. in case of 3.5, re-create local because same clr 2.0...but alas, not 4.0. dll frameworks .net-4.0

How to do Silverlight overlay element -

How to do Silverlight overlay element - i starting larn sl... trying create mediaelement of size x, , on bottom of film frame subtitles run. unable understand if need absolute position or else. please advice thanks if need subtitle need set textblock under mediaelement on grid , need give verticalallignment property bottom on xaml. , on it. this; <grid> <mediaelement/> <textblock verticalallignment="bottom"/> </grid> you may refer grid layout relative positioning if you're new silverlight. , can give margin textblock or want take @ intellisense (if using vs) , you'll understand, if you're using look blend it'll lot easier ui. if want utilize absolute positioning you'll need utilize canvas instead of grid layout, same , can alter canvas no problem. in canvas, need utilize left , right properties instead of allignments. this; <canvas> <mediaelement/...

Swithing on the camera Flash light dynamically in android -

Swithing on the camera Flash light dynamically in android - all i doing barcode scanning app in android.in have turn on photographic camera flash lite dynamically , doing using next code mcamera = camera.open(); camera.parameters params = mcamera.getparameters(); params.setflashmode(camera.parameters.flash_mode_torch); mcamera.setparameters(params); mcamera.startpreview(); but showing exception like error/androidruntime(17291): java.lang.runtimeexception: fail connect photographic camera service at line mcamera = camera.open(); i think exception because of while scanning barcode photographic camera in open mode , here trying open photographic camera again. is there way turn on flash lite without open photographic camera 1 time again ? , how? you can reuse existing photographic camera object , setparameters on that. note not devices back upwards flash mode torch. some, fascinate/epic (who utilize flash mode on) cannot alter state w...

mod rewrite - Understanding Apache RewriteMap with RewriteLock -

mod rewrite - Understanding Apache RewriteMap with RewriteLock - i've taken on development of heavy-duty lamp application. original dev used .htaccess file rewritemap , php script handle conditions of app. specifically, when subdomain patterns requested client, rewritemap catches them , sends them appropriate application module. i'm quite comfortable typical mod_rewrite redirects, , think i've got basic rewritemap concept figured out; i'm struggling find decent documentation on how rewritelock works. according apache docs: this directive sets filename synchronization lockfile mod_rewrite needs communicate rewritemap programs. set lockfile local path (not on nfs-mounted device) when want utilize rewriting map-program. not required other types of rewriting maps. but still little vague me. whats exact purpose , function of rewritelock , how work? rewritelock used prg: keyword. rewritemap can used several keywords, utilize text files ( txt: ), has...

asp.net - Accessing SMTP Mail Settings from Web.Config File by using c# -

asp.net - Accessing SMTP Mail Settings from Web.Config File by using c# - need read smtp email settings defined under system.net section in web.config file. below 1 illustration of smtp email setting defined in web.config file: (under section) <system.net> <mailsettings> <smtp deliverymethod="network" from="testuser@domail.com"> <network defaultcredentials="true" host="localhost" port="25" username="user” password="testpassword"/> </smtp> </mailsettings> </system.net> how access smtp mail service setting using c# you can utilize webconfigurationmanager: configuration configurationfile = webconfigurationmanager.openwebconfiguration(request.applicationpath); mailsettingssectiongroup mailsettings = configurationfile.getsectiongroup("system.net/mailsettings") mailsettingssectiongroup; response.write(mailsettings.smtp.network.host); c# asp.n...

node.js - Link Unrolling Packages and Help -

node.js - Link Unrolling Packages and Help - i trying take shortened links or regular links , figure out next informatinon link pointing. title: description: image (thumbnail): embed.ly seems charge , wondering if there little bundle people have used this. server written in node.js node based solution best fit needs. node.js hyperlink

Xcode "Build and Archive" from command line -

Xcode "Build and Archive" from command line - xcode 3.2 provides awesome new feature under build menu, "build , archive" generates .ipa file suitable advertisement hoc distribution. can open organizer, go "archived applications," , "submit application itunesconnect." is there way utilize "build , archive" command line (as part of build script)? i'd assume xcodebuild involved somehow, man page doesn't seem this. update michael grinich requested clarification; here's can't command-line builds, features can xcode's organizer after "build , archive." you can click "share application..." share ipa beta testers. guillaume points out below, due xcode magic, ipa file not require separately distributed .mobileprovision file beta testers need install; that's magical. no command-line script can it. example, arrix's script (submitted may 1) not meet requirement. more importantly, a...

Problem about running php test case using Selenium RC -

Problem about running php test case using Selenium RC - i utilize mozilla firefox 4. can run php test case selenium rc, when run test case found next error every test case command line. .... failed start new browser session: java.lang.runtimeexception :firefox 3 not found in path. please add together directory containing " firefox.exe" path environment variable or explicitly specify path firefox 3 this *firefox3c:\blash\firefox.exe when write $this->setbrowser("*firefox /usr/bin/firefox"); // linux path of firefox file. but in windows $this->setbrowser("*firefox") // takes default path c:\program files\mozilla firefox if trying run on specific browser according versions have specify path of file firfox.exe stored. thanks. php selenium-rc

java - How export jars from library project to referencing projects in Eclipse? -

java - How export jars from library project to referencing projects in Eclipse? - several android projects utilize android library project. added jar (commons-lang.jar) library project. want export commons-lang.jar projects utilize library project. can't work without duplicating jar referencing projects. what did far: created folder named libs within library projects folder hierarchy. copied jar libs folder. added jar in eclipse "java build path" "add external jars..." library project. on "order , export" tab selected checkbox left of jar export it. on referencing project on "android" page "add" library project. it seems commans-lang jar not exported library project. need create libs folder on referencing project well, add together same jars build path of referencing project. after works apk contain external jar twice. what's wrong approach? should in addition? many in advance. i believe go eclipse >...

mysql - SQL Syntax using CONCAT -

mysql - SQL Syntax using CONCAT - i have table t1 fields id,key_id ,name,date etc.. id auto incrementing field key_id value obtained id prefix/id prefix constant rows , id changes id corresponding row.. it looks this $sql = " alter table t1 auto_increment = 1234567890, add together id bigint not null primary key auto_increment "; update t1 set key_id = concat('12.345','/',id) now due reasons want create new table t2 parent of t1 , id primary key t2 , key_id become primary key of t1. t2 should include other 2 fields key_id , name.. ok main reason parent table : might create table t3 have id , id should have different values t1 , t3 want maintain master table has id primary key , other kid tables fetch ids master table.. how can this? why want store redundant info in column "key_id"? since prefix constant, id enough. perform concatenation in code. also, way, can have id primary key both table...

regex - C# Regular Expression Input String Problem -

regex - C# Regular Expression Input String Problem - i have problem next program, compiles when run it says input string not in right format. assist. string path = @"c:/documents , settings/expn261/desktop/charactertest/output.xls"; string strcharater = file.readalltext(path,utf7encoding.utf7); strcharater = regex.replace(strcharater, "[èéèëêð]", "e"); strcharater = regex.replace(strcharater, "[ÉÈËÊ]", "e"); strcharater = regex.replace(strcharater, "[àâä]", "a"); strcharater = regex.replace(strcharater, "[ÀÁÂÃÄÅ]", "a"); strcharater = regex.replace(strcharater, "[àáâãäå]", "a"); strcharater = regex.replace(strcharater, "[ÙÚÛÜ]", "u"); strcharater = regex.replace(strcharater, "[ùúûüµ]", "u"); strcharater = regex.replace(strcharater, "[òóôõöø]...

asp.net mvc 3 - Using EF POCO with SQL Server Compact 4 -

asp.net mvc 3 - Using EF POCO with SQL Server Compact 4 - i developing application sql ce , ef poco 4. the next code context public class context : dbcontext { public dbset<boletimsemanal> boletinssemanais { get; set; } public context() : base("name=defaultconnection") { } } model public class boletimsemanal { [key] public int id { get; set; } public string name { get; set; } public datetime datecreated { get; set; } public datetime datemodified { get; set; } public int week { get; set; } public int year { get; set; } } controller public actionresult index() { iqueryable<boletimsemanal> boletins; using (var db = new context()) { var calinfo = datetimeformatinfo.currentinfo; var week = calinfo.calendar.getweekofyear(datetime.now, calinfo.calendarweekrule, calinfo.firstdayofweek); boletins = (from boletim in db.boletinssemanais bole...

jquery - Don't queue fadeTo(), fadeIn()/fadeOut() -

jquery - Don't queue fadeTo(), fadeIn()/fadeOut() - i have next animations: $('#id').animate({'margin-top': 100, 'margin-left': 100}, {queue: false, duration: 1000}); $('#id2').fadeto(1000, 1); this seems queuing, how can create sure fadeto() doesn't queue? try: $('#id2').stop().fadeto(1000, 1); jquery jquery-animate queuing

How to access the variables inside a class which has been called more than once as a tab in JTabbedPane (Java) -

How to access the variables inside a class which has been called more than once as a tab in JTabbedPane (Java) - i creating java app. i have 1 class q2a2 jpanel design shown follows: -img- suppose if item selected combo-box , "create account" button clicked. 1 tab added jtabbedpane. every item has mutual tab. did created 1 class , adding everytime on button click. class name q2a2_add. panel well. image follows... after having 3 items app looks like the code is: public void addclass(int a) { if(jtabbedpane1.gettabcount()<13) { //variable name of tabbedpane string s=(string) maincb.getitemat(a); //maincb variable name of main combobox int dont=0; for(int j=0;j<tabname.length;j++){ //just ensure 2 accounts should not same if(s.equals(tabname[j])){ dont=1; break; } } if(dont==0){ for(int j=0;j<12;j++) { if(index[j]==0){ q2a2_add ...

android - How to add a loading image to webview? -

android - How to add a loading image to webview? - i'm working webview in android app... everytime open url page blank , after while url content appears... how can add together loading image in webview during transition time?? tried phone call open twice, first time loading local content , next time real url wanted feed doesn't work, think wrong async calls. thanks in advance ^^ regards here's how i'm doing it. in main layout have spots webview , imageview. webview starts off 'gone' , loadingimage 'visible'. <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <imageview android:id="@+id/imageloading1" android:layout_height="wrap_content" android:layout_width="match_parent" android:visibility="visible" android:src="@drawable/loadingima...

ruby on rails - Devise + Omniauth - How to pass extra parameters along? -

ruby on rails - Devise + Omniauth - How to pass extra parameters along? - i have ability in app load /users/auth/facebook connect facebook. want able know request came from. whether user registering facebook, or existing user wants connect facebook. based on type, responses different. how can pass param along omniauth when authenticating. tried doing: /users/auth/facebook?connect_action=signup_connect_to_facebook but connect_action param didn't create when nail authenticationscontroller#create ideas? thansk you have utilize :params options, in omniauth_authorize_path(:user, :facebook, var: 'value', var2: 'value2' ) and later in callback can access request.env['omniauth.params'] hash! :) ruby-on-rails ruby-on-rails-3

php- changing text box's to already known values -

php- changing text box's to already known values - hey guys have chunk of code here takes 3 values , creates sub domains based off of entries. wondering how take thought of form , modify it. trying set in php variables text entry box's are. can expert reply , tell me how done? <form method="post" action="<?php echo network_admin_url('site-new.php?action=add-site'); ?>"> <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> <table class="form-table"> <tr class="form-field form-required"> <th scope="row"><?php _e( 'site address' ) ?></th> <td> <?php if ( is_subdomain_install() ) { ?> <input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'domain' ) ?>"/>.<?php echo preg_replac...

web services - WSS, Axis with Rampart problem with x.509 -

web services - WSS, Axis with Rampart problem with x.509 - i have service recieve x.509 in header authenticate it, 1 time client sent request message want header authentication rampart this <ramp:rampartconfig xmlns:ramp="http://ws.apache.org/rampart/policy" > <ramp:passwordcallbackclass>pe.gob.hndac.util.passwordcallbackhandler</ramp:passwordcallbackclass> <ramp:signaturecrypto> <ramp:crypto provider="org.apache.ws.security.components.crypto.merlin"> <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">jks</ramp:property> <ramp:property name="org.apache.ws.security.crypto.merlin.file">client.jks</ramp:property> <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">client</ramp:property> </ramp:crypto> </ramp:signaturecrypto> ...

android service is NullPointerException -

android service is NullPointerException - who can help me? why bindservice() on onresume() of activity create? how command create in date of bindservice()? please help solve below query. utilize bindservice() method after bindservice(), private testservice ts; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); system.out.println("serviceactivity oncreate()"); bindservice(new intent(this, testservice.class), conn, bind_auto_create); ts.setnum(0);//here throw nullpointerexception } private serviceconnection conn = new serviceconnection() { @override public void onservicedisconnected(componentname name) { } @override public void onserviceconnected(componentname name, ibinder service) { ts = ((mybinder)service).getservice(); } }; androidmanifest.xml <activity android:name=".serviceactivity" an...

apache - .htaccess modrewrite problem -

apache - .htaccess modrewrite problem - i have website on wordpress , have written plugin required seo friendly url stuck @ following http://domain.com/catalogue-category/1/ working fine when replace /1/ name of category http://domain.com/catalogue-category/seating/ not work @ , gives me 404 error. its working @ /catalogue-category/?cat=seating my apache rewrite rule rewriterule ^catalogue-category/^([^/]+)/$ /catalogue-category/?cat=$1 [l] i not in mod rewrite in php, please bear ignorance , treat me rookie. looking forwards hear gurus :) try: rewriterule ^catalogue-category/([^/]+)/$ /catalogue-category/?cat=$1 [l] you using caret ^ twice in regex pattern ( ^catalogue-category/^([^/]+)/$ ), caret asserts match should start of string. pattern explanations previous pattern: assert position @ origin of string «^» match characters “catalogue-category/” literally «catalogue-category/»assert position @ origin of string «^» match regular ...

Create user in SQL Server 2008 -

Create user in SQL Server 2008 - i have sql server user in database , reason, user not able view tables when connecting here commands using create user. not want create user dbuser owner of schema. create user dbuser login dbuser' --on specific database, using these commands. exec sp_addrolemember @rolename = 'db_datareader', @membername = 'dbuser' exec sp_addrolemember @rolename = 'db_datawriter', @membername = 'dbuser' grant select on schema :: [schema1] [dbuser] grant insert on schema :: [schema1] [dbuser] grant update on schema :: [schema1] [dbuser] grant execute on schema :: [schema1] [dbuser] grant select on schema :: [schema2] [dbuser] grant insert on schema :: [schema2] [dbuser] grant update on schema :: [schema2] [dbuser] grant execute on schema :: [schema2] [dbuser] even though granting insert , update access on schema.. user when logged in dbuser not able view of tables of schema. sees scheme tables tab when ...

php - How do I programmatically build, theme and display a Drupal block? -

php - How do I programmatically build, theme and display a Drupal block? - i want output built in drupal "search" block within of "primary links" menu, built theme function framework_primary_links() within template.php. menu should end looking stackoverflow menu: [chat | meta | | faq | __search__], "search" field within menu <ul> itself. so i'm not printing search block within part normal. currently i'm doing: $search_block = (object) module_invoke('search', 'block', 'view', 0); $output .= '<li id="searchcontainer">' . theme('block', $search_block) . '</li>'; but drupal applying "block.tpl.php" template , not "block-search.tpl.php" template want to. how drupal apply "block-search.tpl.php" template file programmatically rendered block? doing drupal_get_form('search_block_form') homecoming markup core search...

javascript - Why does my Date object in Google Apps Script return NaN -

javascript - Why does my Date object in Google Apps Script return NaN - does google apps script utilize funky version of ecmascript can't parse date? how can parse date 2011-04-11t19:25:40z javascript date object in google apps script? my log output below logs nan . function showdate(){ var d = date.parse("2011-04-11t19:25:40z"); logger.log(d); // <-- logs nan } edit: http://jsfiddle.net/utrym/ the format specified in section 15.9.1.15 yyyy-mm-ddthh:mm:ss.sssz maybe seek adding milliseconds date format in date.parse("2011-04-11t19:25:40.000z") . javascript date google-apps-script

jquery - Sending all of form scope to a CFC asynchronously -

jquery - Sending all of form scope to a CFC asynchronously - currently working on trying figure out asynchronous submission in coldfusion. have problem this. have form want submit remote chlorofluorocarbon , sort of response back. (eventually form going have draft function...) know how set each part: form , cfc. problem connecting them!!! there similar post this, none offer sufficient information....for me @ least. form: <cfform action = "/cfc/request.cfc?method=updaterequest" method = "post" name = "requestform" id = "requestform" enctype="multipart/form-data"> ........<!-- fields redacted --> </cfform> cfc method (this test): <cffunction name="updaterequest" access="remote" returntype="numeric"> <cfargument name="form" type="struct" required="yes"> <cfset var status = 0> <cfreturn status...

Android SDK MonkeyRunner broken? -

Android SDK MonkeyRunner broken? - i've been having troubles gettin monkeyrunner working. far, we've tried 3 different computers , every android device our hands on. the result same: com.android.monkeyrunner.monkeyrunnerstarter.main(monkeyrunnerstarter.java:203) 110715 16:59:55.819:s [main] [com.android.monkeyrunner.monkeyrunneroptions] script terminated due exception 110715 16:59:55.819:s [main] [com.android.monkeyrunner.monkeyrunneroptions]traceback (most recent phone call last): file "/users/lorinbeer/projects/phonegapminer/monkeyrun.py", line 10, in <module> device = monkeyrunner.waitforconnection() @ com.google.common.base.preconditions.checknotnull(preconditions.java:182) @ com.android.monkeyrunner.adb.adbmonkeydevice.<init>(adbmonkeydevice.java:68) @ com.android.monkeyrunner.adb.adbbackend.waitforconnection(adbbackend.java:100) @ com.android.monkeyrunner.monkeyrunner.waitforconnection(monkeyrunner.java:78) @ sun.reflect.nativemethodaccess...

debugging - What do the different columns in the "!heap -flt -s xxxx" windbg command represent -

debugging - What do the different columns in the "!heap -flt -s xxxx" windbg command represent - i've been doing work on high memory issues, , i've been doing lot of heap analysis in windbg, , curious different columns mean in "!heap -flt -s xxxx" command. i read what 'size' numbers mean in windbg !heap output?, , looked in "windows internals" book, still had bunch of questions. columns , questions below. **heap_entry** - pointer point to? how different userptr? **size** - size mean? how different usersize? **prev** - appears negative offset previous heap entry. still not sure how it's used. **flags** - there documentation on these flags? **userptr** - user pointer? in cases i've seen it's 8 bytes higher heap_entry, don't know points to. **usersize** - appears size of actual allocation. **state** - tells state of heap entry (free, busy, etc....) example: heap_entry size prev flags userptr usersize - state 001...

.htaccess - Remove www. in directory only -

.htaccess - Remove www. in directory only - i'm trying remove www. single directory called dir (for example). need able .htaccess file in directory. (i don't have root access.) thought how create work? rewriteengine on rewritecond %{http_host} ^www\.example\.com/dir$ [nc] rewriterule ^(.*)$ http://example.com/dir$1 [r=301,l] update—the solution: rewriteengine on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^(.*)$ http://%1/dir/$1 [r=301,l] the http_host not contain path beingness accessed need match in rewrite rule itself: rewriteengine on rewritecond %{http_host} ^www\.example\.com [nc] rewriterule ^dir\/(.*)$ http://example.com/dir/$1 [r=301,l] .htaccess redirect url-rewriting no-www

jpeg - PHP imagejpeg save file doesn't work -

jpeg - PHP imagejpeg save file doesn't work - i have php code trim white outer border , resize. when utilize imagejpeg($newimage) output browser works fine when seek save using imagejpeg($newimage, 'test.jpg') doesn't saved anywhere. help please? $im = imagecreatefromjpeg($src); $bg = imagecolorallocate($im,$rgb,$rgb,$rgb); // set header , output image. header('content-type: image/jpeg'); imagetrim($im,$bg); $width = imagesx($im); $height = imagesy($im); $newheight = $height * $newwidth/$width; $newimage = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($newimage, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //imagejpeg($newimage); //header('content-type: image/jpeg'); imagejpeg($newimage, 'test.jpg'); imagejpeg($newimage); imagedestroy($im); imagedestroy($newimage); just set reply in reply box problem file permissions not good. before writing file in php, not forget test place want save fil...

objective c - How to detect ambient sound level on the iPhone? -

objective c - How to detect ambient sound level on the iPhone? - i need create sound loudness (decibel) detector. clarify, not trying find volume @ iphone playing, instead volume of surrounding in decibels. how can this? use 1 of sound queue or sound unit apis record low latency audio, run samples through dsp filter weight spectrum particular type or color of loudness want measure, calibrate mic on particular models of ios devices want run detector on against calibrated sound sources, perhaps in anechoic chamber. iphone objective-c audio decibel

facebook - retrieving the notifications for a given user -

facebook - retrieving the notifications for a given user - i'm having serious problems using facebook graph api: retrieve news feed with: var query = fb.data.query('select post_id, actor_id, message, stream filter_key in (select filter_key stream_filter uid={0} , type="newsfeed")', response.id); and works fine when seek notification same user with: var q = fb.data.query('select notification_id notification recipient_id={0},response.id); not doesn't come in q.wait{} query, seems stop fisrt query supposed retrieve newsfeed , working fine before if has thought of going on (i went through permissions spec see if specified notification retrieval in vain), grateful. you're missing apostrophe before comma. your query should read: var q = fb.data.query('select notification_id notification recipient_id={0}',response.id); facebook facebook-fql

Writing CUDA surface backed by an array of vectors -

Writing CUDA surface backed by an array of vectors - i trying write 2-dimensional cudaarray through surface<void, 2> . array has channel format {32, 32, 0, 0, cudachannelformatkindfloat} or set more simply, holds vector2 s. i trying write vector2 surface @ position indicated integer coordinates (x, y) . next works well: // write float2 vector d outsurf surf2dwrite(d.x, outsurf, x * sizeof(float2), y); surf2dwrite(d.y, outsurf, x * sizeof(float2) + sizeof(float), y); however, if do surf2dwrite(d, outsurf, x * sizeof(float2), y); only x component of vector beingness written. what reason unintuitive behaviour? i find hard believe of surf2dwrite calls think do. write float2 utilize this: surf2dwrite<float2>(d, outsurf, x, y); the x , y arguments coordinates on surface writing , template parameter tells phone call size of type beingness accessed. vector cuda surface

c# - How to extract XML data -

c# - How to extract XML data - i have xml file has next data, <extcode type="abc" code="12345" /> i want able extract code, i.e., 12345, rows type abc. tried xpathselectelements("type[@name='abc']") but returned nothing. thanks. edit figured out problem namespace. xml file aw:extcode instead of extcode , caused query not work properly. how should in presence of namespace? when tried use xmlnametable nametable = doc.nametable; compiler complains can't resolve nametable. personally i'd utilize linq xml, preferred way of working xml data. this: xdocument doc = xdocument.load("test.xml"); int code = doc.descendants("extcode") .where(x => (string) x.attribute("type") == "abc") .first() .attribute("code"); one reason why xpath isn't working may attribute called "type" rather "name...

wpf - Which is better? Between using image file and draw vector shape -

wpf - Which is better? Between using image file and draw vector shape - as said on title. want know improve between using image files , drawing vector shapes (or path). know using vector improve appearance performance. and if depends on cases. can explain. (this question may include wp7, silverlight, wpf or in general cases.) here general reply compare pros/cons of bitmap (what think mean "image file") vs. vector. bitmap-based images (gif, tiff, jpeg, png, bmp) concept of mapping colours (and other info such alpha layer) pixel grid. different file formats offer variations of supported , levels of compression high-level concept. finish map of pixels , info stored in file matrix/table. vector-based images, say, path based. instead of storing info pixels, file format store geometric points , data. the pros bitmaps are: they render faster vector. because there minimal computation involved in presenting image (just take pixel map , display). they...

php - Dynamic tabindex -

php - Dynamic tabindex - i have lot of rows, each row has column <input type='text'/> , this: html: <table> <tr> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> </tr> <tr> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> <td><input type="text" size="10"/></td> </tr> </table> php: while(!$res->eof) { // come while() other db consult while(!$res2->eof) { // create dynamic columms. } } i'm creating rows db result, , numbers of columns dynamic, more , less. i need tabindex follow cu...

javascript - How to change the left attribute on page resize (jQuery) -

javascript - How to change the left attribute on page resize (jQuery) - i'm having slight troubles code. i'm trying create these element's css property 'left' update according difference of it's current left value, , amount page resizes. way, when page resizes , background moves over, elements move too. take @ code below , i'll describe issue: $(window).resize(function() { var docwidth = $(window).width(); if (docwidth < 1000) { var difference = 1000-docwidth; $('#headnav a,#icons div').each(function() { var left = $(this).position().left; var newleft = left - difference; $(this).css({ 'left' : newleft }); }); } }); so issue i'm getting elements beingness given left values of wild numbers, while value of variable 'newleft' reasonable, desired value. each function think collecting sums of these values , running them each element x amount of time...

capistrano - Where do you set the IP address of the server to push the code to? -

capistrano - Where do you set the IP address of the server to push the code to? - i'm reading capistrano tutorial: https://github.com/capistrano/capistrano/wiki/2.x-from-the-beginning where set i.p address of server force code to? does assume have ssh key setup? what if have 10 servers, best utilize different tool mirror things? capistrano isn't responsible pushing code (in sense of pushing changes scm) still git, or other selection of scm. capistrano default log onto servers named in "roles" , pull code downwards source control, each server individually. if have 10 servers, , web servers, name them in web role in capistrano. there first-class github guides more information, in short, yes; it's expected have ssh keys setup a) logging on servers deploy user, , b) server reach source command (often referred deploy keys.) @arthur's suggestion capistrano multistage useful when deploying multiple environments, such "staging...

delphi : how can I change color of a cell in string grid -

delphi : how can I change color of a cell in string grid - i want alter background color ( not font ) of cell in string grid in delphi . just 1 cell not row or column. can i? rruz : procedure right , works in procedure doesn't work. my procedure: x global array of integer procedure tf_avalie_salon.stringgrid1drawcell(sender: tobject; acol, arow: integer; rect: trect; state: tgriddrawstate); var s: string; begin s := stringgrid1.cells[acol, arow]; stringgrid1.canvas.fillrect(rect); settextalign(stringgrid1.canvas.handle, ta_center); stringgrid1.canvas.textrect(rect,rect.left + (rect.right - rect.left) div 2, rect.top + 2, s); if (arow<>0 )and(acol<>0)and(gridclick=true) begin seek gridclick:=false; x[acol+((strtoint(edit_hafte.text)-1)*7),arow]:=strtoint(stringgrid1.cells[acol, arow]); except x[acol+((strtoint(edit_hafte.text)-1)*7),arow]:=0; stringgrid1.cells...

php - Feedback on first programming project, browser compatibility -

php - Feedback on first programming project, browser compatibility - i know isn't straightforward question appreciate feedback on this. has been first shot @ programming , when started it, got help here. http://koti.mbnet.fi/bugs/pohjoisespoo/ <- you'll find site there http://koti.mbnet.fi/bugs/pohjoisespoo/kartta3.js <- javascript http://koti.mbnet.fi/bugs/pohjoisespoo/raphael-zpd.js <- zoom pan drag script (by somnidea) http://koti.mbnet.fi/bugs/pohjoisespoo/sivu.css most of issues caused poor programming think zoom , panning script i'm using (https://github.com/somnidea/raphael-zpd) doesn't work ie. i'm ready alter whole script if it's best alternative honest. however, don't need ie6 back upwards , i'm fine ie7 back upwards missing. however, believe there's issues on firefox v.3 well. newer firefoxes , google chrome should work. my next phase create simple collapsible comment section under each of bubble info sections. i...

http - OpenRasta can't properly deserialize an entity on PUT -

http - OpenRasta can't properly deserialize an entity on PUT - i'm experiencing unusual behavior when handling http set in openrasta handler. handler method signature looks this: public customerresource put(customerform customerform) and here relevant resourcespace configuration: resourcespace.has.resourcesoftype<customerlistresource>() .aturi("/customers") .handledby<customerhandler>() .renderedbyaspx("~/views/customer/customerlistview.aspx") .and.asjsondatacontract().formediatype("application/json;q=0.3") .and.asxmlserializer().formediatype("application/xml;q=0.2"); resourcespace.has.resourcesoftype<customerresource>() .aturi("/customers/{id}") .handledby<customerhandler>() .renderedbyaspx("~/views/customer/customereditview.aspx") .and.asjsondatacontract().formediatype("application/json;q=0.3") .and.asxmlserializer().formediat...

android - Eclipse keyboard language -

android - Eclipse keyboard language - i using english language (u.s.) windows xp laptop has eclipse (helios-sr1) installed. created android app runs fine on emulator , samsung charge phone. however, have 1 app screen requests user's name , email address. input form located on website , utilize webview function (and net permission) capture input info , store in mysql database table. problem experiencing each character input (either using eclipse keyboard or laptop keyboard) changed oriental character (i think chinese). don't understand why input characters changed.. wtf! i've been researching past 2 days , can't find solution create input characters english language (u.s.). appreciate help in resolving problem. ahead of time. regards, terry change input language in emulator , disable japanse , chines keyboard if real phone. in android 1.6 go settings -> locale & text -> select locale select english language (us) go settings -> loca...

html - CSS to constrain 960px inside a div? -

html - CSS to constrain 960px inside a div? - at moment have (standard) code gives me full-width background constrains header centered 960px: <div style="background-color: #222"> <header style="width: 960px; margin: 0 auto;"> <h1>site title</h1> </header> </div> is there way can apply single element in css, , avoid div altogether? considered this jquery hack calculate , set left , right padding on header pure css solution better. desired html: <header> <h1>site title</h1> </header> it might not possible thought i'd inquire before dismissing it! you can ditch div wrapper in favor of :before , :after . here's article on it: http://css-tricks.com/9443-full-browser-width-bars/ the end of article has link info on browsers back upwards :before , :after . don't, utilize javascript polyfill. html css

mysql - Doctrine LIMIT Syntax Error? -

mysql - Doctrine LIMIT Syntax Error? - '[syntax error] line 0, col 71: error: expected end of string, got 'limit'' here's code: public function getlatestchapters() { homecoming $this->_em->createquery('select c, m models\chapter c bring together c.manga m order c.createdate limit 10')->getresult(); } what posibly problem this? how can utilize limit in doctrine? i using doctrine 2 seems there no limit/offset in dql anymore. $qb = $em->createquerybuilder(); //.. build query $q = $qb->getquery(); $q->setfirstresult($offset); $q->setmaxresults($limit); $result = $q->getresult(); mysql doctrine

Is it possible to return null in some situations for registered types in Autofac? -

Is it possible to return null in some situations for registered types in Autofac? - i user autofac , wonder if possible come around dependencyresolutionexception thrown if instance returned registered type null? consider next example: builder.register( c => c.resolve<httpcontextbase>().currenthandler itemplatepage ).instanceperhttprequest(); the illustration homecoming null if current handler (for illustration aspx-page visiting) isn't of type itemplatepage, , autofac throw dependencyresolutionexception if utilize resolveoptional alternative in way: container.resolveoptional<itemplatepage>(); is there way come arond , behaviour autofac returns null instead of thowing exeption? i have worked around adding isnull-proerty itemplatepage , instanciate it, this: builder.register( c => c.resolve<httpcontextbase>().currenthandler itemplatepage ?? new templatepage(true) ...

c# - using PropertyInfo to assign a value to a wrapper class with a custom indexer -

c# - using PropertyInfo to assign a value to a wrapper class with a custom indexer - i need assign value via propertyinfo. i'm having problems when type of property custom class (a wrapper around dictionary, designed contain multiple language versions of same text). it looks that: public class multilingualstring { dictionary<string, string> versions; public string this[string languagecode] { { if (versions.keys.contains(languagecode)) { homecoming versions[languagecode]; } homecoming null; } set { if (versions.keys.contains(languagecode)) { versions[languagecode] = value; } else { versions.add(languagecode, value); } } ...

jquery ui tabs showing exception when selecting using jquery? -

jquery ui tabs showing exception when selecting using jquery? - i've simple ui tabs this <div id="tabs"> <ul><li><a href="#tabs-1">single</a></li><li><a href="#tabs-2">matchmaker</a></li></ul></div> later utilize jquery alternative select tab <script type="text/javascript"> $(document).ready( function() { var role = 1; //some value, value changes , i'm sure has value. $("#tabs").tabs("option", "selected", role); } ); </script> i've tried $("#tabs").tabs("option", "selected", 0); but no luck.. may error? you should this: $(document).ready( function() { var role = 1; //some value, value changes , i'm sure has value. $("#tabs").tabs({ selected: role }); } ); fiddle here: http://jsfidd...

Android: Designing Different Icons for Screen Densities -

Android: Designing Different Icons for Screen Densities - i know it's practice design different menu icons different screen densities. read preferred size different densities are: 36 x 36 px low 48 x 48 px medium 72 x 72 px high i want avoid doing unnecessary work. thought design 1 icon @ 72 x 72 px, , utilize that, , have android resizing automatically? don't see how that's different me resizing , creating 3 separate images? the benefit of having different icons you have command on final appearance, rather allowing algorithm munge image. few scaling algorithms able maintain quality when reducing image's dimensions, complex icons. be sure read android's scaling rules, , this page has first-class investigation image scaling , effects on final image. android

php - adding parameters to overriden method E_STRICT observation -

php - adding parameters to overriden method E_STRICT observation - it appears (php 5.3) if overriding class method, it okay to can add together additional parameters, long have default values. for example, consider class: class test1 { public function stuff() { echo "hi"; } } the next class extends "test1" , produce e_strict warning. class test2 extends test1 { public function stuff($name) { echo "hi $name"; } } but, next not produce e_strict warning. class test3 extends test1 { public function stuff($name = "") { echo "hi $name"; } } while class "test3" doesn't produce e_strict warning, have been under impression php not allow method signatures overloaded overridden. so, have ask. observation bug/flaw or correct intended behavior? further, if default argument parameter okay, why non-default argument parameter not okay? if add together non-defaulted parameter ov...

csv - C#: Checking That ArrayList Elements have specific type -

csv - C#: Checking That ArrayList Elements have specific type - arraylist filelist = new arraylist(); private void button2_click(object sender, eventargs e) { if (openfiledialog1.showdialog() == dialogresult.ok) { string line; // read file , display line line. system.io.streamreader file = new system.io.streamreader(openfiledialog1.filename); while ((line = file.readline()) != null) { // puts elements in table filelist.add(line.split(';')); } file.close(); } (int = 0; < filelist.count; i++) { (int x = 0; x < (filelist[i] string[]).length; x++) { // if (x ==0) // { //filelist[0] must int // } // if (x==1) //filelist[1] must string ...

.net - advise me how to create a good print in wpf? -

.net - advise me how to create a good print in wpf? - i want print in wpf cristal study of win application. in fact want abilities of cristal study tabling , sorting,... in wpf. didn't see command in wpf' tool box. please advise me how create print in wpf. thanks you can utilize same command (windows crystal study viewer) in wpf application. @ the next link sample code. http://social.msdn.microsoft.com/forums/en-us/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886 .net wpf wpf-controls wpftoolkit

php - post to database -

php - post to database - so have code takes message/post users insert , meant post database , displays , seperate page. ive got displaying park working fine trying insert database problem this code... <?php mysql_connect("localhost", "root", ""); mysql_select_db("test"); $time = time(); mysql_query "insert threads (title, message, author, dated);" values (null,'$_post[title]','$_post[message]','$_post[author]','0','$time'); echo "thread posted.<br><a href='untitled9.php'>return</a>"; ?> wont post infomation database! why , how can resolved? id int(11) no none auto_increment title varchar(255) latin1_swedish_ci no none message text latin1_swedish_ci no none author varchar(255) latin1_swedish_ci no none ...