Posts

Showing posts from February, 2013

Sync server side updated properties with breeze -

i have breeze web api controller , entities properties createdby , createdtime set code in dbcontext (not sql server). there easy way sync these property values on save? @jay: 1 option can explore require restructuring. , not want breeze assembly refs in data access layer. have dbcontext overrides savechanges() , handles writes createdby , createdtime. another solution may re-query entity after update. there easy way that? know breeze entitymanager provides list of entities updated when changes saved. i'll dig around in api bit more.

c# - System.IO.IOException error -

i wrote program reads serial port. no problem program run on computer has visual studio installed. ok. when copied release folder program , run have error system.io.ioexception . use code read data serial port. byte[] buffer = new byte[42]; int readbytes = 0; int totalreadbytes = 0; int offset = 0; int remaining = 41; try { { readbytes = serial.read(buffer, offset, remaining); offset += readbytes; remaining -= readbytes; totalreadbytes += readbytes; } while (remaining > 0 && readbytes > 0); } catch (timeoutexception ex) { array.resize(ref buffer, totalreadbytes); } utf8encoding enc = new utf8encoding(); recieved_data = enc.getstring(buffer, 27, 5); dispatcher.invoke(dispatcherpriority.send, new updateuitextdelegate(writedata), recieved_data); how can solve problem ? it seems reading more bytes port have transmitted, should check bytestoread property check how many are. byte[] buffe...

android - KSOAP2 returning a error while trying to pass a path as a property -

i have webservice soap, want access android in nexus 4. when try put string path property, im getting error, soapfault: system not find specified path (or that). this code of method: public void uploadimage() throws ioexception, xmlpullparserexception{ string path = pathimg; string name = nomeimg; soapobject soap = new soapobject(name_space,"uploadimage"); soap.addproperty("pathimg", path); soap.addproperty("nameimg", name); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.setoutputsoapobject(soap); log.i("ngvl", "chamando uploadimage"); httptransportse httptransport = new httptransportse(url); httptransport.call(method_upload_image, envelope); object msg = envelope.getresponse(); log.i("ngvl", "mensagem:" + msg); } this logcat: 07-17 09:22:12.971: w/system.err(4090): soapfaul...

html - jQuery on click with radio button should show the particular div -

in html markup this <div id="sales-menu-wrp"> <div class="radio-buttons-wrap"> <input type="radio" id="create_sales" name="toggler"/>create sales <input type="radio" id="manage-sales" name="toggler" checked="checked" /> manage sales </div><!--.radio-buttons-wrap--> <div id="sales-details-form" style="display:none;" > <div class="sales-product-details-wrap"> <table id="sales-details-heading"> <tr> <th>products</th> <th>description</th> <th>unit cost</th> <th>quantity</th> <th>discount type</th> <th>discount price</th> <th>price</th> </tr> </table> <table id="sale...

JQuery Show local div on multiple div rows -

i dynamically displaying multiple rows of div's. div sets this: <div class="triggerbutton"> <img src="/images/clickme.png" alt="" /> </div> <div class="hiddendivs" style="display:none;"> stuff here </div> i using jquery: $('.triggerbutton').click(function() { $('.hiddendivs').show('slow'); }); but want hiddendivs after triggerbutton showed , not hiddendivs available. how can this? assuming hiddendivs next sibling use $('.triggerbutton').click(function() { $(this).next().show('slow'); });

.net - Does the .exe file produced by the C# compiler consist solely of Common Intermediate Language(CIL)? -

i trying better grasp on happens in simple scenario when following code added file , saved .cs extension: public class helloworld { public static void main() { system.console.writeline("hello world!"); system.console.readline(); } } and program run @ windows command line with: c:\windows\microsoft.net\framework\v4.0.30319>csc /t:exe /out:c:\helloworld\helloworld.exe c:\helloworld\helloworld.cs i can see process produces .exe file, when reading compile process on wikipedia states: source code converted common intermediate language (cil), cli's equivalent assembly language cpu. cil assembled form of so-called bytecode , cli assembly created. upon execution of cli assembly, code passed through runtime's jit compiler generate native code... the native code executed computer's processor. so .exe file consist solely of common intermediate lanaguage? , file wikipedia article refers 'cli assembly'? i'm bit...

google app engine - Accessing Gmail inbox in GAE with Java -

i'm trying access gmail inbox in gae java. i've tried via imap , via pop3. code imap next one: public class inboxservlet extends httpservlet { private static final logger log = logger.getlogger(inboxservlet.class.getname()); public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { properties props = system.getproperties(); props.setproperty("mail.store.protocol", "imaps"); props.put("mail.imap.host" , "imap.gmail.com"); props.put("mail.imap.user" , "email"); props.put("mail.imap.socketfactory" , 993 ); props.put("mail.imap.socketfactory.class" , "javax.net.ssl.sslsocketfactory" ); props.put("mail.imap.port" , 993); session session = session.getdefaultinstance(props , new authenticator() { @override protected passwordauthentication getpasswordauthentication() { ...

ios6 - Still no UIDocumentInteractionController in iOS 6 -

i have followed suggestions in existing questions on topic ( uidocumentinteractioncontroller doesn't work since ios6 , uidocumentinteractioncontroller no longer works in ios6 ), i'm still having trouble uidocumentinteractioncontroller under ios 6. my app single uiview ( myview ) implements uidocumentinteractioncontrollerdelegate , there no view controller. in touchesbegan , there following code: uidocumentinteractioncontroller *dic; dic = [uidocumentinteractioncontroller interactioncontrollerwithurl:fileurl]; dic.delegate =self; [dic retain]; if([dic presentoptionsmenufromrect:cgrectzero inview:myview animated:no]) result=1; this works fine on ios 5, list compatible apps presented, apps start when selected , load file specified in fileurl . on ios 6, nothing happens, result still indicates success. if options menu hidden. could because i'm using ios sdk 4.3? yes, because using ios sdk 4.3. after switching 6.1, works fine. (if wonder why use old...

android.os.NetworkOnMainThreadException - XML Parsing -

this question has answer here: how fix android.os.networkonmainthreadexception? 45 answers i'm working on project right , xmlparser.java makes application force close on devices android 4.0 or newer. know should implement async don't know how. can me? here code of xmlparser.java : import *stuff public class xmlparser { public xmlparser() { } public string getxmlfromurl(string url) { string xml = null; try { // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httpget httppost = new httpget(url); httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); xml = entityutils.tostring(httpentity); } catch (unsupportedencodingexception e) { e.printstacktrace(); } catch (clientpro...

arcmap - Passing a variable to Select By Attributes using a 'for' loop in Python -

i'm trying write script using 'select attribute' in arcmap. want create loop pass value select attribute expression. thinking along lines of: (x=number of polygons in shapefile) for j in range(0,x,1): arcpy.makefeaturelayer_management ("layer", "temp") arcpy.selectlayerbyattribute_management ("temp","new_selection",""" "id" > j""") arcpy.copyfeatures_management("temp","slopeg5") the rest of scripting should able handle, when run this, error code 000358, saying expression isn't valid. arcmap doesn't appear 'j' within select attributes. the overall goal isolate polygon, use select location find polygons intersecting, find area of two, , divide percentage of main polygon covered second. hopefully description clear enough help i don't know arcmap, you're passing literal string "j" comparison, rather value of variabl...

asp.net - RadGrid - How do you change HeaderText of Bound field? -

i using radgrid , had autogenerated set true. results in column header text of the database field cap_name. in asp.net gridview change (after setting autogeneratedcolumns false: <columns> <asp:boundfield datafield="cap_name" headertext="capability" sortexpression="cap_name" /> </columns> i set autogenerated colums false , tried use boundfield compiler said use telerik:gridcolumn. how use similar result? use <rad:gridboundcolumn headertext="capability" uniquename="clmcapability" datafield="cap_name" /> . note : replace <rad: prefix use radgrid control when register it. can find tagprefix in : <%@ register assembly="radgrid.net2" namespace="telerik.webcontrols" tagprefix="rad" %> you can't use asp:boundfield because asp.net gridview, while using telerik radgrid edit : <rad:radgrid id="myradgrid...

c++ - Why must my global variable be declared as a pointer? -

when compiling c++ program receive no errors, within unordered_map hash function fails, attempting mod 0. (line 345 of hashtable_policy.h of stl) i've found fix, don't know why i'm having problem begin with. struct looks this, (sorry specific code.) struct player { private: entity& entity = entitymanager->create(); public: player() { entity.addcomponent(new positioncomponent(0, 0)); // add component uses unordered map. } }; player playerone; // error perpetuates through constructor. however, if declare playerone pointer, so: player* playerone; and call: playerone = new player(); i not have issues. i've been searching - no success. doing wrong? when use player global, you've no idea if entitymanager (presumably global) has been initialised yet - order of initialisation of globals isn't defined. when use pointer , initialise new (in main(), presume), globals have been created then, code works. this highl...

encoding - Storing hindi in lang.properties in java and retrieving it -

i want read hindi text lang.properties(java.util.properties) file. using eclipse ide. first of how can save(or write) hindi letter in .properties file secondly how read string java class. lang.properties hinditext=साहिलसाहिल java class properties prop = new properties(); prop.load(mycalss.class.getclassloader().getresourceasstream("lang.properties")); string hindi=prop.getproperty("hinditext"); it's not working. as documented , properties.load(inputstream) use iso-8859-1 encoding, , encoding doesn't handle characters you're interested in. options: wrap stream in inputstreamreader , specify encoding explicitly use unicode escaping (e.g \u1234 ) in file characters not in iso-8859-1 (and make sure file saved iso-8859-1)

Bukkit - Send data back to people connected through RCON -

i have nodejs / socketio app connects minecraft server through rcon protocol , works perfectly, keep connection open , listens kind of data retrieved. example, if type command isn't available, respond message. now i'm trying whenever player on minecraft server chats, bukkit plugin take message , send through connected on rcon. this part of bukkit plugin fires when player chats. @eventhandler public void onplayerchat( asyncplayerchatevent e ) { bukkit.getlogger().info("test 1"); this.getlogger().info("test 2"); bukkit.getserver().getconsolesender().sendmessage("test 3"); this.getserver().getconsolesender().sendmessage("test 4"); } the messages recorded in server log, though not through rcon protocol. rcon used minecraft not have mechanism send messages after initial packets. if need mechanism this, need invent own protocol, or make command returns last chat log if it'...

c - How can I display the output for sigusr1 and sigusr2? -

i beginner in c , system programming. wrote program , should display following: caught sigusr1 caught sigusr2 caught sigint however, when "./test.c", thing see "caught sigint" when type ctrl-c. how can fix code program displays messages above? sorry if question dumb. appreciated. reading. edited: #include <signal.h> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> static void sighandler_sigusr1(int sig) { //sig contains signal number received printf("caught sigusr1, %d\n", getpid()); //kill(getpid(), sigusr1); } static void sighandler_sigusr2(int sig) { //sig contains signal number received printf("caught sigsr2, %d\n", getpid()); //kill(getpid(), sigusr2); } static void sighandler_sigint(int sig) { //sig contains signal number received printf("caught sigint, existing, %d\n", getpid()); //kill(getp...

PowerShell Community Extensions not Recognized by TeamCity PowerShell Runner -

when teamcity powershell runner runs .ps1 file doesn't recognize write-zip command, part of powershell community extensions. i can run same command manually on build server , works fine. i've verified both teamcity , running x64 version of powershell.exe , both running same user. [17:21:22][step 5/5] packaging www.zip [17:21:45][step 5/5] write-zip : term 'write-zip' not recognized name of cmdlet, [17:21:45][step 5/5] function, script file, or operable program. check spelling of name, or [17:21:45][step 5/5] if path included, verify path correct , try again. [17:21:45][step 5/5] @ [17:21:45][step 5/5] c:\teamcity\buildagent\work\e19b1309c030c7e2\build\powershell\package.ps1:20 [17:21:45][step 5/5] char:1 [17:21:45][step 5/5] + write-zip -inputobject $items -outputpath .\www.zip [17:21:45][step 5/5] + ~~~~~~~~~ [17:21:45][step 5/5] + categoryinfo : objectnotfound: (write-zip:string) [], commandno [17:21:45][step 5/5] tfoundexception [17:21:45...

c# - Combining XSLT & msxsl with structs -

i've been digging xslt more , more these days issue has me scratching head past few hours now. i have following xslt script, used within server environment receive , process part of soap envelope. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:test="" exclude-result-prefixes="msxsl test"> <xsl:output method="xml" omit-xml-declaration="yes" indent="no"/> <msxsl:script implements-prefix="test" language="c#"> public param getparam() { // code here } </msxsl:script> <xsl:template match="/"> <xsl:choose> <xsl:comment>used it_e items</xsl:comment> <xsl:when test="helloworld"> <xsl:text>helloworld|clientdata|username|</xsl:text> <xsl:...

vb.net - LinqPad Error: Lambda expression cannot be converted to 'String' because 'String' is not a delegate type -

when using linqpad following error: lambda expression cannot converted 'string' because 'string' not delegate type. when copying in following code. any idea wrong. using entity framework , have linqpad configured read off entity framework object. can use linqpad create ef queries or strictly linq? dim db planitentities = new planitentities dim projects = p in db.projects.include(function(p) p.availablespacetypes) _ .include(function(p) p.disadvantagedegree) _ .include(function(p) p.fundingsources) _ .include(function(p) p.partnerapprovalstatuscode) _ .include(function(p) p.physicalconstrainttypes) _ .include(function(p) p.policyconstrainttypes) _ .include(function(p) p.profile) _ .include(function(p) p....

html - How snuggle DIV to bottom side -

Image
i have block: <div class="block"> <div class="image"> <span class="grow">4</span> <img src="images/rate_doctor_photo.png"> </div> <div class="rate" style="background:#00a7ff"> <div class="ln"></div> <span>Алексей Романов Олегович</span> </div> </div> how shuggle block class="image" block class="rate" remark: bloks class="rate" have different height always try so: .image, .rate{ display:inline-block; vertical-align:bottom; margin-left:-4px; } http://jsfiddle.net/dacrosby/7xjtc/

java - How to center a Button using a FormLayout in SWT? -

Image
how can position button (vertically) @ center using formlayout (see here )? using: final button button = new button(shell, swt.none); button.settext("button"); final formdata layoutdata = new formdata(); layoutdata.top = new formattachment(50); layoutdata.left = new formattachment(0); layoutdata.right = new formattachment(100); button.setlayoutdata(layoutdata); i end which not surprising, since told put top of button @ center ( layoutdata.top = new formattachment(50); ). how can instead put center of button @ center? you can specify offset constructor: new formattachment(int numerator, int offset) looks this: you can compute offset using: final button button = new button(shell, swt.none); button.settext("button"); final formdata layoutdata = new formdata(); /* compute offset */ int offset = -button.computesize(swt.default, swt.default).y / 2; /* create formattachment */ layoutdata.top = new formattachment(50, offset); layoutdata....

ruby - How do I specify the host for links in mail notifications in Gitlab? -

i have gitlab running behind proxy, gitlab running on port 3000 not accessible outside. mail notifications generated gitlab contain urls port 3000 in them, can configure gitlab generate links accessible outside? i found gitlab email setup not have email:host: or in gitlab.yml i'm running gitlab 5.2.0 right now. edit: appreciate link info config options in gitlab.yml... the setting indeed in gitlab/config/gitlab.yml , isn't clear anymore (config names , comments changed in gitlab 5.0 think). the section ## web server settings used generate links in emails. settings referring emails email_from: , support_email: host: , port: , https: used links in emails. the actual ip , port settings can found in puma.rb config file why confident enough tinker around gitlab.yml settings , worked. solution problem: comment production:gitlab:port: setting or change external port.

html - Ribbon navigation bar(Navbar) float position of flaps -

can suggest me how rid of space after ribbon navbar in following fiddle: http://jsfiddle.net/bc3fl/ ? i know why created cant figure out how avoid except giving fixed negative margins elements below bar.. also, tried absolute position flaps wont work different browser's height width varies. , overflow:hidden container wont work too: http://jsfiddle.net/kbs42/ flaps must above navigation bar. and basic code of fiddle be: <div id="navigation_container"> <!-- left side of fork effect --> <div class="l-triangle-top"></div> <div class="l-triangle-bottom"></div> <!-- right side of fork effect --> <div class="r-triangle-top"></div> <div class="r-triangle-bottom"></div> <!-- ribbon body --> <div class="rectangle"> <!-- navigation links --> <ul id="navigation2"> <li><a href="index.html"> home...

php - Can i use two quotations with Array()? -

i translate website french, know if correct $lang = array( "tittle" => "c'est bien", "desc" => "bienvenue sur mon site", ); if use: 'tittle' => 'c'est bien', i error. there nothing can't mix string delimiters convenient $lang = array( 'tittle' => "c'est bien", 'desc' => 'bienvenue sur mon site', ); personally, use single quotes around simple strings, rather use double quotes in case rather escape. me seems more readable.

haskell - Why is there no typeclass for container-types? -

i found out containers have similar function set. list, set, sequence, text , bytestrings example. wonder why don't use 1 or more common typeclasses. actually there are, see question making single function work on lists, bytestrings , texts (and perhaps other similar representations) , duplicate of yours. the main reason being in separate package needs language extension - either functional dependencies or type families. have somehow text can contain char s, bytestring can contain word8 s, [] can contain type, , set can contain instances of ord .

list - SharePoint 2010 LIstData Service Server Errors -

does know if there way server errors listdata.svc in sharepoint 2010 without setting callstack true in web.config site? the client deploying not allow callstack set true security purposes. however, have itemeventreceivers catch processing errors need return can inform end users have made mistake, can't find alternative method callstack setting errors server. you say: "processing errors need return can inform end users have made mistake", if it's throwing error due user error it's not user mistake application design problem. for instance should validate data before trying commit list , not rely on exception warn user mandatory fields, etc. having said this, can use custom tracer , send exception uls logs can analyse it. another option hook sort of email notification when error happen , dump exception details on email. hooked elmah sharepoint , works great

redis dump.rdb file not loading up -

i using redis 2.6.9. @ moment, not version of redis dump.rdb file came (i trying copy on redis info computer - slave option if not work). dump.rdb file in parent redis directory. in redis.conf file, names , directory locations appear match have. not believe have file permissions issue. however, when start redis server, not appear read dump file , there no keys etc in redis once server up. redis.conf dbfilename dump.rdb dir ./ any useful suggestions troubleshoot/resolve issue appreciated. thanks ** update ** rdb file copied in wrong directory - moved src directory resolved issue (in retrospect, have changed config file point absolute pathname , should have done trick well). i placed dump.rdb file in src directory after redis able load data in dump file upon restart. dump.rdb file location specified in config file , points current directory default.

Angularjs remove button not working -

Image
i building shopping app. somewhere in app need show user’s shopping cart , let him edit it. have remove button not working ... <html xmlns="http://www.w3.org/1999/xhtml" ng-app> <head> <title>your shopping cart</title> </head> <body ng-controller="cartcontroller"> <h1>your order</h1> <div ng-repeat="item in items"> <span>{{item.title}}</span> <input ng-model="item.quantity" /> <span>{{item.price | currency}}</span> <span>{{item.price * item.quantity | currency}}</span> <button ng-click="remove($index)">remove</button> </div> <script src="js/angular.min.js"></script> <script> function cartcontroller($scope) { $scope.items = [ {title:'srimad bhagwat', quantity:8, price:3.95}, {title:'rupa chintamani', quantity:17, pri...

Rally SDK 2.0 JavaScript Query Filtering -

i'm trying apply filter in userstories. filters not working , query returning stories selected project. i'm using following code: var estimatedstoriesquery = ext.create('rally.data.wsapidatastore', { model: 'userstory', storeconfig: { filters: [ {property: 'project.name', operator: '!=', value: 'null'}, {property: 'planestimate', operator: '!=', value: 'null'}, {property: 'schedulestate', operator: '=', value: 'accepted'}, {property: 'directchildrencount', operator: '=', value: '0'}, {property: 'accepteddate', operator: '<', value: 'lastmonth'} ] },}); ...

keypress - jQuery library for getting keyboard key pressed from code -

i'm having problems function turns keycodes keyboard keys. had giant switch statement, , if code were, say, 37, program output "left arrow key." problem is, different browsers not firing keypresses, , codes mixed up. instance, shift + 7 on mac running chrome outputs code 37, left arrow keypress. firefox on mac not tell me if tab key pressed, etc. here code working with: function getkey(code) { var keypress; // in case of special keys switch (code) { case 8: keypress = " backspace "; break; case 9: keypress = " tab "; break; case 13: keypress = " enter "; break; case 16: keypress = " shift "; break; case 17: keypress = " control "; break; case 18: keypress = " alt "; break; case 20: ...

matlab - Why can't I describe Simulink.MSFcnRunTimeBlock -

despite fact, simulink.msfcnruntimeblock class lot of members, command ? returns empty matrix: >> ?simulink.msfcnruntimeblock ans = 0x0 class array properties: name description detaileddescription hidden sealed abstract constructonload handlecompatible inferiorclasses containingpackage propertylist methodlist eventlist enumerationmemberlist superclasslist update properties simulink.msfcnruntimeblock also returns "no properties class simulink.msfcnruntimeblock or no class simulink.msfcnruntimeblock." despite fact class has allowsignalswithmorethan2d , dialogprmstunable , nexttimehit properties according docs. why?

java - Formatting time properly from miliseconds -

i timing event this: seconds = system.currenttimemillis() / 1000; // happens here time = system.currenttimemillis() / 1000 - seconds; and have attempted format it: string time = string.format("%d min, %d sec", timeunit.milliseconds.tominutes(time), timeunit.milliseconds.toseconds(time) - timeunit.minutes.toseconds(timeunit.milliseconds.tominutes(time))); and results don't make sense, minutes thousands seconds seem normal numbers. proper way format time? long milliseconds = system.currenttimemillis()%1000; long seconds = (system.currenttimemillis()/1000)%60; long minutes = (system.currenttimemillis()/(60*1000))%60; long hours = (system.currenttimemillis()/(60*60*1000)); leave out whatever parts don't want , remove modulus highest 1 do.

ruby on rails - Bundle install gets permission issues with global RVM install -

so have global install of rvm on machine on school cluster have multiple users using school project. when run bundle install following error: bundle install fetching gem metadata https://rubygems.org/......... fetching gem metadata https://rubygems.org/.. resolving dependencies... mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/rake-10.1.0.gem': permission denied using rake (10.1.0) mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/i18n-0.6.1.gem': permission denied using i18n (0.6.1) mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/multi_json-1.7.7.gem': permission denied installing multi_json (1.7.7) mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/activesupport-3.2.13.gem': permission denied using activesupport (3.2.13) mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/builder-3.0.4.gem': permission denied using builder (3.0.4) mv: cannot remove `/home/benjamin/.bundler/tmp/29173/cache/activemodel-3.2.13.gem...

java - Issue with getting init parameters -

out.println("<br>" + getservletconfig().getinitparameter("ad")); out.print("<br>" + getservletcontext().getinitparameter("email")); i have jsp page. when run app returns null, instead of email. but when use in servlet code runs fine. here complete code: <% list styless = (list) request.getattribute("styles"); int n = styless.size(); (int = 0; < n; i++) { out.print("<br>" + styless.get(i)); } out.println("<br>" + getservletconfig().getinitparameter("ad")); out.print("<br>" + getservletcontext().getinitparameter("email")); %> in code neither servletconfig or servletcontext working both returning null,but same thing working in servlet web.xml <servlet> <servlet-name>ch3 beer</servlet-name> <servlet-class>action.beerselect</servlet-class> <init-param> <param-name...

python - UWSGI connection refused from urllib2, but only if UWSGI is running as a service -

i'm deploying flask application via uwsgi , nginx on pretty vanially ubuntu 13.04 install. 1 of things need post data server raspberry pi, doing using urllib2. if run uwsgi manually running uwsgi --ini file, works swimmingly. if run uwsgi doing sudo service uwsgi start, can access user facing stuff correctly web browser, raspberry pi python app gets http error 500: internal server error. my uwsgi init script: description "uwsgi" start on runlevel [2345] stop on runlevel [06] respawn exec uwsgi --ini /path/to/file.ini any appreciated.

php - Cannot pass $pdo as parameter in function triggered with onclick() -

i have html button has onclick method, triggers things happen ajax. variables passed through function, however, in php. here code: html/php #do not mind first forward slash# /<button type="submit" name="follow_button" onclick= <?php echo "'follow_alert(" . $pdo . ", " . $_session['user_id'] . ", " . $value['user_id'].");'" ?> >follow </button> both variables $_session['user_id'] , $value['user_id'] passing fine. have tried code , works without $pdo, problem need $pdo called access in php function fetches data mysql table. here js. js function follow_alert(pdo, user_id, following_id) { var ajax = ajaxrequest(); ajax.onreadystatechange = function() { if (ajax.readystate === 4) { alert(ajax.responsetext); }; }; ajax.open('get', 'function.php?pdo='+pdo+'&user_id=...

c++ - How can a QWidget get the "entire" parent? -

i have instantiated widgetclass in mainwindow.cpp. want pass in "this" widget more (qwidget* parent) (mainwindow* parent). on build, widgetclass established before mainwindow , errors out. i want instancevariables in mainwindow?? ie: mywidget(qwidget* parent, mainwindow* parent); there issues on such task.. maybe problem have use forward declaration include 1 class in 1 other include first ones.. or maybe fact default constructor of qwidget has first argument default parameter.. error exactly? anyway, here complete example: mainwindow.h #ifndef mainwindow_h #define mainwindow_h #include <qmainwindow> #include "mywidget.h" namespace ui { class mainwindow; } class mainwindow : public qmainwindow { q_object public: explicit mainwindow(qwidget *parent = 0); ~mainwindow(); int foo(int n); private: ui::mainwindow *ui; mywidget *w; }; #endif // mainwindow_h mainwindow.cpp #include "mainwindow.h"...

Is there any way to use contructor injection using Autofac in a Xamarin.Android project? -

i'm throwing on xamarin.android version of existing app built heavily on microsoft stack (w8/wp8/silverlight etc..) , autofac used extensively throughout. autofac prefers showing dependencies through constructor parameters, of course assumes i, coder, have control of creation of viewmodels/controllers, or in android's case... activities. my question is: there way can use autofac in desired way considering android framework responsible activity creation? there can intercept activity creation resolve dependencies way autofac designed? a possible workaround subclass activity, , mark dependencies custom attribute on writable properties. then can use reflection yank properties out , inject them using autofac. not follow autofac's convention of marking dependencies in constructors, gets job done , injects properties mef does. public class autofacactivity : activity { private static containerbuilder containerbuilder { get; set; } protected override v...

visual studio - vb.net progress bar is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum' -

private sub timer1_tick(byval sender system.object, byval e system.eventargs) handles timer1.tick if progressbar2.value = 100 progressbar2.value = progressbar2.maximum() msgbox("posting completed!") progressbar2.enabled = false else progressbar2.value += 5 loop end if end sub it's been 3 hour i'm working figure problem is, until still can't find solution this, no error until run it, gives me error value of '105' not valid 'value'. 'value' should between 'minimum' , 'maximum'. parameter name: value i set my progressbar2.minimum = 0 progressbar2.maximum = 100 please me out :( something wrong in code above. the loop progressbar2.value += 5 loop will never stop , when reaches 100 increment past maximum value. no, test @ entry of method not executed while inside loop you should increment 1 time , exit loop , wait next...

c# - ReportViewer cutting off top of report when zoomed -

we have report running out of sql server reporting services works fine. when zoomed 150% looks correct. (seen here http://i.imgur.com/peebjyx.png ) i built asp.net page display report using reportviwer. displays report fine , works (seen here http://i.imgur.com/gn0ybtl.png ) the problem can't zoom in. zooms in weird , cuts off top of page (seen here http://i.imgur.com/dn5uxga.png ). here reportviewer code in aspx page. <rsweb:reportviewer id="reportviewer1" runat="server" processingmode="remote" sizetoreportcontent="true"></rsweb:reportviewer> here end c# code void renderreport() { //string sitename = getcurrentsitenamefromsiteid((int)session["siteid"]); int siteid = (int)session["siteid"]; uri reporturi = new uri(webconfigurationmanager.appsettings["reportserveruri"]); reportviewer1.processingmode = processingmode.remote; ...

Should I shuffle the list before quicksort in OCaml? -

it suggested shuffle array before quicksort it. however, if want quicksort list, shuffling list first take o(nlogn) , example, assign random key each item in list , mergesort (key, item) list. then my question is: if have spend o(nlogn) shuffle list first, what's point of implementing quicksort list in ocaml? we should use mergesort directly, right? in op's question: however, if want quicksort list, shuffling list first take o(nlogn) i think random shuffling costs o(n) time if first convert list array , use fisher–yates shuffle , algorithm used in python's random.shuffle.

ruby on rails - Assets showing on localhost but not heroku -

ready incredibly confusing? http://localhost:3000/assets/facebook.png this shows fine. when push heroku, of other assets appear except facebook.png. can't explain it, can't figure out. else works fine. i've run rake assets:precompile so isn't issue. fun, deleted gemfile.lock, bundled, , pushed again. there's nothing can see or find makes me think image isn't making up- isn't somehow. ideas, thoughts? answering 1 of questions! after hour of searching around found rails 4 hates me, or rather, hates old code i'm running. listened heroku during push, , suggested use gem rails_12factor. looked @ git here: https://github.com/heroku/rails_12factor , turns out addresses issue. locally works peachy, when go production rails using nginx. rails_12factor instead routes assets pipe, makes more sense anyway. i hope solution of use else out there, because sure frustrated me couple of hours (even before posted q earlier ;) )

php - How to do method chaining with DOMDocument? -

do method chaining with php easy . need this, $xml = $dom->transformtothis('file1.xsl')->transformtothis('file2.xsl')->savexml(); or $books = $dom-> transformtothis('file1.xsl')-> transformtothis('file2.xsl')-> getelementsbytagname('book'); it possible php's domdocument or domnode ? class domxx extends domdocument { public function __construct() { parent::__construct("1.0", "utf-8"); } function trasformtothis($xslfile) { $xsldom = new domdocument('1.0', 'utf-8'); $xsldom->load($xslfile); $xproc = new xsltprocessor(); $xproc->importstylesheet($xsldom); $this = $xproc->transformtodoc($this); // error! return $this; } } // class the $this = x invalid construct in php, , not understand workaround explained here . can use $this->loadxml( $xproc->transformtodo...

android - Installation Error - D/InstallAppProgress(): Installation error code: -25 -

i trying install apk, has been signed production key (the same 1 have used app in play store). when try install test build (again, signed production key), can't install on original (can install if delete current production build first). worried when update app next time going cause issues. i error (this relevant line in logcat, no other output has anything): d/installappprogress(14669): installation error code: -25 i have updated adt since building previous release, , generate apk release directly out of ide (using android tools right-click menu main project). i not changing permissions or anything. have changed internal libraries (using new support lib instance). check version number in manifest. if version less 1 on device, not able over-install. you can install using adb using -r flag. see here http://developer.android.com/tools/help/adb.html

c# - IDictonary<string,object> object has multiple objects, how to seperate? -

i'm develop website asp.net mvc4 , mongodb database. microsoft membership provider support sql-db's, i've use membership provider. decided use extendedmongomembership provider. worked long had no additional user properties passed during account creation. tried add additional properties e-mail, functionality of createuserrow function throws , exception. i've downloaded source , try fix it. therefore have separate objects inside of objects, seems way how necessary data passed function. public bool createuserrow(string username, idictionary<string, object> values) { string usertablename = "users"; list<bsonelement> elements = new list<bsonelement>(); elements.add(new bsonelement("username", username)); elements.add(new bsonelement("_id", getnextsequence("user_id"))); if (values != null) { // here i'm facing problem have property names ...

iphone - Change UICollectionViewCell content and nib layout based on data -

i have uicollectionview displaying many uicollectionviewcells have subclassed cardcell. pass variable "type" cardcell in - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath want cardcell class able load different nib file depending on type passed in. different types need have different layouts. the problem cannot figure out change in cardcell.m. tried using - (void)prepareforreuse not call unless user scrolling. you should register each nib file need in viewdidload, (substituting correct names nib file , identifier): [self.collectionview registernib:[uinib nibwithnibname:@"rdcell" bundle:nil] forcellwithreuseidentifier:@"firsttype"]; then, in itemforrowatindexpath, test type , return correct type of cell: - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { if (type = @"firstty...

ios - Core Animation: Setting animated property correctly -

i trying build bar graph view using core animation , layers. make cooler tried let each beam pop bit, 1 after another. convenience flipped coordinate system of view vertically. here's code: - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { self.transform = cgaffinetransformmakescale(1, -1); self.values = @[@12.5f, @4.25f, @23.0f, @3.0f, @17.9f, @7.0f, @15.1f]; } return self; } - (void)didmovetosuperview { self.backgroundcolor = [uicolor whitecolor]; self.beamcontainer = [calayer layer]; cgrect frame = cgrectinset(self.bounds, 20, 20); self.beamcontainer.frame = frame; self.beamcontainer.backgroundcolor = [uicolor colorwithwhite:0.98 alpha:1].cgcolor; float maxvalue = [[self.values valueforkeypath:@"@max.floatvalue"] floatvalue]; (int = 0; < self.values.count; i++) { calayer *beam = [calayer layer]; cgfloat beamheight = ([self.values[i] floatvalue] * fr...

c++ - What causes IWICBitmapFrameEncode::SetPixelFormat to return a format different from the requested one? -

i've been using wic encode multiple images jpegxr format. occassionally, program logs error last logassert in following snippet of encode function. hr = m_pfactory->createencoder(guid_containerformatwmp, null, &pencoder); logassert(succeeded(hr),"failed create encoder. err: 0x%x", hr); hr = pencoder->initialize(poutputstream, wicbitmapencodernocache); logassert(succeeded(hr),"failed initialize encoder. err: 0x%x", hr); hr = pencoder->createnewframe(&pbitmapframe, &ppropertybag); logassert(succeeded(hr),"encoder failed create new frame. err: 0x%x", hr); setencodingproperties(ppropertybag); hr = pbitmapframe->initialize(ppropertybag); logassert(succeeded(hr),"failed initialize pbitmapframe given properties. err: 0x%x", hr); hr = pbitmapframe->setsize(rawwidth, rawheight); logassert(succeeded(hr),"failed set bitmap size. err: 0x%x", hr); wicpixelformatguid formatguid = guid_wicpixelformat24bppbgr;...

node.js - Mongodb Update Query Deletes All Array Fields Except Field Specified in Command -

i'm using node, mongodb, , mongoose. i've checked mongodb docs on set , update . i've googled little on hour , i've found topics dance around issue, nothing definitive though. query below updates correct field, removes other fields in array haven't specified. db.posts.update( { "_id" : { $exists : true } }, { $set : { usercreated : { "time" : new isodate("2013-07-11t03:34:54z") } } }, false, true ) this section of schema i'm trying modify: }, usercreated: { id: { type: mongoose.schema.types.objectid, ref: 'user' }, name: { type: string, default: '' }, time: { type: date, default: date.now } }, this comes out: }, "usercreated": { "time": { isodate("2013-07-11t03:34:54z") } }, you can update time property of usercreated , leave other properties alone using dot notation: db.posts.update( { "_id" : { $exists : true } }, { $set : {...

javascript - regex for getting text inside [bbcode] -

how text inside custom bbcode, [gallery] text [/gallery]. i using regex wont work /^(.*)\[gallery.*?\[\/gallery\](.*)$/gmi (new) try : /\[gallery\](.*)\[\/gallery\]/g to return value use var result = str.match(regex); alert(result[1]);

Very simple mysql query not using index -

sorting of mysql table not use index , don't know why. i've got: create table if not exists `test` ( `a` int(11) not null, `b` int(11) not null, key `kk` (`a`) ) engine=myisam default charset=utf8; and this: explain select * test order as this explain select * test use index ( kk ) order gives me this: id select_type table type possible_keys key key_len ref rows 1 simple test null null null null 10009 using filesort i'd not see filesort, , use key kk sort table. doing wrong? thank posts guys, answer question! however, not undestand meant "table scan" , "filesort"? if selecting fields , rows of table, isn't faster sort table 1 column walking in o(n) internal tree of index of column (and looking in table file columns requested, in o(1) each row => index file stores each row's physical position in table file, or?), sort e.g. quick sort in o(n * log n) (potentially) randomly stored rows in ...

algorithm - Find all triplets in array with sum less than or equal to given sum -

this asked friend in interview , not know of solution other simple o(n 3 ) one. is there better algorithm? the question find triplets in integer array sum less or equal given sum s. note: have seen other such problems on performance o(n 2 log n) of them solving easier version of problem arr[i] + arr[j] + arr[k] = s or checking whether 1 such triplet exists. my question find out i,j,k in arr[] such arr[i] + arr[j] + arr[k] <= s from worst-case asymptotic perspective, there no better algorithm since size of output potentially o(n^3) . e.g. let array numbers 1 through n . let s = 3n . clearly, subset of 3 array elements less s , there (n choose 3) = o(n^3) subsets. there few ways can speed non-worst cases though. example, try sorting array first. should give hints.

ruby on rails - Why this won't get faster even if I solved n + 1 issue? -

Image
i'm using gem called "bullet" in order avoid n + 1 issue. my previous code @communities = community.scoped.page(params[:page]).order("created_at desc") then getting errors n+1 query detected community => [:platform] add finder: :include => [:platform] n+1 query detected community => [:genre] add finder: :include => [:genre] n+1 query detected community => [:tags] add finder: :include => [:tags] then taking 650ms show page on 70 sql. changed this @communities = community.scoped.page(params[:page]).per(10).order("created_at desc").includes(:platform, :genre, :tags) now, alert of bullet gone it's taking 750ms , there still on 70 sql. why that? this result of how long it's taking show page(w/ rack-mini-profiler) for example, it's taking around 30ms each communities/_community it's because of count each communities/_community calls these 2 helpers. reason of large number of sql ...