Posts

Showing posts from February, 2015

Help encoding a cURL argument (works fine from the command line, but not from a PHP script) -

i working facebook api, , use following command via terminal post message users wall. curl -f 'access_token=xxxxxxxxxx' \ -f 'message=hello world' \ -f 'to={["id":xxxxxxx]}' \ https://graph.facebook.com/me/feed this works great. trying same via php code; $fields = array( 'access_token' => $t, 'message' => $message, 'to' => '{["id":'.$id.']}' ); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $fields); curl_exec($ch); curl_close($ch); this code successfuly posts message, own wall (i.e. ignoring 'to' parameter). i'm new curl, , i'm sure encoding wrong, or maybe missing curl flag, i've been through several tutorials on posting via curl, including few answers, , can't see i'm missing. really appreciate help! what print out? if ( 'post...

c# - Should I be using generics to simplify my configuration provider class? -

i attempting write configuration manager can supply configuration settings different providers (e.g. settings files, environment variables, databases etc). i have envisioned settings either strings, ints or doubles , identified name settings provided via classes implementing this: public interface iconfigurationmanagerprovider { t getsetting<t>(string name); ienumerable<configurationsetting> getknownsettings(); } as start trying write provider return environment variables public class environmentvariableprovider : iconfigurationmanagerprovider { public t getsetting<t>(string name) { string value = environment.getenvironmentvariable(name); return value t; } public ienumerable<configurationsetting> getknownsettings() { return new list<configurationsetting> { new configurationsetting("my_tracing", typeof (string)), }; } } however won't compile c...

How do I change my default browser in git's BASH shell? -

for reason, when try @ git pages, opens them in gedit instead of in chrome, how configure launch chrome again? using git's bash console in windows 7. try git config --global web.browser chrome . from manual: the web browser can specified using configuration variable help.browser, or web.browser if former not set. if none of these config variables set, git web--browse helper script (called git help) pick suitable default. see git-web--browse(1) more information this.

asp.net - Intellisense on .LESS files -

i'm introducing less existing asp.net web forms application. in order intellisense work, decided set lesscsshttphandler intercept requests files ending in .less.css . way, visual studio still thinks we're dealing css file. did adding following line web.config file: <add type="dotless.core.lesscsshttphandler, dotless.core" validate="false" path="*.less.css" verb="*" /> in order work, had tweak iis settings .css files handled asp.net framework. unfortunately, doing so, existing .css files (which aren't handled dotless http handler since don't end in .less.css ) aren't returning content. makes sense since asp.net framework doesn't know when sees file extension. is there sort of base http handler can set in addition 1 have above handle normal .css files? like: <add verb="*" path="*.css" type="insert base http handler here return contents of file" /> looks...

c# - locking static variable -

i have following class @ server-side. public class sample { private enum status { notevaluated, yes, no } private static object _lockobj = new object(); private static status _status = status.notevaluated; public static status getstatus() { if (_status == status.notevaluated) { lock (_lockobj) { if (_status == status.notevaluated) { //some evaluation code sets status either yes/no; _status = status.yes; } } } return _status; } } is wrong in locking mechanism above? need lock @ all? because server-side (multiple requests there) , variable static think should locked @ time of evaluation. correct me if wrong. thanks you not/should not have outer check "if (_status == status.notevaluated)". while appears nothing "bad" happen if left it, ...

Where to place SSL certificate for java application -

hello want generate certificate using keystore add sevrer , browse sever using ie. need steps generating certificate in plain english read in internet hard understod. server socket is: sslserversocketfactory ssf = (sslserversocketfactory)sslserversocketfactory.getdefault(); sslserversocket server = (sslserversocket)ssf.createserversocket(1234); string[] cipher = {"ssl_dh_anon_with_rc4_128_md5"}; server.setenabledciphersuites(cipher); the certificate code not sure pu in server: inputstream infil = new fileinputstream("server.cer"); certificatefactory cf = certificatefactory.getinstance("x.509"); x509certificate cert = (x509certificate)cf.generatecertificate(infil); infil.close(); keystore ks = null; ks = keystore.getinstance("jks", "sun"); inputstream = null; = new fileinputstream(new file("./keystore")); ks.load(is,"rootroot".tochararray()); see j...

sql server - Complex string match in SQL Query -

i have complex scenario string matching , want input guys. have table named customers. table contains field customername varchar. data in column prefixed mr. mrs. ms. data mr. john brady ms. abraham lenin mrs. john brady mr. michael king mrs. neil thomas mrs. micheal king now need design search query returns me rows of couples , in sequenced manner. like select customername customer ...?? result needs like mr. john brady mrs. john brady mr. michael king mrs. micheal king any idea ? thanks in advance consideration. declare @t table(name varchar(25)) insert @t values ('mr. john brady'), ('ms. abraham lenin'), ('mrs. john brady'), ('mr. michael king'), ('mrs. neil thomas'), ('mrs. michael king') ;with c ( select name, count(*) over(partition stuff(name, 1, charindex(' ', name), '')) cnt @t ) select name c cnt = 2

ios - UITableView editing animation duration -

does 1 know how long animation - (void)setediting:(bool)editing animated:(bool)animated; in uitableviewcell takes? i´m testing 0.5 seconds i´d rather use constant framework somthing uitableviewcelleditinganimationduration in version 4.3.5 0.3 seconds

c# - Open excel workbook but set calculations to manual -

i have tried few options none seem work, , send errors. please let me know doing wrong public string main(string wbpath, string wbname) { string cname=""; excel.application xlapp; excel.workbook xlwb; excel.worksheet xlws; xlapp = new excel.application(); xlapp.displayalerts = false; xlapp.calculation = excel.xlcalculation.xlcalculationmanual; //error occurs here xlwb = xlapp.workbooks.open(wbpath + wbname); xlwb.saveas("vfile.html", microsoft.office.interop.excel.xlfileformat.xlhtml); cname=xlwb.fullname; xlwb.close(); xlapp.quit(); return cname; } error code: {"exception hresult: 0x800a03ec"} you must open workbook before setting xlapp.calculation: static void main(string[] args) { string cname = ...

objective c - Unable to add header and footer for a table view controller -

@property(nonatomic,retain) uiview *tableheaderview; // accessory view above row content. default nil. not confused section header @property(nonatomic,retain) uiview *tablefooterview; // accessory view below content. default nil. not confused section footer i have added label in footer view inner coding according requirements no need make global variables. - (uiview *)tableview:(uitableview *)tbleview viewforfooterinsection:(nsinteger)section { uilabel *label; label = [[[uilabel alloc] initwithframe:cgrectmake(10, 0, 300, 30)]autorelease]; [label setbackgroundcolor:[uicolor clearcolor]]; label.textalignment = uitextalignmentcenter; [label settextcolor:[uicolor whitecolor]]; [label setfont:[uifont boldsystemfontofsize:15.0]]; [label settext:nslocalizedstring(@"instructions personal profile",@"instructions personal profile")]; uiview *view = [[[ui...

Way to create multiline comments in Python? -

i have started studying python , couldn't find how implement multi-line comments. languages have block comment symbols /* */ i tried in python, throws error, not correct way. python have multiline comment feature? you can use triple-quoted strings. when they're not docstring (first thing in class/function/module), ignored. ''' multiline comment. ''' (make sure indent leading ''' appropriately avoid indentationerror .) guido van rossum (creator of python) tweeted this "pro tip". however, python's style guide, pep8, favors using consecutive single-line comments , , you'll find in many projects. editors have shortcut easily.

android - How to custom TabView -

i new android, dont know how customized tabview. can guide me how create customized tabview. you can change background , images of tab view of code for(int i=0;i tabhost.setontabchangedlistener(new ontabchangelistener(){ @override public void ontabchanged(string tabid) { // todo auto-generated method stub for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { tabhost.gettabwidget().getchildat(i).setbackgroundcolor(r.color.transparent); //unselected } tabhost.gettabwidget().getchildat(tabhost.getcurrenttab()).setbackgroundcolor(color.parsecolor("#000011")); // selected }

mysql - How to select a product from SQL where code and id -

i have sql table: create table if not exists `orders` ( `id` int(11) not null auto_increment, `order_name` text not null, `order_q` text not null, `order_price` text not null, `order_id` text not null, `code` text not null, `order_date` text not null, `stat` text not null, primary key (`id`) ) engine=myisam default charset=cp1256 auto_increment=6 ; i want print out rows 1 one order 2 rows: 1- order_id 2- code this script looks shopping script, when clients making order, script automatically printing out invoice. what should do? my code: <? include("config.php"); $print = 'onload="window.print(); "'; $code_num="123456"; $result = mysql_query("select * orders stat='0' && code='$code_num' order id asc limit 1"); while($row = mysql_fetch_array($result)) { echo $row[order_name]; } ?> i not sure you're trying do, following code ...

php - MongoDb order by to be computed value -

what mongodb sort collection 'tweets' on integer field 'points', want remove number of seconds number of points, given difference between time now, , time tweet created. order (points - time difference). it depends therefor on time when query run. older tweets end having lower points. could show me example of in mongodb (in php)? mongodb not function in sort() command. in fact, performing simple find objects object.a > object.b requires use of un-indexed $where clause . the way around right calculate field , sort on it. so in case, have new field value of (points-time). please note if plan sort on data, want field indexed. trying sort on large number of un-indexed fields can slow.

javascript - jQuery form submission fail -

good afternoon everybody. i have got quick question ask why jquery not submitting form data. this form: <form id="submitform" action="" method=""> <input class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c" type="text" name="from" placeholder="your email" style="color:#ccc;" /> <input class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c" type="text" name="fullname" placeholder="your full name" style="color:#ccc;" /> <input class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c" type="text" name="contactnumber" placeholder="your contact number" style="color:#ccc;" /> <input class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-bo...

browser - Why there is no sleep functionality in javascript when there is setTimeout and setInterval? -

why there no such function in javascript sets timeout continuation, saves necessary state (the scope object , execution point), terminates script , gives control browser? after timeout expires browser load execution context , continues script, , have real non browser blocking sleep functionality work if js engine single threaded. why there still no such functionality in javascript? why have still slice our code functions , set timeouts next step achieve sleep effect? i think 'sleep'ing not want in browser. first of might not clear has happen , how browser should behave when sleep. is complete script runtime sleeping? should because have 1 thread running code. happens if other events oocur during sleep? block, , execution continues blocked events fire. cause odd behaviour might imagine (for instance mouse click events fired time, maybe seconds, after actual click). or these events had ignored, lead loss of information. what happen browser? shall wait sleep ...

symfony - Symfony2 - How to remove the Doctrine Bundle? -

i working on project using symfony2 , have no need doctrine bundle. have tried remove on numerous occasions keep getting errors break install. i have grep'ed instances of 'doctrine' within app directory , have commented out reference doctrine in following files: app/config/config.yml app/appkernel.php app/autoload.php i cleared cache (currently working in dev mode, removed cache/dev directory). the error getting is: fatal error: class 'doctrine\common\annotations\filecachereader' not found in /path/to/application/app/cache/dev/appdevdebugprojectcontainer.php on line 45 this refers block of code in cache /** * gets 'annotation_reader' service. * * service shared. * method returns same instance of service. * * @return doctrine\common\annotations\filecachereader doctrine\common\annotations\filecachereader instance. */ protected function getannotationreaderservice() { return $this->services['annotation_reader'] = new \do...

command - Why does "d1j" delete two lines in vim? -

the d{motion} command seems work inconsistently: d1j " deletes 2 lines bottom d1l " deletes 1 character right is expected behaviour? when start motion , in operator pending mode, motion either inclusive or exclusive, , either characterwise or linewise (linewise motions inclusive). j linewise inclusive motion. want try dvj or dgj (the latter 1 works screen lines). see :help operator . can force motions linewise, characterwise or blockwise v, v or ctrl-v respectively.

python - Find every third value and insert cr or newline in VIM -

so have several large datasets need make more readable , i'm having go in , move each 3rd value , insert newline. i've tried several things in vim work, none seem return value i'm looking for. here's of data: (0.96260310749184663, 4.3830008206495812, 0.84922658632317849), (0.96260310749184663, 5.0000002088986637, 1.049701855818201), (0.96260310749184697, 5.6169993576359696, 0.8492264385213405), (0.96260310749184719, 5.9983257940402384, 0.32437568665165911), (0.96260310749184719, 5.9983258053918069, -0.32437572732698844), (0.96260310749184719, 5.6169994358349786, -0.84922691097323821), (0.96260310749184697, 5.0000000093711492, -1.0497019267383632) what need make instead: (0.96260310749184663, 4.3830008206495812, 0.84922658632317849), (0.96260310749184663, 5.0000002088986637, 1.049701855818201), (0.96260310749184697, 5.6169993576359696, 0.8492264385213405), (0.96260310749184719, 5.9983257940402384, 0.32437568665165911), (0.96260310749184719, 5.9983258053...

navigation - How to navigate through the source code by parts in CamelCase (instead of whole words)? -

i remember when using eclipse when holding ctrl , using left or right arrows eclipse navigate on longcamelcasewrittenword in several steps. 1 camel case word @ time. so go follows (pipe | represents actual cursor position): |longcamelcasewrittenword -> ctrl+right_arrow -> long|camelcasewrittenword -> ctrl+right_arrow -> longcamel|casewrittenword -> ctrl+right_arrow -> longcamelcase|writtenword -> ctrl+right_arrow -> longcamelcasewritten|word -> ctrl+right_arrow -> longcamelcasewrittenword| is there way how achieve in intellij? intellij steps on whole word @ once. using intellij 9.0 yes, enable use "camelhumps" words in settings | editor | general | smart keys .

database cluster - PostgreSQL - Clustering never completes - long key? -

i having problems clustering table key consists of 1 char(23) field , 2 timestamp fields. char(23) field contains alpha-numeric values. clustering operation never finishes. have let run 24 hours , still did not finish. has run kind of problem before? theory reason long key field makes sense? have dealt larger tables not have long keys , have been able perform db operations on them without problem. makes me think might have size of key in case. cluster rewrites table must wait on locks. possible never getting lock needs. why setting varchar(64000)? why not unrestricted varchar? , how big index? if size problem has based on index size not key size. don't know effect of toasted key attributes on cluster because these moved extended storage. toast might complicate cluster , have never heard of clustering on toasted attribute. wouldn't make sense so. toasting necessary attribute more 4k in size. a better option create index values without possibly toasted...

iphone - Getting UILabel to produce an ellipsis rather than shrinking the font -

when dynamically change text of uilabel prefer ellipsis (dot, dot, dot) rather have text automatically resized. how 1 this? in other words, if have uilabel word cat size font 14 , change word hippopotamus font shrinks fit word. rather word automatically truncated followed ellipsis. i assume there parameter can changed within uilabel object. i'd rather not programmatically. set following properties: label.adjustsfontsizetofitwidth = no; label.linebreakmode = nslinebreakbytruncatingtail; you can set these properties in interface builder.

android - ViewStub NullPointerException -

Image
i have problem view stub. this viewstub in java file viewstub stub = (viewstub) findviewbyid(r.id.stub1); arrayadapter<string> content=new arrayadapter<string>(this,android.r.layout.simple_list_item_1,files); view inflated=stub.inflate(); listview people=(listview)inflated.findviewbyid(r.id.friends); people.setadapter(content); this xml initialize viewstub <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id = "@+id/linear_details" > <include layout="@layout/home_back_next_bar" /> <viewstub android:id="@+id/stub1" android:inflatedid="@+id/showlayout" android:layou...

On a quest for the super ultimate facebook share link -

facebook offers 2 simple methods pre-poulating someones status posting. 1) sharing link: http://www.facebook.com/share.php?u=http://350.org 2) sharing message: http://www.facebook.com/connect/prompt_feed.php?&message=350.org rocks! my question: possible combine these. if clicks pre-populated link, both attached link , personalized message go it? thanks! facebook moved open graph , realized introducing like plugin . removed share documentation reason! for use plugin.

gwt - Load HTML document to populate HTMLPanel a good idea? -

i want load "pieces" of html set htmlpanels dynamically modified getting id's follows: htmlpanel dyncontent = new htmlpanel("<div id=\"test_id\"/>"); dyncontent.add(new label("this content dynamically generated."), "test_id"); can serve html files client gwt app (it cool load html files served @ application startup)? or have create call server html (say rpc)? sounds jsp solution rather stay away such simple app. any suggestions welcome! the answer pretty neat! first found this: best way externalize html in gwt apps? then tried load static data via client bundle: public interface resources extends clientbundle { resources instance = gwt.create(resources.class); @source("public/html/timesheet.html") textresource synchronous(); } then load resources in html panel: htmlpanel dyncontent = new htmlpanel(resources.instance.synchronous().gettext()); dyncontent.add(new label("th...

objective c - NSDate's initWithString: is returning nil -

i'm using stig brautaset 's json framework serialize objects, including nsdates (which not directly supported). i decided use nsdate's description jsonfragment representation of date (i don't care minor loss of precision incurred in doing so). to extend stig brautaset 's json framework include nsdates, defined category: @interface nsdate (nsdate_json) <jsoninitializer> -(nsstring *) jsonfragment; @end to recreate nsdate (and other classes) json, defined protocol following initializer: @protocol jsoninitializer <nsobject> -(id) initwithjsonrepresentation: (nsstring *) ajsonrepresentation; @end i'm having issues initializer. in nsdate's case, calls initwithstring:, , that's trouble: returns nil. implementation: #import "nsdate+json.h" @implementation nsdate (nsdate_json) -(nsstring *) jsonfragment{ nsstring *strrepr = [self description]; return [strrepr jsonfragment]; } -(id) initwithjsonrepresentati...

sql - creating table as select is dropping the not null constraints in postgresql -

in postgres sql creating table select dropped not null constraints on table. for example : create table (char not null); create table b select * a; select * b;-- no constraint copied table please let me know how copy table data constraints in postgres. there no single-command solution this. to create table based on existing one, including constraints, use: create table b ( including constraints); once have done that, can copy data old 1 new one: insert b select * a; if in single transaction, looks atomic operation other sessions connected database.

iphone - Play sound at specific time while app is in background -

i'm looking way let app play sound @ specific time while it's in background (ios4 multitasking). currently, use local notifications works quite well, except for: the sound not played if phone muted the 30 second playback limit i saw there's setkeepalivetimeout:handler: it's available voip-apps , since that's not purpose of app, guess apple reject because of this. saw solution "empty" sound being played until it's time has been reached, - ignoring not elegant way, anyways - read this, too, might app rejected. since there few alarm clock apps i'm looking for, wonder how implemented functionality. thanks hints in advance! if seek solution approved apple, you're right can't use setkeepalivetimeout:handler , if - can't set timeout that's smaller 600 seconds, guess won't of great use anyway (besides it's not guaranteed fire event remotely close timeout specified. example, set 600 seconds , event fired 360 ...

wsdl - Maven for building SOA services and clients? -

i changed title generalize question isn't specific axis2. gave on axis2 altogether , switched metro/jax-ws considering giving on both , switching opensaml. real question i'm struggling answered here is, how build complex standards-based soa services work. the original phrasing was: paste in working example of maven pom invoke axis2 java2wsdl defaults can live with? here's command line incantation behaves sort of ok. -o target/generated-sources/java2wsdl \ -l "http://localhost:9763/services/policyservice" \ -tn urn:sesgg:sc:security:1.0.spec.policyservice \ -tp ps \ -stn urn:oasis:names:tc:saml:2.0:protocol \ -stp samlp \ -of policyservice.wsdl \ -sn policyservice \ -cp "../../schema/target/schema-1.0-snapshot.jar target/policyservice-1.0-snapshot.jar" \ -cn com.technica.pbac.ps.policyservice \ everything winds squirrely results; e.g. weird reversed namespaces (http://xmldsig._09._2000.w3.org/xsd example). explain why , how ...

sql - Delete duplicates based on string length criteria -

background remove duplicate city names temporary table, based on length of name. problem the following query returns 350,000 rows: select tc.id, tc.name_lowercase, tc.population, tc.latitude_decimal, tc.longitude_decimal climate.temp_city tc inner join ( select tc2.latitude_decimal, tc2.longitude_decimal climate.temp_city tc2 group tc2.latitude_decimal, tc2.longitude_decimal having count(*) > 3 ) s on tc.latitude_decimal = s.latitude_decimal , tc.longitude_decimal = s.longitude_decimal sample data: 940308;"sara" ;;-53.4333333;-68.1833333 935665;"estancia la sara";;-53.4333333;-68.1833333 935697;"estancia sara" ;;-53.4333333;-68.1833333 937204;"la sara" ;;-53.4333333;-68.1833333 940350;"seccion gap" ;;-52.1666667;-68.5666667 941448;"zanja pique" ;;-52.1666667;-68.5666667 935941;"gap" ;;-52.1666667;-68.5666667 9...

javascript - How to get the relative position of a point in a svg element? -

i'm creating web application svg element. in javascript code, stored svg container in variable named "mysvg". how can pointer relative position svg element, mean, x , y position relative top-left corner of svg element, using javascript display data on screen while user performs action click on specific point in svg container?

c - Motivation for spawning a new process v thread -

i understand if program has large segments can executed in parallel beneficial spawn new threads when instances not bound single resource. example of web server issuing page requests. threads beneficial aspect inter-thread communication less costly , context switching faster. processes give more security aspect 1 process cannot "mess" processes' contents, whereas if 1 thread crashes threads crash within said process. my question is, examples when want use process (for example fork() in c)? i can think of if have program wants launch program make sense encapsulate in new process, feel missing larger reason starting new process. specifically, when make sense have 1 program spawn new process vs thread? main reason using processes process can crash or go crazy, , os limit effect has on other processes. example firefox has started running plugins in separate processes, iirc chrome runs different pages in different processes, , web servers long time hav...

java - adding action listener to an image -

i insert image jpanel . write code. public void paint(graphics g) { img1=gettoolkit().getimage("/users/boaz/desktop/piece.png"); g.drawimage(img1, 200, 200,null); } i want add action listener picture, not have addactionlistener() method. how can without putting image in button or label? there few options. use mouselistener directly in jpanel a simple dirty way add mouselistener directly jpanel in overrode paintcomponent method, , implement mouseclicked method checks if region image exists has been clicked. an example along line of: class imageshowingpanel extends jpanel { // image display private image img; // mouselistener handles click, etc. private mouselistener listener = new mouseadapter() { public void mouseclicked(mouseevent e) { // should done when image clicked. // you'll need implement checks see region // click occurred within bounds of `img` } } // instantiate panel , perform i...

c# - ASP.NET/MVC 3 Status -

what status of asp.net/mvc technology? there big changes affect every code base? stable (backward compatible) enough used in real world? best regards you know, site you're using.. stack overflow, written in mvc. should answer question.

timeout - c# SerialPort WriteTimeout Use? -

i communicating circuit via serial port , wondering if should set write timeout? could give example of why/how used? understand point of read timeout (e.g. sent command, should receive response in under 250ms) don't see reasoning of write timeout. on old computer takes super long time send character string? thanks. if using hardware handshaking, bytes not written untill proper handshaking pin states have been reached. time out waiting other device signal ready more data, idicating buffer full @ end, or device off line. if have hardware hadshaking turned off, or have jumpered out on serial port (rts cts), time possibly time out writing bytes device faster can sent on line. fill output buffers , block (assuming not using async io). if driver can not clear buffers fast enough, time out on write, if have time out set short.

wix - Windows Installer Package Sometimes Installs Corrupt Log4net.dll -

i have simple msi installs bunch of files , creates , starts service. 1 of files installs ( privately installdir ) log4net.dll , dependency of service. i'm getting bug reports dev service won't start. root cause log4net.dll corrupted. it's right size it's hash wrong , examination of file reveals it's nul characters. it's not build problem because other people can take exact msi , install on different machines and/or uninstall / reinstall broken machine , right log4net.dll get's installed. has ever heard of this?

winforms - Editing a Form in Visual Studio when TFS is offline -

i'm running visual studio 2010 , using team foundation server, , thing pissing me off no end. here's scenario: since work home happens me work @ strange hours or on week-end, when our tfs offline. has never been problem, since reload solution , when vs detects tfs not available promprts work offline. now, work on wpf projects, , working offline has never problem, when editing xaml files works no issues. have edit form windows forms project, , vs refuses collaborate. whatever form, vs nothing other playing obnoxious "bing" sound plays when error of kind occours. doesn't popup error dialog box, nothing! any ideas?? ok figured out, had remove "read only" attribute files in project (i had tried project file , form file, isn't enough evidently).

android - Clicking List-view row and child Button as well -

my listview's row has 1 button. want set click event both row , button. know listview loose onitemclick property if set it's child click event. please guide me way doing both @ once you have use listview.setonitemclicklistener(onitemclicklistener) . see tutorial . in onitemclicklistener.onitemclick() you're provided position of item.

asp.net - ELMAH 1.2 Works great on CASSINI but I'm not able to make it works on IIS 7.5 -

i use asp.net 4 , c# logging error solution use elmah 1.2 . i able use elmah on local computer using cassini in visual studio 2010 move website server iis 7 or iis 7.5 (locally or remotely) elmah not able record errors. no error or yellow pages show up. i suppose there problem configurations, read many tutorials i'm still not able make works on production environment. here web.config. tell me i'm doing wrong? notes: removed here connection string security, on cassini work great thanks <?xml version="1.0"?> <configuration> <configsections> <section name="mywebappsettings" type="system.configuration.singletagsectionhandler"/> <!-- elmah local--> <sectiongroup name="elmah"> <section name="security" requirepermission="false" type="elmah.securitysectionhandler, elmah"/> <secti...

wpf - A trigger based on the value of a DataGridCell -

i have cells in datagrid , highlight cells in columns red when value 0. i'm not sure how approach this. i've looked @ question: wpf: how highlight cells of datagrid meeting condition? none of solutions have worked me. with using style triggers, seems triggers meant applied on properties. when nothing happens (i'm assuming because there's more content simple value). with last suggested solution getting compile-time issue seemed manifestation of bug that's been in vs while now: custom binding class not working correctly any ideas how can achieve this? anyone have ideas? the best way change background color of cell based on value of datagridcell define datatemplate datagridtemplatecolumn converter alter background color of cell. sample provided here uses mvvm. the keys parts search in following example include: 1: xaml converts integer (factor) in model color: <textblock text="{binding path=firstname}" background...

How to get information about process in C#? -

how information process (cpu, memory, disk & network usage) in c# application? p.s. system.diagnostics.process , system.diagnostics.performancecounter doesn't provide information disk , network usage. don't use it. system.text.stringbuilder sb = new system.text.stringbuilder(); var currentprocess = system.diagnostics.process.getcurrentprocess(); sb.appendline("process information"); sb.appendline("-------------------"); sb.appendline("cpu time"); sb.appendline(string.format("\ttotal {0}", currentprocess.totalprocessortime)); sb.appendline(string.format("\tuser {0}", currentprocess.userprocessortime)); sb.appendline(string.format("\tprivileged {0}", currentprocess.privilegedprocessortime)); sb.appendline("memory usage"); sb.appendline(string.format("\tcurrent {0:n0} b", currentprocess.workingset64)); sb.appendline(string.format("\tpeak {0...

ruby on rails - Cannot install SQLITE3 with JRuby -

i brand new ruby , using windows 7. different environment used having problems getting simple project going. after reading several tutorials, appears jruby simplest way go on windows have done. trying create web application scratch confused shell style method of working. i have downloaded sqliste3.def, sqlite3.dll , sqlite3 have put in the: c:jruby-1.6.4>bin directory. however, trying install sqlite no avail. firstly know console environment 1 use this. cmd or irb console? whenever use cmd default line c:\users\me> , don't know if affecting how things should work. whenever try install sqlite3 assuming need go : c:\users\me>gem install sqlite3-ruby however not getting anywhere , receiving following error: warning:jruby not support native extensions or 'mkmf' library i have heard lot of things ruby , trying build basic webpage contact form seem running sorts of issues project installation , getting ruby , running. there tutorials explain how s...

php - jQuery's serialize() function only returns the last selected checkbox value and not all of them! -

$('form').serialize(); <label>check applies:</label> laptop owner: <input type="checkbox" name="applicable" value="laptop owner" /> <br /> samsung tv lover: <input type="checkbox" name="applicable" value="samsumg tv lover" /> <br /> animae watcher: <input type="checkbox" name="applicable" value="animae watcher" /> if check "laptop owner" , "animae watcher" returns latter, why? need return both. edit i should when send forms values php returns last checked checkbox, php looks like: <?php echo $_post['applicable'].' says php'; ?> change name="applicable" name="applicable[]" <?php print_r( $_post['applicable'] ); ?>

jQuery live submit caugth in infinite loop -

i'm trying submit form using jquery , worked fine until had add confirmation window users can review data before submission, here's code: $("#create-group-form").live('submit', function(e){ e.preventdefault(); var form = $(this); jconfirm('here display group info...', 'confirm group', function(r){ if ( r ) { form.submit(); } }); }); i'm using jalert plugin jquery works regular confirm prompt different styling, preblem when users click ok on prompt goes again live submit getting stuck in infinite loop. is there way stop going in again event after confirm? think can unbind somehow haven't found way successfully. btw i'm using live submit because form in modal window. thanks in advance! call form element's submit method, rather jquery selection's one. means jquery handler won't triggered: $("#create-group-form").live('submit', function(...

mongodb - Mongo DB REST Option -

i know 1 of biggest differences between couchdb , mongodb couch uses rest interface. i've installed mongo without other libraries, , mongod service provides --rest command-line option. does mongodb rest interface same thing couchdb's? if not what's for? mongodb not use rest interface communications. you need install specific driver language. mysql or sql server or other databases. the list of drivers are here . the --rest option allows run basic queries , monitoring against mongod process. not full rest api.

android - MyLocationOverlay vs. LocationManager, and background Service -

i developing app. in share location friends (very google latitude). have service running daemon: should display received locations, , publish current user location each x seconds. now, being quite new android , maps, bit confused mylocationoverlay , locationmanager. while experimenting mapactivity, using mylocationoverlay seems handy display location. problem is, not sure taking location (net, gps,.. ?) , how updates it. moreover, suppose cannot use outside mapactivity, hence i'll need use locationmanager anyway. the question is: using locationmanager background work , mylocationoverlay show location much? suppose better use locationmanager, right? using mylocationoverlay in conjunction locationmanager common. mylocationoverlay determines location gps, wifi. can specify networks use location determination both mylocationoverlay , locationmanager. the location stored both types of location finding (in other words, if have mylocationoverlay locationmanager, it...

listview - how to maintain progress bar in android? -

want create listview 2 component in every row 1st progressbar , 2nd button display current value of progressbar. for m using custom list view problem when scroll listview progressbar cant maintain it's previous state. please me out solve problem. thanks in advance. you can using following logic. 1 create 1 arraylist example. `public arraylist<integer> progvalue = new arraylist<integer>();` 2 in custom list adapter class constructor initialize progvalue value "0" following for(int = 0; < yourlist.size(); i++) { progvalue.add(i,0); } 3 in progress bar change listener change value of progvalue object per progress bar value progvalue.add(i,p_value) 4 set value in in getview method. progobject.setprogress(progvalue.get(pos)); that's all. change code per requirement have put example.

layout - How do you float a control in VB.NET like you would in CSS -

for example: how have 3 pictures aligned right in 1 row, when far right picture deleted other 2 move right fill space. code examples appreciated, :) edit: i'm looking capability both windows forms , web forms. i'd happy right if code windows. for windows-based applications, use flowlayoutpanel control: flowlayoutpanel in vb.net flowlayoutpanel class for web-based applications, use floating : floatutorial css float property

php - $_POST key name length? -

i experiencing odd behaviour. have following 2 <input type='image'> (with src attribute equal name attribute): <input type='image' name='http://farm1.static.flickr.com/224/471627793_fbda6cecbe_s.jpg'> <input type='image' name='http://farm5.static.flickr.com/4053/4501238330_c5a85162ef_s.jpg'> my question is: why first input submit , second 1 doesn't? using cakephp , if click on second image, $this->params['form'] empty. when click on first image, works fine: $this->params['form'] contains correct image name it's coordinates clicked. this odd behaviour , believe can happen if $_post limit keys' length. any highly appreciated! thank you! php not limit field name length multipart/ or -urlencoded post requests. but suhosin indeed have http://www.hardened-php.net/suhosin/configuration.html#suhosin.post.max_name_length default of 64 . , second url indeed 64 characters lo...

bash - How to split a file into equal parts, without breaking individual lines? -

this question has answer here: how split large text file smaller files equal number of lines? 8 answers i wondering if possible split file equal parts ( edit: = equal except last), without breaking line? using split command in unix, lines may broken in half. there way to, say, split file in 5 equal parts, have still consist of whole lines (it's no problem if 1 of files little larger or smaller)? know calculate number of lines, have lot of files in bash script. many thanks! if mean equal number of lines, split has option this: split --lines=75 if need know 75 should n equal parts, its: lines_per_part = int(total_lines + n - 1) / n where total lines can obtained wc -l . see following script example: #!/usr/bin/bash # configuration stuff fspec=qq.c num_files=6 # work out lines per file. total_lines=$(wc -l <${fspec}) ((lines_per_file...

sql server - Search count of words within a string using SQL -

database: sql server i have table column named page_text contains following value " love stackoverflow.com because can post questions , answers @ time. " using sqlquery want search number of i has . in string should return 4. i should able search anything. declare @search varchar(10) = 'i' select len(replace(pagetext, @search, @search + '#')) - len(pagetext) count yourtable

java - SWT: provide multi-platform download bundles -

for our swt application want provide generic linux download bundle can start on 32-bit- 64-bit-vms. currently, define classpath using manifest , start application using java -jar main.jar . manifest classpath contains multiple swt*.jars , first matching 1 picked (no problem, because 1 distributed each platform). simply delivering both swt libraries, swt-linux-32.jar , swt-linux-64.jar , looks not promising, because either user have remove wrong 1 manually or script have set whole application classpath dynamically (scary!). i've thought providing 2 launcher scripts, 1 32-bit-vms , other 64-bit-vms, removing swt.jars manifest classpath , adding right 1 explicitly classpath, e.g. java -cp swt-linux-64.jar -jar main.jar . unfortunately, looks 1 can't mix explicit classpath definition ( -cp ) implicit 1 ( -jar ). one other solution explicitly set classpathes in launcher scripts, make maintaining scripts more complicated. of course, have alternative load right swt.jar fi...

hibernate - Strategies for Java ORM with Unreliable Network and Low Bandwidth -

i looking @ hibernate system needs work in unreliable network. there single central database need read-write access to, available on pretty patchy wi-fi network. in addition, there may power losses not shutdown application cleanly, solution must have persistent cache can survive power-cycles. lastly embedded system modest memory, , disk space example doing full blown replication of database not feasible strategy. i have basic understanding of hibernate 2nd level caching, , wondering if possible configure ehcache solve problem, main thrust of seems performance not availability, not aware of pitfalls might be. i quite willing consider other strategies involve replication local database. rather not have of heavy lifting myself implement this. looking experience or possible alternatives. "in addition, there may power losses not shutdown application cleanly, solution must have persistent cache can survive power-cycles." you have solution in mind hibernate ...