Posts

Showing posts from September, 2012

ruby on rails - Is there any alternative gem like pdfkit gem? -

i print "test.html.erb" page pdf format. please suggest me other gems pdf kit generates pdf file html page. we have used wicked_pdf success quite complicated pages. wicked_pdf allows create pdf specific templates (pdf.erb), can different regulat html templates (there elements meaningless in pdf, such navigation links). wicked_pdf use wkhtmltopdf under hood.

c - passing arg 1 of `foo' from incompatible pointer type -

why shows warning: #include<stdio.h> foo (const char **p) { } int main(int argc , char **argv) { foo(argv); } but following not show warning char * cp; const char *ccp; ccp = cp; the first code snippet shows warning passing arg 1 of foo incompatible pointer type. second snippet not show warning. both const pointers see c faq list you can cast in order remove warnings: foo((const char **)argv); but faq says: need such cast may indicate deeper problem cast doesn't fix.

regex - psql uppercase backreferenced string in regexp_replace -

i have string, processed initcap(), , wanto uppercase part of it. to specific - want uppercase basic roman digits might occur. to more specific i'd replace jana iii sobieskiego to jana iii sobieskiego i suppose use kind of upper-substring-subquery combo achieve it, trying make work in single regexp_replace, this: select ulica --, regexp_matches(ulica , '((^|\s)([xxiivv]+)(\s|$))', 'g') , regexp_replace(ulica, '((^|\s)([xxiivv]+)(\s|$))', '\2'||upper('q\3q')||'\4' , 'g') ( select unnest(array['jana iii sobieskiego', 'xx lecia', 'xxx lecia panowania zygmunta iii wazy'])::text ulica ) src what happens, upper works on 'static' part of replacement string (q...q), not on backreference. i jana qiiiq sobieskiego anyone has idea how this? postgresql 9.1 short answer unfortunately, have tried not possible regexp_replace . long answer intro li

spring - Property value is not printing on velocity template -

i using spring velocity , try print literal on velocity template, not working. here template, exportecomplete.vm: ${savepath} here code: @override public modelandview handlerequest(httpservletrequest request, httpservletresponse response) throws exception { .... boolean success = processor.exportcourse(courseid, exportplayer, exportassets, exportjson); ... if (success) { log.debug("export success"); return new modelandview("templatescene/exportcomplete"); } else { log.debug("export failure"); return new modelandview("templatescene/exporterror", "context", context); } } here method: public boolean exportcourse(string courseid, boolean exportplayer, boolean exportassets, boolean exportjson) { context = new hashmap<object, object>(); context.put("savepath", "save path complete"); velocityengineutils.mergetemplateintostring(engin

Programmatically sending mule message (formerly: Accessing mule http endpoint from java) -

scroll towards end solution topic's problem. original question asking different thing. as part of larger process, need fetch , link 2 related sets of data together. way data retrieved(dynamics crm, n:n relationships..) forces retrieve second set of data again have necessary information. during part of larger transformation of data, access http endpoint used fetch data crm, retrieve second set of data , process it. can endpoint through defaultendpointfactory so: defaultendpointfactory def = new defaultendpointfactory(); def.getinboundendpoint("uri").getconnector; but there no method send mulemessage. solved: the problem can not set inbound properties on mulemessage, , flow depending on of function(path, query params etc). it seems able inbound scoped properties this: m.setproperty("test", (object)"test", propertyscope.inbound); is there way make approach work, or alternative way access flow? tried using mulecontext flow: mulecontex

Using ColdFusion session variables in PHP -

i have coldfusion website running login/register modules. want use coldfusion session in php. can achieved? as mentioned in comments, no it's not possible. cf , php cannot share in memory sessions variables. however, there other alternatives such using cookies. i used approach once because client wanted share sessions php forum software. grabbed using cookies, finding cookies being set ie <cfdump var="#cookies#"> . converted cookies sessions variables. (if need other way around, try doing in reverse.) another possibility sending data securely using encrypted url variables. need know more goal. can explain doing?

ruby on rails - Twitter bootstrap icons are not loading in Firefox & IE -

in rails 3.2.9, using twitter bootstrap plugin in firefox(both in linux & windows) & ie(in windows) icons not loading. in chrome & chromium icons loading fine. in linux, firefox version 20.0 & in windows, ie version 9 & 10. my bootstrap_and_overrides.css.less file contains, @import "twitter/bootstrap/bootstrap"; @import "twitter/bootstrap/responsive"; // set correct sprite paths @iconspritepath: asset-path("twitter/bootstrap/glyphicons-halflings"); @iconwhitespritepath: asset-path("twitter/bootstrap/glyphicons-halflings-white"); // set font awesome (font awesome default. can disable commenting below lines) // note: if use asset_path() here, compiled bootstrap_and_overrides.css not // have proper paths. use absolute path. @fontawesomeeotpath: asset-path("fontawesome-webfont.eot"); @fontawesomeeotpath_iefix: asset-path("fontawesome-webfont.eot#iefix"); @fontawesomewoffpath: asset-path("

PHP - Single checkbox validation - validates but even when checked, won't submit. -

im writing code form validation in php, i've got problem checkbox validation. when going through form, if don't check checkbox, give correct error message. however if check checkbox, still gives same error message. here code far: if (isset($_post['firstname'], $_post['lastname'], $_post['address'], $_post['email'], $_post['password'])) { $errors = array(); $firstname = $_post['firstname']; $lastname = $_post['lastname']; $address = $_post['address']; $email = $_post['email']; $password = $_post['password']; if (empty($firstname)) { $errors[] = 'first name can\'t empty'; } if (empty($lastname)) { $errors[] = 'last name can\'t empty'; } if (empty($address)) { $errors[] = 'address can\'t empty'; } if (filter_var($email, filter_validate_email) === false) { $errors[]

php - Fatal error: Out of memory Zend Error / PhpMyAdmin -

i using wamp application. developing application in zend. when work application receiving following error. not able @ phpmyadmin. error totally vanish wamp!! using wampserver2.1e-x32 fatal error: out of memory (allocated 1048576) (tried allocate 393216 bytes) in d:\wamp\apps\phpmyadmin3.3.9\libraries\config.default.php on line 2051 i have did following still issue remains same: i have set memory limit 0 in php.ini files. googled , found if send memory limit 0 take unlimited. tried 32m,64m,128m . specified 1g tried too. tried setting ini_set('memory_limit','16m'); ,32m , 256m no use.(even tried 16384m) do want increase execution time? help? this out of memory message has happened me before when have tried create arrays large sensible. i tried following solution , works well! inside wamp\apps\phpmyadmin3.3.9\config.inc.php file below line 24 added following code: $cfg['memorylimit'] = '128m'; and works well; after ins

Association Table data with breeze and entity framework -

i have entity framework database first set , i'm having issues getting data table ef treats association because it's navigation property. have survey table eventid(pk), facilityid, exitdate, , status. have surveycategories table categoryid(pk), description , survcat table has surveyid , categoryid foreign keys. can data other related tables don't use middle table survcat, following documentation breeze site navigation properties cannot loaded surveycategories array in each survey object. checked metadata , it's showing navigation property nothing code: var query = entityquery.from('surveys') .where("facilityid", "eq", whereclause) .skip(currentpage * 5).take(5) .expand("facility") .expand("surveycategories") .expand("surveycite") .expand("surveydl") .orderby(orderby.survey) .inlinecount(true); any

php - Cookies not expiring on all pages -

i'm working on little log in syetms website, hwoever have hit little snag. i'm using cookies track users logged in. i'm trying make pages restricted vistors have logged in only, decided use if($_cookie["loggedin"] == true){ works log in page when logout using setcookie("loggedin", null, time() - 60000); other pages apart log in page retain value true, username value remains set on teh other pages no log in page. set cookie setcookie("loggedin", true, time() + 3600); . i'm still new php appreciated for logging in , consistency between pages. might better put session_start() @ top of pages , use $_session instead of $_cookie .

css - Vertically align more than one line of text? -

i'm using: #leftfoot {padding-left: 20px; vertical-align: middle;} it not work. i've @ plenty of explanations, none of them seem work me. else know how vertically align more 1 line of text? shakes fist angrily @ css. #leftfoot { height: 110px; display:table-cell; vertical-align: middle; padding-left: 20px; } your issue following: text indeed centered vertically, inner div had same height text , not extending bounds of outer div, have set height inner div work.

actionscript 3 - as3 Error 1009 at Coin1/coin1go(), i am trying to get an enemy to drop a coin -

so enemy drop coin not properties of coin( if hits player gives him +5 coins) the coin removed if hits bottom of stage, if player dies or if player hits it. sadly, not work. but work if place coin on stage before start game, gets properties, must moment gets added stage not linked coding or something..... , right now. this .as file coin: package { import flash.display.movieclip; import flash.events.event; public class coin1 extends movieclip { private var _root:object; private var speed:int = 0; public function coin1() { addeventlistener(event.enter_frame, speed1); addeventlistener(event.added, beginclass); addeventlistener(event.enter_frame, coin1go); } private function beginclass(event:event):void { _root = movieclip(root); } private function speed1(event:event):void { y += speed; } private function coin1go(event:event):void { if (this.y > stage.stageheight) {

version control - Pros and cons of different strategies to managing shared resources in TFS 2012 -

background according visual studio alm rangers, there 2 major approaches sharing resources (e.g. common libraries used in many separate products) in tfs 2012: workspace mapping , setting workspaces point appropriate version of each required library , product. shared folders , using branch/merge , update shared resource at glance, shared folders seems way go, client working has experienced lot of problems approach in starteam, , reluctant try again in tfs. in process of assisting client migrating starteam tfs. i have listed pros , cons each approach, uncertain if have missed something. workspace mapping: simple setup , understand easy test library change in several products easy latest changes in library, , submit changes library no tracability, or @ least less tracability, e.g. if change in library introduced in product a, how track change in product b changes in libraries may affect products in uncontrolled manner build gets more complicated each user must se

sql - How to get the Highest, then the lowest, then the 2nd higest, and then the 2nd lowest value and so on from a table -

i've question, how can highest value, lowest value, second highest value table. for example: in table name value ---------------------- apple 2 pear 3 pineapple 6 mango 7 kiwi 1 result should this: name value ----------------------- mango 7 kiwi 1 pineapple 6 apple 2 pear 3 thanks! i'm assuming tsqlt tag meant tsql , , further implies sql server: ;with numbered ( select name,value, row_number() on (order value desc) rndesc, row_number() on (order value asc) rnasc @t ), mixednumbered ( select name,value, case when rndesc < rnasc rndesc else rnasc end rnfin, rnasc, rndesc numbered ) select name,value mixednumbered order rnfin,rndesc this works finding row numbers whilst considering list sorted both highest-to-lowest , lowest-to-highest (in numbered , rndesc , rnasc ). take

ruby on rails - ActiveRecord: class methods without scoping -

i need create class method of activerecord. method not meant scope, i'd prevent misusage of scope. possible do? like kiddorails hinted, not possible. underlying reason ar puts many responsibilities 1 class -- validation, persistence, finding/querying. if care encapsulating these methods in 1 place, might consider creating separate class (which prevent 'misuse' nature has query-related methods) handles query-related logic. (there other strategies 1 consider well, too)

c++ - Undefined reference when instantiating a class -

this main.cpp . here have problem: i 2 errors: undefined reference `bankcontroller::bankcontroller(transactionrepository )* @ line 23 and undefined reference `transactionfilerepository::transactionfilerepository(std::string) @ line 19 for both of them, type c/c++ problem, resource main.cpp #include "bankgui.h" #include "controller/bankcontroller.h" #include "repository/transactionfilerepository.h" #include "repository/transactionmemoryrepository.h" #include "repository/transactionrepository.h" #include <qtgui> #include <qapplication> #include <string> #include <iostream> using namespace std; int main(int argc, char *argv[]){ string path = "datastorage/database.txt"; //instantiate main data repository transactionrepository* maindatabase; maindatabase = new transactionfilerepository(path); // <-- error here //instantiate main controller bankcontroller* maincontroller;

GWT RPC XSRF protection -

after adding gwt rpc xsrf protection should different in rpc calls? i followed changes mentioned in post( gwt (2.4.0) + xsrf , https://developers.google.com/web-toolkit/doc/latest/devguidesecurityrpcxsrf ) , got gwt rpc xsrf work, see rpc calls wrapped in "com.google.gwt.user.client.rpc.xsrftoken", can still intercept request in fiddler , change request me else, thought after protection, won't able this? i can change getfirsturl in original request in fidder me valid parameter, " getsecondurl " http://127.0.0.1:8888/myapp/|ac7025ad520a4366b89a555020174220|com.google.gwt.user.client.rpc.xsrftoken/4254043109|ec4ae16148312f61eb4c4da365f2f4b2|com.myapp.service.myservice|getfirsturl what describe not xsrf, it's mitm. protect against mitm 1 have use https (or sign request, that's impractical, if ever possible, in browsers). to simplify, xsrf attacker site forging cross-site request (hence name) victim site, , making use of existing cooki

.net - C# Generics, casting generic list to known parent class? -

i'm trying cast list of objects parent using generics. have classes such as: entity node otherclass where node/otherclass inherits entity. want this: type totype = typeof(node); // not gotten way object fieldvalue = field.getvalue(item); list<entity> entities = (list<entity>)fieldvalue; foreach (entity toent in entities) { // code using toent using entity attributes... } i'm able field using fieldinfo reference i'm unable cast list. field value list of node reference seems it's unable cast list of entity should possible since inherits entity. casting list of node instead works, want code able take list of otherclass. doesn't work cast list of objects, , casting each individual 1 entity. i tried using makegenerictype, part of solution, couldn't work after quite while of trying. thanks time! a variation on other options, using covariance: var sequence = (ienumerable<entity>) field.getvalue(item); var entities

How to get the depth of field effect using OpenGL? -

i wondering how implement "depth of field/circle of confusion" effect using opengl? is there built-in method or library support it? you not find "built in" opengl give looking for. have implement effect through shader, straightforward. an article on how achieve effect freely available here: nvidia article on depth of field techniques

ios - Multithreading in UITableView -

i'm new multithreading . i have uitableview few rows. when select 1 row there action taking place in server. take time finish action. when want select other row in table takes time perform action, ie after 1st row finishes action row start action. so want that, when 1st row selected , action preforming, , when select 2nd row , 1st row action should open new thread , run in thread, , after action completed should kill thread. i want way happen rows in uitableview . can me solve issue. in advance. read on grand central dispatch: http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial here basic example on setting thread: dispatch_async( dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ // add code here background processing // // dispatch_async( dispatch_get_main_queue(), ^{ // add code here update ui/send notifications based on // results of background processi

.net - Getting Price before sending Twilio message -

i using twilio .net helper library , want able determine price of call or sms message before send it. example, if sms message go uk number want know price before sending message. there way this? there no way sms price before send. fee varies base on carriers. however, using twilio api call, can "sent" price if message "sent" if message "queued", price null.

width - Android RelativeLayout and childs with layout_width="match_parent" -

how android calculates size of view when have 2 views @ same "row", 1 width="fill_parent"? example: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent"> <edittext android:id="@+id/edittext01" android:hint="enter text..." android:layout_alignparentleft="true" android:layout_width="match_parent" android:layout_toleftof="@+id/button01" android:layout_height="wrap_content"></edittext> <button android:id="@+id/button01" android:text="press here!" android:layout_width="wrap_content" android:layout_alignparentright="true" android:layout_height="wrap_content"></button>

python - Adding a new record in Django Admin gives persistent error -

i'm starting mess around django. created new project , new app. in app created model , activated admin. seemed work fine. wanted add couple new records database using admin. in first 3 tables went fine, in fourth 1 (called ' locations ') error saying: 'tuple' object has no attribute 'encode' . full error here on pastebin: http://pastebin.com/wjzat6nn the strange thing when go general admin page , want click table on got error, error (so without trying add anything). my question: why happening? maybe there wrong models.py, pasted below message well. all tips welcome! from django.db import models # create models here. class countries(models.model): country = models.charfield(max_length=100) def __unicode__(self): return self.country class organisationtypes(models.model): organisationtype = models.charfield(max_length=100) def __unicode__(self): return self.organisationtype class organisations(models.model): or

asp.net web api - How to return a different object from the one you run a query on in OData? -

i'm trying return object controller's get method of different class class query run on. based on answer here , i'm doing: public pageresult<outputpoco> get(odataqueryoptions<inputpoco> odataqueryoptions) when trying run 406 not acceptable . missing? there working example out there of approach? update: using odatacontroller . outputpoco contains reference inputpoco . need sorting , filtering work (on inputpoco ). are using odatacontroller? have use odatacontroller when building odata service. in case have build edm model , expose odata service using odata route. if want build vanilla web api supports odata query semantics (and not rest of odata url conventions , formatting), should use apicontroller instead.

java - Jackson mapping fails for generics passed as parameter -

i have common api different entity rest api. below method getting list of entities (groovy). class commonrestapi<t>{ commonrestapi(){ } .... list<t> getentities(class<t> clazz) { clientresponse response = some_rest_get //works fine t[] entities if (response.status == 200) { try{ generictype<responsewrapper<t[]>> type = new generictype<responsewrapper<t[]>>(){} //here error entities = response.getentity(type).getdata() }catch(exception e){ log.debug e.getmessage() } } else { log.debug("status code: " + response.status) } return arrays.aslist(entities) } } responsewrapper class (java): public class responsewrapper<t> { private t data; public t getdata() { return data; } public void setdata(t data) { this.data = data; } } and calling method with: commonrestapi.getentities(mydomain.class) here rest ap

javascript - jQuery loop - setTimeout, addClass, removeClass -

i easy 1 javascripters. had long research couldn't find right answer. want menu (basically anchors , not list elements) highlighted slider specific time delay. also, nice if know how rid of these useless ids around using $("#menu a") , $(this). since cannot javascript (although prefer simplicity), here crappy code in jquery works, it's not looping. $("#anchor1").addclass("highlight"); function loopmenu() { window.cleartimeout(); settimeout(function(){$("#anchor1").removeclass("highlight");}, 4000); settimeout(function(){$("#anchor2").addclass("highlight");}, 4000); settimeout(function(){$("#anchor2").removeclass("highlight");}, 8000); settimeout(function(){$("#anchor3").addclass("highlight");}, 8000); settimeout(function(){$("#anchor3").removeclass("highlight");}, 12000); settimeout(function(){$("#anchor4&quo

android - PhoneGap + jqueryMobile TextToSpeech -

is possible implement text speech via phonegap/jquery mobile? there other opportunities? best regards, alex yes, have try plugin: https://github.com/macdonst/tts

Correct way to do a string replace with regex in javascript? -

i newbie regex , expression appears backwards or opposite of trying do. have string, in case url, , want replace , including last forward slash empty string. have "http://www.sweet.com/member/other".replace(/[^/]+$/, "") which opposite of want. proper expression results i'm seeking? in case end string "other"? help regexr example you want regex matches beginning of string, followed many characters possible, followed slash: /^.*\//

javascript - Checkbox value insert into MySQL -

here front end looks like. have created checkbox email on , off, , store on/off information in mysql. this php code <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>better check boxes jquery , css </title> <link rel="stylesheet" type="text/css" href="css123/styles.css" /> <link rel="stylesheet" type="text/css" href="jquery.tzcheckbox123/jquery.tzcheckbox.css" /> <script src="jquery123.js"></script> <script src="jquery.tzcheckbox123/jquery.tzcheckbox.js"></script> <script src="js123/script.js"></script> </head> <body> <div id="page"> <form method="post" action=""> <br> <ul> <li><label for="ch_emails">email notifications: </la

c# - How to disable the Wide Tile for SecondaryTiles in Windows Phone 8? -

i developing application in windows phone 8. having set of tiles in home screen , these tiles can pinned secondarytiles in windows start screen. basically using fliptiledata create secondarytile in application. per requirement, should not having wide tile option secondarytile. secondarytile must pinned small , medium tiles. i set following properties in fliptiledata. var secondarydata = new fliptiledata { title = "content", backgroundimage = //image uri, widebackgroundimage = // image uri, smallbackgroundimage= // image uri }; is possible achieve in windows phone 8. please me on ? you can turn disable wide-tile when call shelltile.create secondary data. setting supportswidetile argument false. see msdn docs more info. shelltile.create( launchuri, secondarydata, false);

algorithm - Adding all values of 2 stacks to 1 stack and sorting them -

there 3 stacks - a, b, c stacks , b sorted (the number on top of stack biggest). stack c empty 5 operation allowed: push pop top is_empty create we need write function receives stacks , b, moves numbers in stacks , b stack c , stack c must sorted (biggest number on top). for first cut, split problem 2 parts: move elements , b c, least element being @ top. convert c least element @ top c highest element @ top i.e. reverse sort order. once have this, can see if there better/more efficient algorithm.

ruby on rails - Rspec metadata: vcr should only kick in for tagged examples, but works for every example instead? -

simple setup: #spec_helper.rb vcr.configure |c| c.cassette_library_dir = file.expand_path '../vcr_cassettes', __file__ c.hook_into :fakeweb c.ignore_localhost = true c.configure_rspec_metadata! end rspec.configure |c| c.treat_symbols_as_metadata_keys_with_true_values = true end i expecting examples not tagged :vcr not affected not seem case. getting "vcr not know request..." kind of error. what missing? vcr designed identify places in test suite http requests made , them under deterministic test. such, default, when http request made , no cassette in use, raises error. can configure allow http connections when there no cassette if prefer.

php - Echo with parameters and without? -

i know following 3 statement prodcue same output: echo "hello" . "world! <br/>"; echo "hello"; echo "world!", "<br/>"; echo "hello", "world!", "<br/>"; but preformance difference , why? is slower concatenate "string" . "string" compared "string","string" ? it depends on mean performance... in terms of number of operations, first example best (has least number of operations)... second , third examples same. opcodes echo "hello" . "world! <br/>"; here finding entry points branch analysis position: 0 return found filename: /in/oyvsm function name: (null) number of ops: 3 compiled vars: none line # * op fetch ext return operands --------------------------------------------------------------------------------- 3 0 > concat

java - Cannot create SQL database from downloaded file which is saved in /data/data/appname/files -

i tried searching around cannot find definite solution. what trying download updated new inputs sql file in xml format url , save in /data/data/appprogram/files/ folder. downloading of file completed , tested confirmed file downloaded emulator through ddms file explorer. next want open file statements , parse database defined camera_database located in /data/data/appprogram/databases. problem begins. cannot beyond point. i tried input data using both inputstream , openfileinput not working. below code used. please advise kind soul.. public class help_databasehelperadv extends sqliteopenhelper { public static final string camera_database_name = "camera_database"; protected context camera_context; public help_databasehelperadv(context context) { super(context, camera_database_name, null, 1); this.camera_context = context; } @override public void oncreate(sqlitedatabase cameradb) { string s; try { inputstream in = camera_context.getappl

ios - Generate a CGPath from another path's line width outline -

Image
i might not explaining in best way possible, please bear me. what have drawn cgpath on top of mkmapview object: the way able achieve create cgpath darker blue line, create copy of path, , stroke thicker version of semi-transparent blue color. here's code i'm using this: // set shadow around path line cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsavegstate(context); cgcontextsetrgbstrokecolor(context, 0.0f, 0.0f, 0.0f, 0.0f); cgcontextsetrgbfillcolor(context, 0.0f, 0.0f, 1.0f, 0.4f); cgpathref shadowpath = cgpathcreatecopybystrokingpath(self.path.cgpath, null, 80.0f, kcglinecapround, kcglinejoinround, 0.0f); cgcontextbeginpath(context); cgcontextaddpath(context, shadowpath); cgcontextdrawpath(context, kcgpathfillstroke); cgcontextrestoregstate(context); cgpathrelease(shadowpath); works pretty well, nothing wrong far. however, though cgpathref of outline of thicker semi-transparent blue area. here's

java - Parse Json Arabic text -

i can't parse arabic/persian text sql database. set utf-8. sql database text set utf8_general_ci . json parser set utf-8 too. text shown in english. when use arabic/persian text in database, android shows text ??????? . public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } // function json url // making http post or method public jsonobject makehttprequest(string url, string method, list<namevaluepair> params) { // making http request try { // check request method if(method == "post"){ // request method post // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httppost.setentity(new urlencodedformentity(params)); httpresponse httpresponse = httpclient.execute(httppo

C# Input string was not in a correct format int32 -

Image
i having problems formats , converting. i have tried workarounds , nothing. code snippet think error is label_map.text = message.substring(21, 3); label_sys.text = message.substring(15, 3); label_dia.text = message.substring(18, 3); label_pulse.text = message.substring(26, 3); savedata( int32.parse(message.substring(15, 3)), int32.parse(message.substring(18, 3)), int32.parse(message.substring(26, 3))); example input string s1;a0;c03;m00;p120080100;r075;t0005;;d2 end of errorcode innerexception: system.formatexception message=input string not in correct format. source=mscorlib stacktrace: @ system.number.stringtonumber(string str, numberstyles options, numberbuffer& number, numberformatinfo info, boolean parsedecimal) @ system.number.parseint32(string s, numberstyles style, numberformatinfo info) @ nibp2pc.form1.display(string message) in c:\users\bazinga\desktop\spiediena_merisana\nibp2pc_c#\nibp2pc\form1.cs:line 427 you migh

linux - Including hidden files in a war file using the jar command -

i'm trying create war file on mac osx in terminal. i'm trying include hidden subdirectory of config files. reason war file not including hidden subdirectory. the command using is: jar cvf mywar.war * file contents 2 html files , 1 directory ".ebextensions" am doing wrong? seems should easier i'm making it. thanks! try typing jar cvf mywar.war * .[!.]* with command, include directories/files, begin dot, exclude . , .. .

asp.net - Designing classes in code first Entity Framework -

i building online shopping web application. have 4 entities : customers cusomerid name address phone category categoryid category product productid name price category order orderid customerid productid quantity amount please me designing classes proper relation(primary key , foreign key) maintained. tried doing database creating foreign key lead inconsistency. my classes: public class category { public int categoryid { get; set; } public string categoryname { get; set; } } public class customer { public int customerid { get; set; } public string name { get; set; } public string address { get; set; } public string email { get; set; } public string password { get; set; } } public class order { public int customerid { get; set; } public int orderid { get; set; } public datetime purchasedate { get; set; } public string productname { get; set; } public list<product&g

css - Full-screen responsive background image -

i new front-end development , foundation. i trying <div class="main-header"> full screen image scales down responsively. can tell me doing wrong? scaling properly, not showing full image. wanted <div class="large-6 large-offset-6 columns"> sit above on mobile device – possible? the html: <!-- main header --> <div class="main-header"> <div class="row"> <div class="large-6 large-offset-6 columns"> <h1 class="logo">bleepbleeps</h1> <h3>a family of little friends<br>that make parenting easier</h3> </div> <!-- end large-6 large-offset-6 columns --> </div><!-- end row --> </div><!-- end main-header --> the css: .main-header { background-image: url(../img/bb-background2.png); background-repeat: no-repeat; background-position: center; background-size: cover; width: 10

sql - Dynamic way of counting number of previous rows in a table that satisfy some condition, over certain columns in the table -

as specific example have table t columns customer , date indicating days on individual customers have made purchases: customer | date ---------------------- | 01/01/2013 | 02/01/2013 | 07/01/2013 | 11/01/2013 b | 03/01/2013 b | 08/01/2013 i want add column each pair (customer, date) pair (c, d) , gives number of pairs (c', d') in t such c = c' , 0 <= days(d) - days(d') <= 7 . below table column: customer | date | new_column ---------------------------------- | 01/01/2013 | 1 | 02/01/2013 | 2 | 07/01/2013 | 3 | 11/01/2013 | 2 b | 03/01/2013 | 1 b | 10/01/2013 | 1 as rough idea of steps used solve problem: create table t' possible pairs (c,d) ; left join t onto t' ; create new column: count(date) on (partition customer order date asc rows between 6 preceding , 0 following)

asp.net mvc - MVC - Why session is lost after browser close? -

i'm using code topic's accepted answer asp.net mvc rememberme but, after log in reopen browser , i'm not logged in. why ? to make answer-able: make sure browser you're using isn't setup delete cache/cookies/session information on close (or @ least add exemption local testing). also, make sure you're not browsing in privacy/incognito mode delete information on close well. for short-term work-around, can keep browser window (at least 1 tab) open , let visual studio open new tab each compilation. should keep session information between tab views (until inevitably close window).

iOS: changing a UILabel text of a modal view programmatically -

i have app has 2 screens. in first screen there's button opens second screen modal view via modal segue, , has uilabel. i want uilabel have text varies depending on how many times user clicks button (they're hints: user can click button , see hint 3 times). i'm doing following method every time click button: - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"tipmodal"]) { quiztipviewcontroller * detailviewcontroller = (quiztipviewcontroller *) segue.destinationviewcontroller; detailviewcontroller.delegate = self; detailviewcontroller.tiptext = self.quiz.currenttip; [detailviewcontroller.numbertipstext settext:[nsstring stringwithformat:@"pistas para la respuesta (usadas %ld de 3)", (long)self.quiz.tipcount]] ; nslog(@"%d", self.quiz.tipcount); nslog(@"%@", detailviewcontroller.numbertipstext.text); } } the last

junit - Testing Storm Bolts and Spouts -

this general question regarding unit testing bolts , spouts in storm topology written in java. what recommended practice , guideline unit-testing (junit?) bolts , spouts ? for instance, write junit test bolt , without understanding framework (like lifecycle of bolt ) , serialization implications, make mistake of constructor-based creation of non-serializable member variables. in junit, test pass, in topology, wouldn't work. imagine there many test points 1 needs consider (such example serialization & lifecycle). therefore, recommended if use junit based unit tests, run small mock topology ( localmode ?) , test implied contract bolt (or spout ) under topology? or, ok use junit, implication being have simulate lifecycle of bolt (creating it, calling prepare() , mocking config , etc) carefully? in case, general test points class under test (bolt/spout) consider? what have other developers done, respect creating proper unit tests? i noticed there topology test

f# - When executed will this be a tail call? -

once compiled , ran behave tail call? let rec f accu = function | [] -> accu | h::t -> (h + accu) |> f <| t maybe there easy way test behavior i'm not aware of, might question. i think easier see if not use pipelining operator. in fact, 2 pipelining operators defined inline , compiler simplify code following (and think version more readable , simpler understand, write this): let rec f accu = function | [] -> accu | h::t -> f (h + accu) t now, can read definition of tail-call on wikipedia , says: a tail call subroutine call happens inside procedure final action; may produce return value returned calling procedure. so yes, call f on last line tail-call. if wanted analyze original expression (h + accu) |> f <| t (without knowing pipelining operators inlined), becomes ((h + accu) |> f) <| t . means expression calls <| operator 2 arguments , returns result - call <| tail call. the <| operator define

java - XML Signature Validation -

i have problem can't figure out how solve. application receives (supposedly) signed xml , have validate if right. here's signature part of receive in xml <signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <signedinfo> <canonicalizationmethod algorithm="http://www.w3.org/tr/2001/rec-xml-c14n-20010315" /> <signaturemethod algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <reference uri="35121103220612000188550010000000131000009300"> <transforms> <transform algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <transform algorithm="http://www.w3.org/tr/2001/rec-xml-c14n-20010315" /> </transforms> <digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <digestva

command prompt - Excuting assembly file with PCSpim from cmd -

if me please, have pcspim simulator on windows 7 pc , want load file , run command prompt, possible print -in cmd window- output shown in pcspim's console after excution? in advance. this hlp file. pcspim supports rich command line argument format. can control core simulator settings, , specify file loaded automatically. command line options available are: -bare/-asm -trap/-notrap -trap_file <file> -delayed-loads -delayed-branches -quiet/-noquiet -mapped_io/nomapped_io -file <file> <args> note -file <file> argument, if specified, must come last. after -file <file> option considered run-time arguments, , saved first time program executed. so -file command need load file. something might create file.txt results in: pcspim -file myfile.ext >file.txt

facebook - FQL - How do i filter friends based on their work history -

i trying filter friends based on work history using fql, fql not return results. here fql trying: select uid,username,work user uid in (select uid1 friend uid2 = $myid) , work.employer.id in ($someid) i result - { "data": [ ] } am doing wrong? this because work field doesn't obey other fields due how arrays set each each work object. example strlen(work.employer.id) gives 0. so in short fql doesn't support feature. can try submitting bug report.

objective c - Sorting an NSTableColumn using transformed values -

my class has property enum . property bound nstablecolumn . typedef enum _status { unknown=0, win, osx } status; in order make sure nstablecolumn shows proper string representation, instead of displaying numeric 0, 1, , 2, use nsvaluetransformer . so unknown becomes "unknown os". win becomes "ms windows" , osx becomes "osx 10.8". table column displays these values correctly. i need sort column using transformed values. if use [nssortdescriptor sortdescriptorwithkey:@"status" ascending:yes selector:@selector(compare:)]; the column sorted in order: unknown os ms windows osx 10.8 which make sense because 0 < 1 < 2. require sorted using string counterparts, make it: ms windows osx 10.8 unknown os how can without changing order of enum? you're using standard compare: method in selector. it's comparing enums. create own m

Identifying Late binding in VB.NET -

i have application had been migrated vb vb.net. in few places in vb there code written using trim operation on non-string datatype. code runs in vb same produce error on migrated code in vb.net.following code snippet dr["n0"].trim() ----where "no" integer or non-string datatype i want identify these places in migrated vb.net code base. how can without minimal effort? efficient idea or technique? just gate these typeof http://msdn.microsoft.com/en-us/library/0ec5kw18.aspx , use debug.alert(); you're going through program alerted (in debug mode).

ruby gsub function in java, replaceAll maybe? -

i've been trying translate this funcformat = funcformat.gsub(/sqrt\((.*)\)/,'math.sqrt(\1)') to in java funcformat = funcformat.replaceall("sqrt((.*))","math.sqrt($1)"); or there way of formatting math text?, example : 2x^2sqrt(x^3/2) 2xpow2sqrt(xpow3/2) thank you, , way i'm new in site. you can use following expression: funcformat = funcformat.replaceall("sqrt\\(([^)]*)\\)", "math.sqrt($1)"); although seems don't need regexes here. simple funcformat = funcformat.replace("sqrt", "math.sqrt"); seems work situation.

html - Odd browser compatibility issue with IE/Firefox -

i have login script based on php , javascript. couldn't figure out longest time why work in chrome , safari not in firefox or internet explorer. figured out issue html, instead of having regular submit button have image submit. , changing type="image" type="submit" resolves issue. know why , if there's compatible way write following this works: <input name="dologin" type="submit" style="margin-left:90px;" id="dologin3" value="login"> this not: <input name="dologin" type="image" src="login-btn.png" style="margin-left:90px;" id="dologin3" value="login"> if not going using js submit form, input type submit button should submit. if must have image in place of button, position image css setting background of button. no need change input type image. hope helps.