Posts

Showing posts from April, 2013

vb.net 2010 - how to get all the words that start with a letter in a datatable? -

i'm using visual studio 2010 in spanish. have this: private sub filter(byval letter char) dim arrayrows() datarow arrayrows = table.select("desc_ art '" + letter + "%'") end sub so when parameter "letter" "a" rows desc_art starts "a". problem when parameter "letter" "c" don´t words second letter "h". it's program thinks "ch" letter. how can words who's first letter "c"? the "letter" parameters declared char, have tried declaring string?

c++ - Find all linesegments=edges within a certain distance to a point in a graph, how to combine boost-graph with boost-geometry? -

i have set of user paths (2 dim) in game setup modelled set of lines (arcs) , waypoints = vertices. whole set of paths can seen graph edges line segments have additional properties length, probability, etc. now have identify set of (straight) line segments = edges within distance user's current position in order find user's position in graph. how implement possible without reinventing wheel? how implement search efficiently? i thought of using boost-graph handling graph , combine boost-geometry. e.g. see trajgraph uses bundled properties in boost-graph: struct tvertex { float x, y; //vertex=waypoint position }; struct tarc_segment { float len, curvature, prob; //line segment=edge properties }; typedef adjacency_list<vecs, vecs, directeds, tvertex, tarc_segment> trajgraph; now in order store line segment edge property 1 add boost geometry's model::linestring , use boost-geometry's nearest neighbour query find line segments. afaik boost-geome

d3.js - CSS override isn't working (d3 object) -

i'm trying apply learned in css foundation course (codeschool) style d3 objects , far i'm not getting right. i have bunch of css classes style charts. have 2 types of charts, second type need override 1 color. main css (i didn't create myself) .horizon { border-bottom: solid 1px #000; overflow: hidden; position: relative; } .horizon { border-top: solid 1px #000; border-bottom: solid 1px #000; } .horizon + .horizon { border-top: none; } .horizon canvas { display: block; } .horizon .title, .horizon .value { bottom: 0; line-height: 30px; margin: 0 6px; position: absolute; text-shadow: 0 1px 0 rgba(255,255,255,.5); white-space: nowrap; } .horizon .title { left: 0; } .horizon .value { right: 0; } override css (for second type needed different color) (this used first file changing horizons horizon_small bad know.) .horizon .horizon_small { border-top: solid 1px #bdbdbd; border-bottom: solid 1px #bdbdbd; } applying here: d

jquery - clear div float css property -

i using jquery ui dialog component dialog button aligned right. reason because of following property gets set automatically. .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } if clear float: right property, alignment looks fine. tried through firebug. how clear css property css file? override property. should work. .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: none !important; } to avoid !important can try add css (your custom css file) after css of jquery ui. load order relevant.

JSON Result of a FHIR search -

in spec. documnent, http://www.hl7.org/implement/standards/fhir/query.htm#base the server returns results in http response bundle (in xml, atom feed) includes resources results of query in json, format required results ? it seems no json format defined atom feed. examples on servers on http://hl7connect.healthintersections.com.au/svc/fhir use straightforward conversion (xml -> json). confirmed ? imho, precision on expected format should explicitly defined. the json format bundles documented here: http://hl7.org/implement/standards/fhir/json.htm#json-bundles

php - Can't connect to localhost -

i learning php , working on script connects db , pulls data. the website have running on localhost php driven cms. a segment of script here define ('db_user','myname'); define ('db_password','somepass123'); define ('db_host','localhost'); define ('db_name','sitename'); // make db connection $dbc = @mysqli_connect('db_host','db_user','db_password','db_name') or die ('could not connect mysql: ' . mysqli_connect_error()); when load page draws on php receive following error output data meant be: could not connect mysql: unknown mysql server host 'db_host' (1) i did research on , googling around. suspect issue db_host defined elsewhere. plausible? i'm not experienced enough know if right path. i did find in config/database.php file, i'm not sure if it's relevant: $config['default'] = array( 'benchmark' => true, &

Setting Viewport on Google Maps when sending several addresses -

i have code send several addresses google maps. however, since i'm doing a series of geocodings, how can make viewport @ least center , zoom correctly on group? function dobatchgeocodeandsearch() { $('#loading').css('visibility', 'visible'); var lines = $('#styled').val().split('\n'); for(var = 0;i < lines.length;i++){ geocoder.geocode( { 'address': lines[i]}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { map.fitbounds(results[0].geometry.viewport); // map.setcenter(bounds.getcenter(), // map.getboundszoomlevel(bounds)); map.setcenter(results[0].geometry.location); remove map.setcenter call. last call map.fitbounds show markers, if there 1 marker, zoom in close though, may want handle specially. var bounds = new google.maps.latlngbounds(); for(var = 0;i < lines.length;i++){ geocoder.geocode( { 'address': lines[i]}, function(result

Templates now showing any errors in Django -

i have form registration. when try register, , fine, that, showing form validation errors in template, when there should be. forms.py: from django.contrib.auth.forms import usercreationform django.contrib.auth.models import user django import forms import re django.core.exceptions import objectdoesnotexist class usercreationform(usercreationform): class meta: model = user fields = ('first_name', 'last_name', 'username',) username = forms.emailfield(label='email', max_length=250) def save(self, commit=true): user = super(usercreationform, self).save(commit=false) user.email = user.username user.save() return user def clean_password2(self): if 'password1' in self.cleaned_data: password1 = self.cleaned_data['password1'] password2 = self.cleaned_data['password2'] if password1 == password2: return pa

php - Undefined $load property error after upgrading CodeIgniter 1.7 to 2.1 -

why error after upgrading codeigniter v1.7 v2.1? a php error encountered severity: notice message: undefined property: site::$load filename: libraries/website.php line number: 25 fatal error: call member function library() on non-object in c:\xampp\htdocs\travel\application\libraries\website.php on line 25 the library application/library/website class website extends ci_controller { public static $current_city; public function __construct() { $this->load->library('language'); // line 25 $this->language->loadlanguage(); $this->load_main_lang_file(); $this->load_visitor_geographical_data(); $this->load->library('bread_crumb'); } } you forgot call __construct method of ci_controller class: public function __construct() { // call ci_controller construct method first. parent::__construct(); $this->load->library('language'); // line 25

Can Plone search be configured to see portlet content? -

i realized plone search doesn't "see" content in portlets, after adding million static text portlets new website. there anyway can configured access content also? test example, search "gwynn" on our ca&es site in development: however "gwynn" shows in portlet on this page . the other solution can think of use "content portlets" instead, , switch "static text" portlets pages... not ideal though, because search result pull "content page" instead of actual page portlet displayed. this website running on plone 4.3. if you're using portal_catalog or supported search engine plugin collective.solr , ... i'd recommend implement custom indexer fulltext index, reads fulltext out of annotation storage , submits index. should quite easy, example see plone documentation: https://docs.plone.org/4/en/develop/plone/searching_and_indexing/indexing.html#full-text-searching

javascript - Displaying multiple Thumbnails not working -

so making "drop-zone" website. the user can drag , drop images on area , jpegs dropped on area displayed thumbnailes. made list of jpegs dropped on area , working fine. everytime new jpeg added list want display jpegs thumbnailes of size 100x150px. here code that. , here fiddle http://jsfiddle.net/cjkyj/2/ function displaythumbnailes( ) { //clear div. var outerdiv = document.getelementbyid('filechooserdiv'); while (outerdiv.haschildnodes()) { outerdiv.removechild(outerdiv.lastchild); } var div = document.createelement('div'); outerdiv.appendchild(div); //go on files , add thumbnails jpegs. for( var = 0; < files.size(); i++) { if( files.get(i).type == "image/jpeg") { var reader = new filereader(); reader.onloadend = function() { var result = reader.result; displaythumbnail( result, div ); } reader.readasdat

sql - Querying with where, having and order by together in mysql -

i have following table... id awaiting approve decline 100 1 0 0 100 1 0 0 102 1 0 0 103 0 1 0 104 0 1 0 104 1 0 0 106 1 0 0 107 0 1 0 107 1 0 0 107 1 0 0 i have following code,... select count(*) total ( select id table1 group id having count(*) = 2 , max(awaiting = 1) > 0 ) q what above code count id repeated twice , @ least 1 of id awaititng=1, but want is, want show above results repeated id listed if awaiting 1. (like id 100). from above query, result 2 (2) id's 100 , 104, because group id. now, how show result id's has awaiting=1, if id same (in case must hav

html - Line break depends on font size -

Image
browsers (i.e. chrome , firefox) break text differently depending on font size, if container size specified relatively font size see fiddle css #main { font-size: 12px; width: 10em; } <div id="main"> text </div> javascript $('#main').animate({'font-size': '20px'}, 10000); you see words jump between lines. similarly, depends on zoom level (but that's side issue): "share research" fits in line if zoom in. this looks rounding error. there way prevent it? can fix line break positions? of course, html not intended typesetting. need solution. converted page pdf wkhtmltopdf , html pdf2htmlex , worked, removes semantics html (paragraphs, lists etc.) , creates bitmaps list bullets. i'm looking alternative solution zoom content . real constraint using html wysiwyg editor input. i use solution. wherever want page break, put div instead of br <div class="lnbreak"&g

asp.net mvc 3 - Is it possible to use multiple SiteMapNodes with the same Controller and Action, but different titles? -

i constructing wizard, , use same "master" controller , action orchestrate child controller , action called implement step. i trying put breadcrumb trail represent wizard flow, difficulty. not helped fact 1 cannot have multiple "mvcsitemapnode"s in mvc.sitemap same controller , action. seems need master controller name ie "wizard" , "index" opposed child controller name ie "step1" , "index". so, on own, work: <mvcsitemapnode title="step1" controller="wizard" action="index" preservedrouteparameters="id" route="wizard"/> however do, multiple wizard steps: <mvcsitemapnode title="step1" controller="wizard" action="index" preservedrouteparameters="id" route="wizard"/> <mvcsitemapnode title="step2" controller="wizard" action="in

c++ - Strange behavior of glVertexAttrib3f on one machine -

i have weird problem simple opengl application not working on girlfriend's machine. @ first thought of kinds of problems code, break down code not working (not working means: triangle drawn correctly, black, is, without correct color): #include <stdio.h> #include <stdlib.h> #include <string> #define glew_static #include <gl/glew.h> #include <glfw/glfw3.h> #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include "../common/shader.h" const glfloat reticle_vertices[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f }; glm::mat4 mvp; glm::mat4 vp; const char *vertexsource = "#version 150\n" "layout(location = 0) in vec3 position;" "layout(location = 1) in vec3 color;" "out vec3 fragcolor;" "uniform mat4 mvp;" "void main() {" "gl_position = mvp * vec4(position,

playframework 2.1 - Kundera&MongoDB (in Play 2.1.3) bi-directional relationship doesn't get referenced correctly on the DB -

i'm using kundera mongo , play 2.1.3. application has user entity , document entity. user has multiple documents (onetomany) , document belongs user. first create , persist user , documents can added user. when create document , persist userid references user different userid of user entity. , user documents arraylist null. so here's relevant parts of entities: @entity(name="user") @table(name="user", schema="xpto@mongo") public class user { @generatedvalue @id @column(name="_id") private string userid; @required @column(name="name") private string name; (...) @onetomany(cascade = { cascadetype.all }, fetch = fetchtype.lazy, mappedby="owner") private list<document> documents; (...) } @entity(name="document") @table(name="document", schema="xpto@mongo") public class document { @generatedvalue @id @column(nam

c# - Return from asyncCallBack -

following tutorial http://msdn.microsoft.com/en-us/library/hh221581.aspx created httpwebrequest. producing code callback function: private void readcallback(iasyncresult result) { httpwebrequest request = result.asyncstate httpwebrequest; if (request != null) { try { webresponse response = request.endgetresponse(result); using (streamreader streamreader1 = new streamreader(response.getresponsestream())) { string resultstring = streamreader1.readtoend(); } } catch (webexception e) { return; } } } now got data in resultstring, can't return normal way because of call being async (as 1 can read here: asynccallback - have static / have return void? ). i can create global variables , safe resultstring global access everywhere, don't think proper way this.

plone - 'LocationError' on custom field after using a custom importer to import some dexterity based content types -

i've created importer custom dexterity content type. imports types fine, 'locationerror' when try view newly imported content following traceback: traceback (innermost last): module zpublisher.publish, line 60, in publish module zpublisher.mapply, line 77, in mapply module zpublisher.publish, line 46, in call_object module grokcore.view.components, line 140, in __call__ module grokcore.view.components, line 144, in _render_template module five.grok.components, line 130, in render module zope.pagetemplate.pagetemplate, line 132, in pt_render module zope.pagetemplate.pagetemplate, line 240, in __call__ module zope.tal.talinterpreter, line 271, in __call__ module zope.tal.talinterpreter, line 343, in interpret module zope.tal.talinterpreter, line 888, in do_usemacro module zope.tal.talinterpreter, line 343, in interpret module zope.tal.talinterpreter, line 533, in do_opttag_tal module zope.tal.talinterpreter, line 518, in do_opttag module zo

ruby - Rails 4: link_to submit form using ajax, how to imitate post request? -

in rails app want use able hide on wall doing ajax request , adding item id database. here request want imitate following: started post "/report_fixed_vulns" 127.0.0.1 @ 2013-08-19 21:28:45 +0100 processing reportfixedvulnscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"xxx", "report_fixed_vuln"=>{"report_id"=>"2", "vuln_id"=>"2", "user_id"=>"2"}, "commit"=>"create report fixed vuln"} i tried using following code this. <%= button_to 'submit', report_fixed_vuln_path(:report_fixed_vuln => {:report_id => @report_id, :vuln_id => plugin.first.id, :user_id => current_user.id}), :remote => true, :method => :put %> however generates different request: started put "/report_fixed_vulns/323?report_fixed_vuln%5breport_id%5d=323&report_fixed_vuln%5buser_id%5d

php - htaccess alias use - load/get file from other directory -

we use index of 1 directory generate content in other (fake) directories. searching here , everywhere on week didn't give working results. .htaccess alias directive should it, can't seem working. here's case: this main dir , file content loads database: /news/index.php these navigation links should load index.php /news, cat id's (this have working): /animal-news/cat=1 /car-news/cat=2 /music-news/cat=3 so these 3 dirs exist (or rather not if possible), , content loaded /news/index.php . so far came (the url should same though: ie: /animal-news/cat=1/) alias /animal-news/cat=1/ /news/index.php?cat=1/ anyhelp highly appreciated! thanks! alias isn't allowed in .htaccess, need use mod_rewrite rules. enable mod_rewrite , .htaccess through httpd.conf , put code in .htaccess under document_root directory: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewriterule ^[^/]+/([^=]+=[0-9]+)/?$ /news/i

css - Aligning vertically absolute element larger than container in Firefox -

i got problem search-fu not enough. made gallery carousel fixed height , width image list inside (displaying 1 li @ time). images positioned absolute (with margin:auto etc) inside relative li element. images larger container has overflow:hidden . images have max-width:100% creates desired effect smaller images centered within container , larger (higher) cropped can opened full version. .gallery-items>li { padding:0; margin:0; width:100%; height:100%; text-align:center; position:relative; overflow:hidden; } .gallery-items>li img { top:0; bottom:0; left:0; right:0; margin:auto; max-width:100%; max-height:none; height:auto; width:auto; position:absolute; } fiddle here http://jsfiddle.net/fw63c/1/ it works great (center of image in center of container) in ie8, ie9, opera 12/15, chrome in firefox larger images start beginning of container (like have top:0 . have idea how make work in ff (preferably using css) . in advance solution, fafel best way if don't h

Android - Webview truncates string -

i have webview trying show string: "--- @%-@%%#:-=%@+=%-#@##%@%--.....-=.-=:-:.........=----::::::::=---:::::::::::::.............................................::::.........................................- #+ ." however, string truncated , displayed in more 1 line, , can't figure out why. should displayed in 1 line. idea on how solve issue? this how populating webview: web.loaddatawithbaseurl(null, s, "text/html", "utf-8", null); where s string showed. thanks in advance

python - Conversion from dictionary to list preserving elements -

i've problem conversion this: counter({('pintor', 'ncms000'): 1, ('ser', 'vsis3s0'): 1, ('muralista', 'aq0cs0'): 1, ('diego_rivera', 'np00000'): 1, ('frida_kahlo', 'np00000'): 1, ('caso', 'ncms000'): 1}) that obtained code: res = collections.counter(map(tuple, listapalabras)) return res but need list in form: [['pintor', 'ncms000', 1], ['ser', 'vsis3s0', 1], ['muralista', 'aq0cs0', 1], ['diego_rivera', 'np00000', 1], ['frida_kahlo', 'np00000', 1], ('caso', 'ncms000', 1]] loop on counter list comprehension: [list(k) + [v] k, v in res.iteritems()] demo: >>> collections import counter >>> res = counter({('pintor', 'ncms000'): 1, ('ser', 'vsis3s0'): 1, ('muralista', 'aq0cs0'): 1, ('diego_rivera',

ASP.net MVC 4 Controller Functions -

i have application have display data in table format. end user has 4 different ways want displayed have 1 model different linq statements on each controller manipulate data. have 2 shared views hold controls (filter options drop downs, text boxes, etc...) , result set. my question this: how can sub out repetitive functions? have drop down boxes use filter result set and, forgive ignorance, call same linq statement on each controller load viewdata drop down. as can see inefficient, have added "utlitycontroller" project in hopes can place function , few others there, still have same output on view... haven't figured out yet , thought reach out community help.

c# - pass data to constructor -

i’m having weird & frustrating problem passing object between of classes. stems fact scripter , not programmer, , bumbling along. i’m sure i’m doing dumb :) i trying build wizard dialog has multiple pages. using “internationalised wpf wizard” tutorial codeproject starting point, , attempting adapt domain. i’m getting stuck because wizard pages can’t seem refer model. i have done following: created class model (let call mydata) created base class view models (viewmodelbase) created view model class each of pages, inheriting viewmodelbase (example below welcomepageviewmodel) created ‘controller’ style view model drives wizard. (wizardcontroller) when wizard launched, wizardcontroller instantiated. wizardcontroller instantiates mydata.then, wizardcontroller instantiates each of view models remaining pages. the actual gui seems work fine, , can see view models each of pages being loaded correctly. here’s code: public class mydata { private string _somestring;

asp.net mvc - how to Secure javascript calls WebAPI from a mvc app -

i've designed mvc view in mvc4 website allows members update user details. works ok using mvc if create partial view allows users update address example using ajax. how can apply level of security determine user x can update userx's account. , not allow user login user x , spoof post , update user y's account? regardless if controller mvc controller or webapi controller, after user authenticates , principal set in current thread, have check user in current context: httpcontext.user is 1 data being edited belongs to. username populated on httpcontext.user.identity.name if username of user being edited different authenticated user, throw , invalidoperationexception.

Linux Grep the delta -

i have 2 files: file1, file2. want lines file2 don't exist in file1. i have read post told me use -v flag of grep it(i read man page of grep still did not quite how use -f , -x flag), have no luck far. $ cat file1 eric cartman kenny mccormick $ cat file2 stan marsh kyle broflovski eric cartman kenny mccormick $ grep -v file1 file2 stan marsh kyle broflovski eric cartman kenny mccormick my expected output should this: stan marsh kyle broflovski this grep line may help: grep -fvf file1 file2 or awk: awk 'nr==fnr{a[$0]=1;next}!a[$0]' file1 file2

css - Dynamic colour changes on divs using javascript -

i need help. can't javascript dynamically change colour of 3 divs listed in code below. have pasted full code below... <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style> .box{ width:100px; height:100px; } </style> </head> <body> <div class="box"> quote 1 </div> <div class="box"> quote 2 </div> <div class="box"> quote 3 </div> <script type="text/javascript"> var bgcolorlist=new array( "#ff33cc", "#cc33ff") $(".box").css("background-color",bgcolorlist[math.floor(math.random()*bgcolorlist.length)]); </scrip

java - How to build the scoring matrix for global sequence alignment? -

i have tried global sequence alignment between 2 strings. gives me wrong answer. way of generating scoring matrix below. public void makescoringmatrix(string v,string w) { int ar[][]=new int[v.length()+1][w.length()+1]; for(int i=v.length()-1;i>=0;i--) { for(int j=w.length()-1;j>=0;j--) { if(v.charat(i)==w.charat(j)) ar[i][j]=ar[i+1][j+1]+1; else if(v.charat(i)!=w.charat(j)) ar[i][j]=ar[i+1][j+1]+0; else ar[i][j]=math.max(ar[i][j+1],math.max(ar[i+1][j],ar[i+1][j+1])); } } //printarray(ar); getglobalalignment(ar,v,w); } public void getglobalalignment(int ar[][],string v,string w) { int i=0,j=0,index=0; while(i<v.length() && j<w.length()) { if(v.charat(i)==w.charat(j)) { system.out.print(v.charat(i)); i++; j++; index++; } else if(ar[i+1][j]

jquery - Passing large JSON object to another page in a new window. -

i apologize in advance if has been answered. i've googled around few hours now, , still haven't found seems answer exact question. essentially, have complex/highly styled view displaying user-specific data pulled database. i've captured data json object, attached body page using .data(). i've added button retrieves json object , opens printer friendly page in new window. want able access/manipulate user-specific json object within new window. (this on same domain.) most of solutions i've seen seem centered around opening new, blank window. don't want that. i've coded layout page, , plan on having javascript/css runs. i've seen solutions involve opening new window , using document.write, great, if there way target specific element on new page. i've tried, example: x = window.open(url); x.document.write(myjson); which put json object on new page, wipes else had in layout. i've seen solutions suggest stringifying , base64 encoding obje

java - AWT custom window shape using transparent image -

i trying make ui using awt. want use images , transparent components. right cant understand how make main window supposed png image custom shape. areas transparent in image replaced black color. here code use: public class test { static image image; /** * @param args command line arguments */ public static void main(string[] args) throws ioexception { //switch right thread image = imageio.read(test.class.getclassloader().getresource("resources/images/panel.png").openstream()); swingutilities.invokelater(new runnable() { @override public void run() { frame frame = new frame("test"); frame.setundecorated(true); frame.setbackground(new color(0,0,0,0)); frame.add(new background(image,image.getwidth(frame),image.getheight(frame))); frame.pack(); frame.setsize(image.getwidth(frame), image.getheight(frame)

Android audio player activity -

i have music player app created, while im playing music , exit app pressing home or button , launch app again, doesn't return current state exit app , song index goes default value 1 music still playing. , when play music again, current song played still playing. therefore, there 2 songs playing. how can save current state of application? you can save states in onpause() , can retrieve them in onresume() or can use onwindowfocuschanged() : public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); if(hasfocus) //retrive state else //save state }

possible to refresh (not reload) a parent page with javascript? -

i have page shows images. if record doesn't have image associated yet, provide user pop-up window link can upload image. when user submits form on pop-up, refreshes, uploads image , automatically closes. before pop-up closes, want refresh (not reload) parent. reason don't want reload because i'm using post data dynamically populate page content. if reload, previous data lost. tried change window.opener.location.reload(true); window.opener.location.refresh(true); ... apparently that's not valid command. is there way refresh parent page instead of reloading it? if want show newly uploaded image, best way have function on parent page like: top.refreshimage = function(url){ $("#<id_of_image_tag>").attr("src",url); //or if not using jquery usual way document.getelementbyid("<id_of_image_tag>").src=url; } then dialog, after image uploaded call function: top.refreshimage("<url_of_newly_u

node.js - Authenticating users on mongo, node, passport, and heroku. Stops working after a few days -

i'm creating first full stack web app mongo, express, angular, , node. come front end background, , i'm struggling little authentication implementation. my (incomplete) app working days, today broke, , magically fixed it. i'm pretty sure didn't change drastic in code. error causing authenticated users see "guest users" account. allow them login, user come mongo guestuser. see i'm missing in code? var express = require('express'), routes = require('./routes'), api = require('./routes/api'), http = require('http'), path = require('path'), mongoose = require('mongoose'), passport = require('passport'), localstrategy = require('passport-local').strategy; var app = module.exports = express(); var uristring = process.env.mongolab_uri || process.env.mongohq_url || 'mongodb://localhost/hellomongoose'; mongoose.connect(uristring, function (err, res) {

java - can't getPreferences but it keeps changes (can see in manu layout) -

i've made special preferences layout. <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <checkboxpreference android:key="pref_sound" android:title="@string/pref_sound" android:summary="@string/pref_sound_summ" android:defaultvalue="true" /> <checkboxpreference android:key="pref_vibro" android:title="@string/pref_vibro" android:summary="@string/pref_vibro_summ" android:defaultvalue="true" /> <checkboxpreference android:key="pref_screen" android:title="@string/pref_screen" android:summary="@string/pref_screen_summ" android:defaultvalue="true" /> </menu> and activity it. package com.actionandresttimer; import android.os.bundle; import android.preference.preferenceactivity; public class pre

jasper reports - Number display as # in generated Excel file -

Image
i have excel file generated jasperreports . can see here excel 's column display ### if number long. don't want resize width of column, want display number without seen ### , stretch height. have tried set column stretch overflow , stretch type = relative band height this screenshot: you need set appropriate jasper reports excel property on report element, or on whole report iself. documentation: http://jasperreports.sourceforge.net/sample.reference/xlsfeatures/ specifically net.sf.jasperreports.export.xls.column.width.ratio if these properties not available in jasperreports version, may have fiddle around sizing decent.

Yii: Multimodelform Extension - How to create more than 1 member -

i'm using multimodelform extension create multiple model in single form. extension working great unfortunately more 1 member instead. have tried without success @ all. my problem not make more 1 member extension. here's code : from controller public function actioncreate() { yii::import('ext.multimodelform.multimodelform'); $model=new endheader; $member = new enddetail; $member2 = new enddetailnq; <-- ant new member. $validatedmembers = array(); //$validatedmembers2 = array(); // uncomment following line if ajax validation needed $this->performajaxvalidation($model); if(isset($_post['endheader'])) { $model->attributes=$_post['endheader']; if(isset($_post['sav'])){ if((multimodelform::valid

c# - How to build a visual studio 2010 solution into a standalone dll? -

i have visual studio 2010 project, uses static , dynamic libs ( .lib , .dll ), project compiled , built .exe both in release , debug modes, code c , c++. what right way compile , wrapping solution 1 standalone .dll file. i want have 1 dll file, i'll able load in other c, c++, c# project safely. in case want load in teraterm , in other simple self developed c# application. visual studio has c++ linker option called "link library dependencies": http://msdn.microsoft.com/en-us/library/024awkd1(v=vs.90).aspx this link object files projects in solution directly project output (via dependency tracking). careful when use though, if use in exe , dlls you're linking export symbols exe export them. update: here's more detail: happens instead of linking dlls (this assumes have dlls you'd link set dependencies of project in solution) produce separate binaries, linker takes outputs each individual project dependency , links them final executabl

mysql - SQL idea for a query -

i have kind of table id-----categoryid-----price 1---------1-----------200 2---------1-----------300 3---------2-----------150 4---------2-----------100 i need sql query can average of elements category id. results should like: categoryid----------avg_price 1-------------------250 2-------------------175 i have not been able think through.. select categoryid, avg(price) table group categoryid

c# 2.0 - C# application .Net 2.0 Couldn't run in Windows XP -

i built .net 2.0 application windows xp made in windows 7. the application contains mysql.data connection , crystalreport. when try run on windows xp, application not run, giving error message of: the application failed initialize (0xc000007b). i tried rebuild application in windows xp, when rebuilt , ran in visual studio, following error occurs: could not load file or assembly or 1 of dependencies. module expected contain assembly manifest. how can fix this? please try following: 1.uninstall .net framework 3.5 add/remove programs (in control panel) on windows xp or programs , features on windows vista/windows 7. even if uninstall fails, go on step 2. 2.after framework 3.5 has been uninstalled or if failed, download , run .net framework removal tool. here's link aaron stebner's framework removal tool on windows live skydrive: http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/blog_tools/dotnetfx_cleanup_tool.zip?wa=wsignin1.0&sa

database - Get Count of Records in Separate Column -

this question has answer here: different value counts on same column 3 answers table : status_table id | status | ================= 1 true 2 false 3 false 4 true how can count of both true , false in separate column using oracle?? must show record status true. put condition. must display count of both. like marked_record unmarked_record 2 2 how like select sum(case when status = 'true' 1 else 0 end) marked_record, sum(case when status = 'false' 1 else 0 end) unmarked_record status_table

c# - Property or indexer 'System.DateTime.TimeOfDay' cannot be assigned to — it is read only -

i saw lots of duplicate post of me it's different. i have datetime object , time portion & assign time that.when i'm going assign it raise error. in here newstartdategroup datetime object in here opentime timespan property or indexer cannot assigned — read only else if(newstartdategroup.timeofday < i.opentime && newenddategroup.timeofday > i.closetime) // < > { newstartdategroup.timeofday = i.opentime; datetime struct in .net immutable , instead of changing it's values have create new one: newstartdategroup = newstartdategroup.date.add(i.opentime);

java - Memory issues on drools while creating knowledge base -

i using drools5.5.0 in application. have decision table has 30,000 rules in it. knowledge base need created 10 such decision tables. i have serialised decision tables out , loading packages knowledge base. cannot create knowledge base due memory problems. having 16 gb java heap , 4 gb permgen far. these questions. is requires these memory or not?? if so., there anyother best practice reduce memory usage??

.net - Regular Expression in c# to find letter then \ with capital letter for letter and Shift press form of other charecter? -

i want convert string m\anoj ku\mar m\a\noj manoj kumar manoj how can using c# string convert(string text) { string pattern = @"$1\\"; string reppattern =@""; string returntext = regex.replace(text, reppattern, pattern); return returntext; } what assigneed reppattern ? result try following: var input = @"m\anoj ku\mar m\a\noj"; var pattern = new regex(@"([a-z])\\"); var replaced = pattern.replace(input, m => m.groups[1].tostring().toupper()); console.writeline(replaced); update map digits shift-pressed form: string text= @"m\an1oj ku\mar m\a\no9j"; char[] shiftpressforms = ")!@#$%^&*(".tochararray(); regex pattern = new regex(@"([a-z])\\"); regex pattern_digit = new regex(@"\d"); string replaced = pattern.replace(text, m => m.groups[1].tostring().toupper()); replaced = pattern_digit.replace(replaced, m => shiftpressforms[int.parse(m.value)].tostring()); co

java - Compare current date with date from property file -

i getting hard coded date property file , of format dd-mmm-yyyy . now need compare current date of same format. purpose , cooked piece of code : date convdate = new date(); date currentformatteddate = new date(); dateformat dateformat = new simpledateformat("dd-mmm-yyyy"); convdate = new simpledateformat("dd-mmm-yyyy").parse("20-aug-2013"); currentformatteddate = new date(dateformat.format(currentformatteddate)); if(currentformatteddate.after(convdate) || currentformatteddate.equals(convdate)){ system.out.println("correct"); }else{ system.out.println("in correct"); } but eclipse tells me new date has been depreciated. 1 know of alternative way of doing ? going crazy on this. ! one of way use calendar class , after() , equals() , before() methods. calendar currentdate = calendar.getinstance(); calendar anotherdate = calendar.getinstance(); date convdate = new simpledateformat("dd-mmm-yyyy").parse(

wxpython - pyinstaller exe with pubsub -

i have written wxpython application uses several different threads of need write log window (textctrl box). because of followed tutorial http://www.blog.pythonlibrary.org/2010/05/22/wxpython-and-threads/ and used wx.callafter , pubsub. this original code from wx.lib.pubsub import publisher publisher().subscribe(self.messenger, "update") wx.callafter(publisher().sendmessage, "update", "thread finished!") def messenger(self, msg): self.logtxtctrl.writetext(msg.data) this code worked brilliantly , thought easy use pyinstaller create exe code. how wrong i!! so after reading comments seems there 2 versions of pubsub api, using this http://wiki.wxpython.org/wxlibpubsub i tweaked code following from wx.lib.pubsub import setuparg1 wx.lib.pubsub import pub pub.subscribe(self.messenger, "update") wx.callafter(pub.sendmessage, "update", data="program success") def messenger(self, data): self.logtxtc

javascript - Function didn't work with document.all -

can me solve problem javascript code: function checkall(pobj) { var mcurrstatus; mcurrstatus = pobj.checked; var mobjlist; mobjlist = document.all["process"]; (x = 0; x <= 2; x++) { var obj; obj = mobjlist[x]; obj.checked = mcurrstatus; } } asp-classic code: response.write "<td nowrap><input type=checkbox name=process_1 " response.write "/>box1</td>" response.write "<td nowrap><input type=checkbox name=process_2 " response.write "/>box2</td>" and selectall box : response.write "<th align=left><input type=checkbox onclick=checkall(this)></th>" how select thoses boxes when click select box (it's seem function doesn't work) please me instead of giving me example... guy help~ updated: i refer roland suggestion , make new function doesn't work idea? function checkal