Posts

Showing posts from August, 2015

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

coldfusion - What's wrong with my simple insert? -

i'm using coldfusion insert contents of struct (key-value pairs) database table. code: <cfloop collection="#results#" item="id" > <cfquery name="insertstuff" datasource="mydatasource"> insert web..stuff (id, name) values (#id#, #results[id]#) </cfquery> </cfloop> this seems simple enough... i'm getting following error: incorrect syntax near 'va'. any ideas? you ought think parameterising data too. <cfloop collection="#results#" item="id" > <cfquery name="insertstuff" datasource="mydatasource"> insert web..stuff (id, name) values ( <cfqueryparam cfsqltype="cf_sql_varchar" value="#id#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="#results[id]#">) </cfquery> </cfloop>

c# - Attaching an object tree to object context in Entity Framework -

i have edm following 3 types: foo, bar , foob. foob subclass of foo. foo has collection of bar entities. bar has collection of foo entities. want add new foo object collection, along it's bar , associated foob objects. such following code work: foo foo = new foo(){name = "foo"}; using(var ctx = new entitycontext()) { ctx.foo.attach(foo); bar bar = new bar(); bar.items.add(new foob(){name="foob1"}; bar.items.add(new foob(){name="foob2"}; foo.bars.add(bar); ctx.savechanges(); } however above code gives me exception below: system.data.sqlclient.sqlexception: cannot insert duplicate key row in object 'dbo.tblfoo' unique index. try check sql code executed in sql profiler. may forgot set autoincrement foob entity.

Set culture using cookie in asp.net, not updated -

i'm using asp.net , want make possible user set culture use in website himself. in masterpage have following code set language cookie: protected void page_load(object sender, eventargs e) { if (request.querystring["setlanguage"] != null) { httpcookie languagecookie = new httpcookie("language"); languagecookie.value = request.querystring["setlanguage"]; languagecookie.expires = datetime.now.adddays(10); response.setcookie(languagecookie); } } in global.asax use cookie this: protected void application_beginrequest(object sender, eventargs e) { httpcookie languagecookie = system.web.httpcontext.current.request.cookies["language"]; if (languagecookie.value != null) { system.threading.thread.currentthread.currentculture = new system.globalization.cultureinfo(language); system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo(lang

android - How to draw Pie Chart Manually? -

i need draw pie chart manually .i need basic ideas that.can me ?? here example in java (not android). port android using canvas instead of graphics2d object. instead of fillarc example, use drawarc .

sql - Not able to connect to the SQLCMD Utility -

when try connect sql server using sqlcmd utility, use following syntax: sqlcmd -q "select * adventureworks2008r2.person.person" i following error, can pleae on this. hresult 0x2, level 16, state 1 named pipes provider: not open connection sql server [2]. sqlcmd: error: microsoft sql native client : error has occurred while establi shing connection server. when connecting sql server 2005, failu re may caused fact under default settings sql server not allow remote connections.. sqlcmd: error: microsoft sql native client : login timeout expired. supply server wish connect to: sqlcmd -s <server> -q "select * adventureworks2008r2.person.person" for instance if use sql server express <server> .\sqlexpress for further options of sqlcmd use sqlcmd -?

drupal 6 - hook_menu giving 404 -

i trying create simple module in drupal 6.20 follows: <?php function example_help($section) { switch ($section) { case 'admin/modules#description': return t('this module implements example form.'); } } function example_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array( 'path' => 'example', 'title' => t('example'), 'callback' => 'example_page', 'access' => true, 'type' => menu_normal_item ); } return $items; } function example_page() { return drupal_get_form('example_page_form'); } function example_page_form() { $form['fullname'] = array( '#type' => 'textfield', '#title' => t('enter full name'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t('save'), ); re

c++ - How to Disable UAC for my application -

Image
well , when ever trying run application administrator getting following error, , whether allow or not. if running app directly , not administrator seems work. there thing need rid of uac , no dont want user manually change uac settings. do need tweak registry settings programe or certificate need sign with. in general, can't disable uac. goal of uac provide defense in depth against malware. counterproductive if tojan disable uac. what can accept uac exists, , roll it. shouldn't run administrator, it's fine uac dialog when do. instance, auto start can handled per-user setting, means don't need admin change that.

xcode - C++ std method listing -

i new c++ , xcode. i know how can list of available methods namespace std or other namespaces #include 'ed in cpp file., in similar way method scoping in eclipse (ctrl+space) . thanks with xcode use esc , it's auto-completion c++ doesn't work.

While creating a backup in sql server using query i am getting the following error? -

i have database named students. can able create database using tool backup. not able create using query. use students go backup database students disk = 'c:\program files\microsoft sql server\mssql10.mssqlserver\mssql\backup' format, medianame = 'test',name = 'back of student database' go while doing getting following errror. 1 me in issue? thank all/...... msg 3201, level 16, state 1, line 1 cannot open backup device 'c:\program files\microsoft sql server\mssql10.mssqlserver\mssql\backup'. operating system error 5(access denied.). msg 3013, level 16, state 1, line 1 backup database terminating abnormally. you need specify filename of backup e.g `to disk='c:\backups\backupfile.bak' see msdn full description of options

.net - A tool to find projects erroneously referenced by dll in Visual Studio 2008 solutions -

i have visual studio 2008 solution containing lot of projects references each other. i didn't create solution, , lot of references made project made dll (referencing dll of /bin/debug folder of project). of course problem since creates weird behaviour when clean or rebuild solution, compiler complaining dll versions not being ok. i don't seem able spot projects erroneously referenced dll, option seems references each .csproj files spot errors , correct them. the problem source control holds around 100 solutions same potential issues, each 1 containing tens of projects. doing manually may take lot of time, wondering if there tool out there can rebuild references , dependencies easily? a tool such resharper jet brains may you're looking for. this allow see references in projects not being used. (and more)

amazon s3 - uninitialized constant AWS::S3::NoSuchBucket -

i using rails 3 following code... config.gem "aws-s3", :version => ">= 0.6.2", :lib => "aws/s3" config.gem 'right_aws', :version => '2.0.0' model.rb has_attached_file :video, :storage => :s3, :s3_credentials => "#{::rails.root.to_s}/config/s3.yml", :path => ":attachment/:id/:style/:basename.:extension" # paperclip validations validates_attachment_presence :video validates_attachment_content_type :video, :content_type => ['application/x-shockwave-flash', 'application/x-shockwave-flash', 'application/flv', 'video/x-flv'] s3.yml development: bucket_name: tekbookvideo access_key_id: xxxx secret_access_key: yyyy production: bucket_name: tekbookvideo access_key_id: xxxx secret_access_key: yyyy and getting uninitialized

c# 4.0 - .NET chart Datamanipulator -

in .net c#4.0 .net chart control have code generate pie chart: chart.series[0].charttype = seriescharttype.pie; foreach (order order in ordercollection) { // if set point.legendtext = order.username, .group erase chart.series[0].points.addxy(order.username, order.total); } chart.datamanipulator.sort(pointsortorder.ascending, "x", "series1"); chart.datamanipulator.group("sum", 1, intervaltype.months, "series1"); this works well, generates pie chart top 10 users showing total order sum. set datapoints' legendtext order.username property. problem is, datamanipulator.group overwrites series datapoints. if set legendtext in foreach loop, erased after group call. and after group call, don't see way retrieve correct username datapoint set legendtext. what best approach situation? as solution, used linq group datasource , dropped use of datamanipulator.

regex - java regular expression to match file path -

i trying out create regular expression match file path in java like c:\abc\def\ghi\abc.txt i tried ([a-za-z]:)?(\\[a-za-z0-9_-]+)+\\? , following code import java.util.regex.pattern; public class retester { public static void main(string arhs[]){ string regularexpression = "([a-za-z]:)?(\\[a-za-z0-9_-]+)+\\?"; string path = "d:\\directoryname\\testing\\abc.txt"; pattern pattern = pattern.compile(regularexpression); boolean ismatched = pattern.matches(regularexpression,path); system.out.println(path); system.out.println(pattern.pattern()); system.out.println(ismatched); } } however it's giving me , false result . pls me . thanks java using backslash-escaping too, know, need escape backslashes twice, once java string, , once regexp. "([a-za-z]:)?(\\\\[a-za-z0-9_.-]+)+\\\\?" your regexp matched literal '[-za-z0-9_-' string, , literal '?' @ end. added period in there allo

c# - Asp MVC 2: Obfusicate Entity-IDs -

project type: asp mvc 2/nhibernate/c# problem if have edit page in web application come problem have send , receive id of entity you're editing, ids of sub-entities, entities can selected dropdownmenus,... as possible modify form-post , evil user try send another id maybe grant him more rights (if i.e. id related security entity). my approach create guid , associate id save association in http session wait response , extract real id out of received guid. question: what techniques use obfusicate entity-id ? if you're doing guids, why not use guids identity of entity that's stored in database (though i'd advise against it )? or have server side encryption scheme encrypts , subsequently decrypts id (this long same lines you're doing except you're not storing random in session (yuck :) ). you forget trying @ since lot of sites "affected" issue, , it's not problem (stackoverflow example). overhead much. also, if yo

How to send datagrams through a unix socket from PHP? -

i'm doing: $socket = socket_create(af_unix, sock_dgram, 0); if (@socket_connect($socket, $path) === false) { ... } but error: (91): protocol wrong type socket am using of parameters wrong? suspect second socket_create parameter. could't find in documentation: http://php.net/manual/es/function.socket-create.php it's maby outdated, i've found way works properly: $sock = stream_socket_client('unix:///tmp/test.sock', $errno, $errst); fwrite($sock, 'message'); $resp = fread($sock, 4096); fclose($sock);

email - Pop open a mail window that has HTML formatting, C# -

i have text box in program user can input text , format in html ( tags around bold text, etc). i using mapi32.dll open email window in outlook text, seems mapi not interface html, left raw html in there, displaying actual <> tags. so, pursuing alternative ways pop open email window, html text formatted. have read suggestions of using smtp, still allow me pop open email window user's email program, or going send email directly? prefer former, email popping open in user's email client. thanks. seems me simplest solution to use 1 of many wysiwyg html text editors out there display/edit email, use smtp send it. here editor have used in past pretty simple: http://www.codeproject.com/kb/edit/editor_in_windows_forms.aspx

internationalization - Performance of Java enums -

i thinking using enum type manage i18n in java game i'm developing curious performance issues can occur when working enums have lots of elements (thousands think). actually i'm trying like: public enum text { string1, string2, string3; public string text() { return text; } public string settext() { this.text = text; } } then load them can fill fields: static { text.string1.settext("my localized string1"); text.string2.settext("my localized string2"); text.string3.settext("my localized string3"); } of course when i'll have manage many languages i'll load them file. what i'm asking is is obect allocated (in addition string) every element? (i guess yes, since enums implemented objects) how right element retrieved enum? static @ compile time? (i mean when somewhere use text.string1.text() ). should constant complexity or maybe replaced during compiling phase.. in general, approach or sh

gps - Looking for a replacement for Instamapper -

i've been searching net couple days , haven't turned solves issue. the current client i'm working embeds instamapper thier site allows them track thier drivers in real-time. now search has produced number of gps tracking solutions none meet requirements client looking for, decided post question on here , see if knows may have missed. requirements must able embed map clients site. must compatible blackberry, android, , iphone mobile phones. doesn't have free, client willing pay service. if knows of solution appreciate help. thank you, bwc i searched , searched, , there isn't out there solved problem ended writing own.

C++ a class to be used only by another class -

i'm building class (class a) needs able create number of instances of class (class b) in course of operation, class b used few member functions of class a, , never used outside of class. how should class b best defined? practical / reasonable make private member of class a? intended purpose of nested classes, or parting spirit of construct? thanks, wyatt edit: on further consideration, i'm not asking best practice, personal project. want include class b member of class encapsulation standpoint - seems reasonable class wholly subordinate should in fact part of owning class. what i'm wondering whether or not reasonable use-case nested classes? if not, purpose of nested classes? one possibility define namespace called detail inside namespace put classes. e.g. // public_namespace_detail.hpp namespace public_namespace { namespace detail { class b { ... }; } } // public_namespace.hpp #include "public_name

jquery - Statistic counter auto refresh div and mysql query -

we building live statistics counter, refreshing numbers every 10sec. (similar stackoverflow questions counter). have simple html page, tried embed php , tried use jquery, no success. help? thanks <html> <script> var auto_refresh = setinterval( function() { $('#stats').fadeout('fast').fadein("fast"); }, 10000 ); </script> <div id="stats"> <?php global $conn; $query="select count(*) total posts type='update'"; $query2="select count(*) total members userid>0"; $postnum = mysql_query($query); $posts = mysql_result($postnum,0); $chanid = mysql_query($query2); $channels = mysql_result($chanid,0); print "<div id='statnr'><h6> $channels </h6><h1>channels </h1> </

How to get date time format from javascript? -

i want display date of today according current datetime format without displaying seconds thanks help you have write code it, or use library date.js . javascript "date" object instances have methods .getfullyear() , .getmonth() , .getdate() , , on. (be aware .getmonth() returns numbers 0 through 11, not 1 through 12.)

sql - Possible ways to get the group Last/Max record in a hierarchical query? -

assuming have table one: create table user_delegates ( [id] int identity(1,1) not null, [user_from] varchar(10) not null, [user_to] varchar(10) not null, constraint [pk_user_delegates] primary key clustered ([id] asc), constraint [uk_user_delegates] unique ([user_from] asc) ) so user has right delegate system access user b. when that, won't able access system anymore - user b have "break" delegation before able use system again... but consider that, if user b delegates access user c, user c will start impersonating user a , , on. (i know seems security nightmare - please let's forget that, ok? :-)) also consider records: insert user_delegates([user_from], [user_to]) values ('anthony', 'john') insert user_delegates([user_from], [user_to]) values ('john', 'john') insert user_delegates([user_from], [user_to]) values ('karl', 'joshua') insert user_delegates([user_from], [user_to]) values (

c# - WPF - Databinding Color to plain simple Window or Canvas in a Window Background - No controls -

i need answer can explore. running brick wall here: i use: (int c = 0; c < 255; c++) { color = color.fromargb(255, (byte)c, (byte)(255 - c), (byte)c); thread.sleep(3); } each time "color" recomputed, window or canvas in window change color...so see cool color changes. why hard? need see this, i'm hitting brick wall. copied type converter here: [valueconversion(typeof(color),typeof(solidcolorbrush))] public class colorbrushconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { color color = (color)value; return new solidcolorbrush(color); } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { return null; } } thank help! a simple example of how can bind color property code behind canvas backgrou

c - Choosing a data structure -

different data structures used according requirement how know data structure should use? want know how choose appropriate data structure ? thanks this flowchart stl in c++, implement of data structures supported stl containers in c. list linked list vector dynamic array deque list of dynamic arrays -- sort of splits difference. queue , priority queue (usually queue implemented in terms of deque, priority queue implemented in terms of heap inside vector or deque) set/map/multiset/multimap implemented using form of balanced binary tree. update 2016: apparently image used link here has been link-rotted, can see several equivalent images on @ question: in scenario use particular stl container?

iphone - Help me re-understand how to use sine to oscillate a graphic in (Objective) C -

i feel silly asking seem have forgotten how use sine effectively. i'm working on ipad app i'm in objectivec, , i'm trying uiview oscillate slowly. using position.y + sin(counter) makes move fast vibrates , can't seem define period slow down. i've found code samples (mostly generating sound waves) , combine many things 1 line of code can't pull apart. can explain should doing? sin (and cos) take parameter in radians. name counter suggests you're not using radians. so, need determine how many oscillations per second want. then, can measure time between last , current animation 'frame'. whole wave 2pi radians, y = sin(2pi * time * occilationspersecond) * amplitude.

php - Getting different output with same simplexmlobject file...? -

sorry, forgot put check $meshheading->qualifiername... did... still error...? if got simplexmlobject: [meshheading] => array ( [0] => simplexmlelement object ( [descriptorname] => acoustic stimulationment object [qualifiername] => methods ) [1] => simplexmlelement object ( [descriptorname] => adolescent ) [2] => simplexmlelement object ( [descr

ruby on rails - Rspec tests fail in Namespace -

i've converted existing rails tests rspec, , tests in namespace fail. i.e. in example below, accountcontroller spec passes, while childrencontroller fails following error: in `load_missing_constant': expected /.../app/controllers/admin/children_controller.rb define admin::childrencontroller (loaderror) app/controllers/account_controller.rb class accountcontroller < applicationcontroller spec/controllers/account_controller_spec.rb require 'spec_helper' describe accountcontroller #... end app/controllers/admin/children_controller.rb class admin::childrencontroller < applicationcontroller spec/controllers/admin/children_controller_spec.rb require 'spec_helper' describe admin::childrencontroller include ::controllerhelper #... end i'm using ruby-1.9.2-p0 rails 3.0.3 rspec 2.3.0 i've tried playing namespace definitions, no luck far - ideas??? i had same problem, , not willing place tests in lower

Input from file in C, data types -

thanks in advance taking time read through question... /* binary search use gen_window.comp */ #include <stdio.h> int main() { char line[1000]; double sig, e; file *fp, *fopen(); fp = fopen("sig_data", "r"); if (fp==null){ printf("error opening file!"); } else { printf("processing file..."); } while( (fgets(line, 25, fp) != null) ){ fscanf(fp, "%lf\t%lf", &e, &sig); printf("\nthe energy is: %lf ev\nthe corresponding cross section is: %lf barns\n",e, sig); } } numbers in file of format x.xxxxxx+x or x.xxxxxx-x accordingly. c have way specify input? bother there no 'e'. cannot find documentation tells inputing exponential, returning exponential... i not need print exact format, other exponential format fine. i realize there should specifiers , precision in %lf, or maybe should %e, have tried makes sense me, leaving blank. thanks hel

iphone - Programming app for multiple targets? -

i'm programming app have free version. have added target app (myapp free) , wondering how can add proper #ifdef declarations code. if knows of tutorial or can provide me more information on grateful. keith peters has great tutorial on this: http://www.bit-101.com/blog/?p=2098 as me, released 2 apps, 1 lite version of other. set 2 different projects, lite version getting of code non-lite one. personally, having separate (though no means saying it's preferred/good-practice way of doing this). in future, it's worth, plan on having 1 version in app store , enabling premium features in-app purchase. unlocking functionality seems easy implement in-app purchases...

Rails 3 rescue_from, with and working with custom modules -

i writing rails app wanting dry tad bit , instead of calling custom error class @ top of each controller need in, placed inside of module , included module. working code (module): module apiexception class emptyparameter < standarderror end end working code (controller): # include custom error exception classes include apiexception rescue_from emptyparameter, :with => :param_error # rescure record_not_found custom xml response rescue_from activerecord::recordnotfound, :with => :active_record_error def param_error(e) render :xml => "<error>malformed url. exception: #{e.message}</error>" end def active_record_error(e) render :xml => "<error>no records found. exception: #{e.message}</error>" end here question, using :with command, how call method inside custom module? something this: rescue_from emptyparameter, :with => :emptparameter.custom_class you try thi

winforms - Is there any way to display a Windows form BEFORE the "Startup" form is loaded in VB.NET? -

my company's main software package includes hefty configuration library loads on startup. config library includes mandatory settings which, if not supplied (via command line arguments), cause entire application exit. this has never been issue our users, launch software via scripts have needed command line arguments supplied automatically. when debugging our software developers forget specify necessary arguments in visual studio's debug options; it's annoying greeted message config specification invalid -- missing required parameters x, y, , z -- shutting down (i'm paraphrasing, of course). it's not big deal, annoyance. still, felt worthwhile throw little form make process little less painful; notifies user parameters missing , allows him/her specify values parameters directly on form, without having restart application. my intentions (i think?), seems can't solution work. problem after i've launched our software missing settings, form pops , promp

Need help for migrating OsCommerce database it Magento database -

i need migrate oscommerce database magento database. found tool on magento site not work me. :( can me task? it's easy import products , not customers i tell clients need start new number new customers there more information in magento , "conversion" not suitable, , have customer information sales in erp system, never lose special, new customer needs create new account again, witch well, can managed sending newsletter customers explaining have better service new system. to have products imported sucessfully, this: create manually attributes in magento products need use create 1 product manually information have go import/export , export csv file 1 , product analyse csv file , in oscommerce, export same data new csv file import csv oscommerce magento using import tool. you have upload product images manually ftp , work fine.

c++ - Remove element from vector of maps -

i have vector of maps: typedef map<string, string> amap; typedef vector<amap> rvec; rvec rows; how can remove elements rows? the following code not work. struct remove_it { bool operator() (rvec& rows) { // validation code here! } }; rvec::iterator = remove(rows.begin(), rows.end(), remove_it()); rows.erase(it, rows.end()); i got following error. error: no matching function call 'remove(std::vector<s td::map<std::basic_string<char>, std::basic_string<char> > >::iterator, std::vec tor<std::map<std::basic_string<char>, std::basic_string<char> > >::iterator, mai n(int, char**)::remove_it)' thanks. 1) first off: please provide single compilable example. code posted above problematic rvec , rowsvector have been interchanged (you have seen if had posted real code). 2) using wrong remove. should remove_if 3) normal functor const 4) operator() should object of type amap (as in

jquery - virtual url representing page contents but not a different .html file -

i have website consists of single page coded in html uses jquery load web albums picasa container depending on link user clicks on. works fine, want content loaded page coincide url. @ moment, when 1 of album links clicked, photos load , '#' appended url. how can append album name url instead, , have browser understand album name coincides content loaded on page jquery. additionally, want able send link website: kornweissphotography.com/steven/albumname albumname name of 1 of web albums , have appropriate images load page. website: www.kornweissphotography.com/steven thank you! you append category end of # on links. so when click on on people, url http://www.kornweissphotography.com/steven/#people you @ url in javascript figure out load.

Java Swing close ONLY one application -

hi all: have java swing app. there button allow user create open new window of application. use system.exit(0) when user decides close application, when press "close" button, both application windows closed. public static void main(string[] args) { ghmain = new greenhousemain(); } above how initialize first application, use same code create new greenhousemain object open second application window. so question how close 1 application window close button pressed from? thanks all call dispose() instead of system.exit() on window object want close. when there no more visible windows, event dispatch thread exit.

Splitting a project VB/C#, and References -

i've inherited project written in vb. i'd maintain have in vb while converting c# when can. way i've found create separate c# project. however, causes problems because of dependencies , references. can't have vbproject reference csharpproject , vice versa because creates circular reference. problem because need both projects able reference other. there better way this, or stuck writing in vb (or translating c#)? also, these projects in same solution. shouldn't able import/use them without creating reference or other easier way? there's no getting around having remove circular references. when i've faced similar situation in past, converting language language b, started refactoring bits of language code independent of majority of code base. i'd translate isolated pieces language b , integrate main program depending on new modules. eventually, left main program. it took time, bottom-up approach effective , ended more modular program.

Ruby RegEx to Match between . and : -

i have string: "51. thing:" , extract "some thing" using reg ex in ruby. can point me in right direction match between . , : , discard else? '51. thing:'.sub /.*\. *([^:]*).*/, '\1' => "some thing"

How to avoid already-authorized in Android Facebook SDK -

i'm getting useless page when use single sign on facebook's android sdk. "you have authorized happyapp. press "okay" continue. this page destroy user experience. how heck rid of it. lots of people have been seeing this, no solution posted. even facebook admits problem, see: http://forum.developers.facebook.net/viewtopic.php?id=84548 does know work-around? the way did (without additional oauth solution) store off access token in preferences kieveli suggested. when main activity starts, token preferences, if it's not there initiate authorization process , store resulting token in preferences. the harder part handle token expiration or de-authorization of app (ie. token in preferences, no longer valid). for case, every fb api/graph invocation, check exception indicating authentication failed. if fails, initiate authorization/token storing procedure again.

Why won't my external image load in my Silverlight Page? -

to make simple possible, created new default silverlight 4 application , added images folder test web site automatically created when application generated. put same image, let's call "imagename.png" in clientbin folder , images folder. now, works fine when use image in clientbin using xaml this: <grid x:name="layoutroot" background="white"> <stackpanel> <image source="imagename.png" width="16" height="16"/> <textbox text="hello" /> </stackpanel> </grid> but image doesn't load when try access image in images folder this: <grid x:name="layoutroot" background="white"> <stackpanel> <image source="../images/imagename.png" width="16" height="16"/> <textbox text="hello" /> </stackpanel> </grid> i don't errors, image isn&

wpf - Telerik RadPaneGroup problem -

i use telerik rad controls wpf 2009.3.1314. here layout: <raddock:raddocking x:name="raddocking"> <raddock:raddocking.documenthost> </raddock:raddocking.documenthost> <raddock:radsplitcontainer initialposition="dockedleft"> <raddock:radpanegroup> <raddock:radpane header="screens" headertemplate="{staticresource screensradpaneheadertemplate}"> <radnav:radtreeview x:name="radtreeviewscreens" /> </raddock:radpane> </raddock:radpanegroup> </raddock:radsplitcontainer> <raddock:radsplitcontainer initialposition="dockedright"> <raddock:radpanegroup> <raddock:radpane header="object explorer" headertemplate="{staticresource objectexplorerradpaneheader

xml - is matlab's xmlread using too much memory? -

i running memory problem when trying read in large (not huge!) xml files. estimating java memory usage tricky, seems that dom=xmlread('somefile.xml'); takes way more memory ought to. know how set default available java memory in preferences, 512mb , not full "resolution" xmls yet. , memory usage not scale file size. if provide link ~5mb xml file takes ~60mb of java memory xmlread. any ideas? in advance, -n you try xml io tools file exchange alternative way of reading file. also take @ mathworks doc on resolving "out of memory" errors .

c++ - Multiple-File Template Implementation -

with normal functions, declaration , definition separated across multiple files so: // foo.h namespace foo { void bar(); } . // foo.cpp #include "foo.h" void foo::bar() { cout << "inside function." << endl; } it understanding cannot done templates. declaration , definition must not separate because appropriate form of template created "on-demand" when needed. so, how , templates typically defined in multiple-file project this? intuition in foo.cpp because that's "meat" of functions is, on other hand it's header file that's going included. template code stays in .hh file. there's no reason make them separate files, though practice put definitions after all declarations. when compiler generates template code, flags linker knows instantiation of template in 1 compilation unit (i.e. .o file) exact same code 1 in unit. keep 1 , discard rest, rather bailing out "multiply defi

c# - How can I store and retrieve an image using an SQLite database and a WPF application? -

i have store image wpf application sqlite database, , retrieve same image , display in application. tried doing coverting image byte array , storing byte array sqlite database blob, not working. can me? i suggest convert image base64 string first , store in database. in c#: image base64 string public string imagetobase64(image image, system.drawing.imaging.imageformat format) { using (memorystream ms = new memorystream()) { // convert image byte[] image.save(ms, format); byte[] imagebytes = ms.toarray(); // convert byte[] base64 string string base64string = convert.tobase64string(imagebytes); return base64string; } } base64 string image public image base64toimage(string base64string) { // convert base64 string byte[] byte[] imagebytes = convert.frombase64string(base64string); memorystream ms = new memorystream(imagebytes, 0, imagebytes.length); // convert byte[] image ms.write(imagebytes, 0, imagebytes.length);

Why do we do a POST to confirm deletion in asp.net MVC? -

the following note professional asp.net mvc 2 scott hanselman ++ you might ask — why did go through effort of creating <form> within our delete confi rmation screen? why not use standard hyperlink link action method actual delete operation? reason because want careful guard against web-crawlers , search engines discovering our urls , inadvertently causing data deleted when follow links. http-get-based urls considered safe them access/crawl, , supposed not follow http-post ones. rule make sure put destructive or data-modifying operations behind http-post requests. if web-crawlers , search engine have no access page containing deletion button, safe use standard hyperlink link action method doing actual delete operation? a rule of thumb shouldn't change data. if want change data use post. that why scottha etc used form submit delete. if doesn't work app can use if needed. alternatively use javascript submit form w

c++ - Conversion from 'char' to non-scalar type 'Vector<char>' error thrown unknown reason -

error thrown unknown reason #include "std_lib_facilities.h" int main() { vector<char> shape = ('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); return(0); } that 1 line vector throws error i've never seen before nor can figure out... :: g++ tictactoe.cpp -o ttt tictactoe.cpp: in function int main()': tictactoe.cpp:5: error: conversion from char' non-scalar type `vector' requested see in each tic-tac-toe box start _ , go either x or o, i'm doing without graphics library terminal graphics. if value same can use following constructor of std::vector : std::vector<char> shape( 9, 'a' ); if part or values distinct can use constructor follows: static const char ini[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' }; std::vector<char> shape( ini, ini+si

sql - get month name from date in oracle -

how fetch month name given date in oracle? if given date '15-11-2010' want november date. select to_char(sysdate, 'month') dual in example be: select to_char(to_date('15-11-2010', 'dd-mm-yyyy'), 'month') dual

Refreshing a page in a browser yields POST or GET request? -

i learning asp.net mvc form processing , confused following: what happens if push refresh button on browser? makes post or request? this dependant on last call made browser current data. eg: a) if submitted form, performing post , hit refresh, browser post. b) if clicked link took page, performing get, you'll refresh perform get. if you're starting out understanding get/post methods, there nice pattern should understand not in situations data posted again , again users refresh browser after post: http://en.wikipedia.org/wiki/post/redirect/get and an example asp.net mvc

c++ - Packaging Linux software while keeping a sane file structure -

so have created piece of software wanna package , post arch linux user repositories, aur, -should note, have never packaged distro before - , have got packaged , installed on own machine via arch's package manager pacman successfully, wondering how on earth gonna structure folders , files? normally when wrote software, use structure: build/ | src/ | makefile as minimum, , in case of piece of software, makefile nothing more compile .cpp file src/ build/. make arch package, had create .rc file, use program daemon , pkgbuild file, file tells makepkg program how build installer-package - these 2 files, though, specific arch. if wanna package program debian, need set of files too, these files work debian. now, can't put .rc file , pkgbuild file in programs root folder, since "be mess" if had files build package debian, put distro-specific files? need have in programs root folder -at-least- able keep track of it, , initial thought go structure distro/arch/ arch li

javascript - Dectecting browser with Dojo? -

can detect browser client using dojo? want put function in place if ie8. thanks look at http://dojotoolkit.org/reference-guide/quickstart/browser-sniffing.html if(dojo.isie == 8){ // ie8 ... }

django models - Feincms mixing content types -

i have question , want know if can mix 2 existing contentypes 1 custom contentype. need own content type contentype richtextcontent , imagecontent can use special template show image right , text left. is possible ?. yes, it's possible. i've written own custom contenttypes similar reasons. should review code richtextcontent model in <python egg dir>/feincms/content/richtext/models.py you'll want implement own model class, , override render() method use django.template.loader.render_to_string() load template want.

Acessing Controller and Action name at _initVars() Zend Framework -

i hope had made me clear in question! i access getcontrollername() , getactionname() inside _initvars(). i'm trying do: protected function _initvars() { $this->bootstrap('layout'); $layout = $this->getresource('layout'); $view = $layout->getview(); $view->theme = 'my_theme'; $this->bootstrap('frontcontroller'); $front = $this->getresource('frontcontroller'); echo '<pre>'; print_r($front->getrequest()); echo '</pre>'; exit; return $view; } i'm getting no response, fields controllername , actionname returning empty, in return: zend_controller_front object ( [_baseurl:protected] => [_controllerdir:protected] => [_dispatcher:protected] => zend_controller_dispatcher_standard object ( [_curdirectory:protected] => [_curmo

Php Quickform Grouprule for Html-Select and Html-Input Group needed -

i'm working on big html form. use php quickform create , validate it. form has few groups consist of input-textfield , select-field. code 1 of groups looks this: $autoren = array("0" => "", "1" => "bob", "2" => "harry", "3" => "autor 3"); $arr[] = &html_quickform::createelement('text', 'autort', 'autortext', array('size' => 37, 'maxlength' => 50)); $arr[] = &html_quickform::createelement('select', 'autoro', 'autoroptions', $autoren); $form->addgroup($arr, 'autoren', 'autor:', '<br />'); i'm in desperate need of kind of rule/grouprule validates group in following way: if both fields empty -> error. if 1 of fields has value in it, other 1 must empty, otherwise -> error. if both fields have values in them, must match, otherwise -> error. can explain me ho

oracle10g - Oracle Preparations -

i new oracle.can tell me books , web sites suitable learn oracle ? the oracle manual: http://www.oracle.com/pls/db111/portal.all_books

c# - In the child page, I want to find master page's Content placeholder and add text to it. How do I make that possible? -

i tried much:- protected void page_preinit(object sender, eventargs e) { class1 obj = new class1(); datatable dt = new datatable(); dt = obj.get_text(); contentplaceholder contentplaceholder1 = (contentplaceholder)this.master.findcontrol("contentplaceholder1"); contentplaceholder1. ???? } given have valid reference contentplaceholder1... in line: contentplaceholder1. ???? do this: // add text place holder. contentplaceholder1.controls.add(new literalcontrol("my text insert"));

c# - NHibernate ID Private Setter (any workaround) -

here "simplified" class can mapped using nhibernate; public class template { public virtual int id { get; private set; } public virtual string name { get; set; } } as id field has private setter can no longer have code in our application manually set id field; var defaulttemplate = new template { id = (int)templateenum.default, name = "default" } here manually creating defaulttemplate object can assign anything. other templates manually created users , saved database. any ideas how can still achieve kind of functionality? please note: c# winforms, .net 3.5 , don't want use reflection this. i this, if feasible: public class template { public virtual int id { get; private set; } public virtual string name { get; set; } public static readonly template default = new template() {id = (int)templateenum.default, name = "default"}; } then, can 'get' default template, without having instantiate outside of template

ruby - Do I need to allow the application "stoned" to accept incoming networking connections? -

i turned firewall on, , while running multiple rubies, got question do want application "stoned" accept incoming network connections? clicking deny may limit application's behaviour. setting can changed in firewall pane of security preferences. after googling, worked out wasn't malicous app (and not this stoned !), maglev (presumably "stoned" being "stone daemon"). unless i'm serving web content or otherwise acting on network, need enable "stoned"? if you've installed maglev, "stoned" refers stone process manages repository image (where ruby objects stored). can deny stoned (and others, e.g., topaz, netldi, gem, etc.) , things should work long processes on same machine (i.e., run maglev-ruby on same machine running stone). if trying connect remote clients (usually remote vms) stone, you'll need allow incoming connections netldi , gem.

php - Inserting unknown number of rows into a MySQL database -

i'm writing online application form , 1 of pieces of data i'm trying collect users education history; school name, school city, years there , achievements while there. data collected anywhere between 0 4 different schools , user dynamically adding more fields if required. my question how captured within database since don't know how many schools user adding? can done in 1 table, or need create multiple tables , capture education data in separate table? any or pointers appreciated. thanks. you need separate tables. 1 row per person, , row per school. schools can related people using either personid in school table, or additional table representing "person attended school" relationship. any association of 1 entity (person) multiple other entities (schools) requires more 1 table.a general rule follow 1 table per "entity", plus additional tables many-to-many relationships.

validation - Perl: What type should be used for class object in "validate" function -

i want pass reference of class object called "a" in constructor. , use "validate" function check it. like that: test1.pm my $object = object1->new; $newobject = object2->new({ param1 => $object, }); test2.pm sub new { $class = shift; (%options) = validate (@_, { param1 => { type => scalarref, default => undef}, }); ... } the problem i'm not sure type of parameter param1. tried "object" , "scalarref" there errors "scalarref not allowed while strict sub". what type should use? it looks you're trying quasi- moose thing here. in moose, don't create new subs, because moose you. if need anything--you create build sub. the perl (5) base object system doesn't work moose, 'scalarref' or whatever make in base perl. do realize passing hashref new ? do realize vaildate getting 2 hashrefs? validate( {}, {} ) and if scalarref has not be

php - "Lost connection to MySQL server" when trying to connect to remote MySQL server -

i using zend framework develop application , try connect remote mysql database in lan. the database connection settings in zend follows: [general] db.adapter = pdo_mysql db.params.host = 192.168.1.2 db.params.port = 3306 [live:general] db.params.username = root db.params.password = * * db.params.dbname = djudd [development:general] db.params.username = root db.params.password = * * db.params.dbname = stellarengine i got following error: fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy000] [2013] lost connection mysql server @ 'reading initial communication packet', system error: 111' in /usr/share/php/zend/db/adapter/pdo/abstract.php:129 stack trace: #0 /usr/share/php/zend/db/adapter/pdo/abstract.php(129): pdo->__construct('mysql:host=192....', 'root', 'password', array) #1 /usr/share/php/zend/db/adapter/pdo/mysql.php(96): zend_db_adapter_pdo_abstract->_connect() #2 /usr/sha

c# - How to send error reports from a .net error dialog? -

in 2008 jeff wrote post on crashing responsibly . in spirit, i'm trying add "send bug report" button crash error dialog. idea user can send full bug report includes version information, os info, stack trace... information should put in message body or in attachment files. unfortunately, sending such email .net application appears non-trivial: system.net.mail not looking for: can't sure connection smtp server can made in environments, , don't want put burden of configuring local smtp hostname , port on users. instead, want launch existing email software on system precomposed message. using os open "mailto:" url works, there annoying restrictions amount of data can passed way. also, appears attachments not supported mailto spec . mapi.dll want illustrated codeproject article , read elsewhere mapi.dll fundamentally incompatible .net causing random crashes. has out there found safe , reliable solution this? we have solved creating

How can I disable all the Windows crash handlers like DrWatson and so on -

i'm developing unit test automatic execution application , need when 1 application crashes no dialog appears. crash dump great main requirement no dialog shown because i'm automating execution , won't automate dialog. i've disable windows error reporting change has been different dialog without send option. any ideas? thanks. as far remember windbg has way launched on crash, saving minidump , exiting without dialog.

How to source all vim files in directory -

i have split .vimrc several files , placed them ~/vimfiles/vimrc.d/ . currently source each file in directory using exact name: source ~/vimfiles/vimrc.d/file1.vim source ~/vimfiles/vimrc.d/file2.vim etc. how make loop thourgh files in directory have such loop in .vimrc: for file in ~/vimfiles/vimrc.d/*.vim source file enfor as mb14 has said, if put them in ~/.vim/plugin sourced automatically. information, however, if want source of files in vimrc.d directory, (requires relatively recent vim): for f in split(glob('~/vimfiles/vimrc.d/*.vim'), '\n') exe 'source' f endfor you may interested in autoload mechanism, described in :help 41.15 : if you're defining lot of functions, can make start-up bit quicker functions loaded first time they're used.

Accept 2 strings with same length using turing machine -

this problem asked in net exam. can please tell me how solve problem. problem accept 2 string same length. i wnat answer in {turing machine table q0==> [q0,b,a] } format. shubhadaa the purpose of exam show can devise algorithm , express in turing's notation, giving machine table counter productive. assuming, however, both strings encoded on same tape, simple character marking algorithm should suffice.

text - jQuery contents() causing problems in IE -

i'm using contents() function in jquery in order obtain text within li can't target directly span or other selector. the code i've written follows: $('#tierarray_' + tierid).contents().each(function(i, node) { if (node.nodename == "#text") { node.textcontent = name; } }); this works fine in firefox , changes target text set in 'name'. in ie following errors: "object doesn't support property or method" this seems relate line "node.textcontent = name" when comment out error disappears. in nutshell i'm trying replace text newly created text, html markup follows: <li class="ui-state-default" id="tierarray_105"> <span style="display: block;" id="revoke_105"> <a class="tierstatus" title="revoke" href="#">revoke</a> | <a class="tieredit" id="edit_tier_105" title="bla 3aaa

ruby on rails - Radiant: "Archive Month Index" -

i trying set simple blog radiant cms , have problem "archive month index". set described on weblog can't work. the code the same guy in video st using. it's: <r:archive:children:each> <div class="blog-post"> <h3><r:link /></h3> <p> <r:content /> </p> </div> </r:archive:children:each> ...for archive index. however when go onto post/2010/12 site (or other date) amazing standardtags::tagerror in sitecontroller#show_page recursion error: rendering `body' part. ...instead of index page month. can't think of how rendering body part twice. i had same problem. default blog setups created radiant's installer. the blog pages in radiant looks like: + articles (archive) | +- %b %y archives (archive month index) | +- first post | +- second post | +- third post everything under articles page seems included in results returned <

javascript - Why do custom styled Google Maps (v3) not support marker animation (pin drop)? -

for example, cannot combine concepts of simple example: link text concepts of example: link text , uses styled v3 api. in chrome error saying that: uncaught typeerror: cannot read property 'drop' of undefined and refers line of code: animation: google.maps.animation.drop, when replace javascript link reference use version of api first example, error goes away, lose custom styling. have not tried in firefox or ie. edit: link example: link text you're referencing external js file references google's js file. wasn't able use that, gave me error. i re-wrote code using google's js directly: preview here: http://jsfiddle.net/kai/unh2m/embedded/result/ view source here: http://jsfiddle.net/kai/unh2m/

conditional - PHP - and / or keywords -

is && same "and", , || same "or" in php? i've done few tests, , seems behave same. there differences? if not, there other php signs have word equivalents , think makes code easier read? and , or have higher lower precedence && , || . more exact && , || have higher precedence assignment operator ( = ) while and , or have lower. http://www.php.net/manual/en/language.operators.precedence.php usually doesn't make difference, there cases when not knowing difference can cause unexpected behaviour. see examples here: http://php.net/manual/en/language.operators.logical.php

sql server - Getting the ROWCOUNT value (not @@ROWCOUNT) in SQL -

is there way see rowcount set to? the component used call stored procedure has option limit how many rows returned, apparently setting rowcount. 1 stored procedure returns single aggregated row, intermediate queries return more limit , getting truncated. function of generic , used call other stored procedures; other procedures may need limit. right setting rowcount large number @ top of stored procedure , setting (hard-coded) regular limit before return result. don't maintain component calls stored procedures may not know if returned row limit changed. i'd set local variable current rowcount value, , set @ end. there way see rowcount set to? if query sys.dm_exec_sessions dmv return number of rows returned on session point (should of course same @@rowcount). select row_count sys.dm_exec_sessions session_id = @@spid you might able play around see if can use it right setting rowcount large number @ top of stored procedure you can set rowcount 0 ,

actionscript 3 - Is it possible to share a NetConnection/NetStream between separate SWFs in the same HTML page -

i aware can share simple objects using localconnection, not (in limited testing) appear work netconnection or netstream. in short, wish have single swf acts netconnection proxy other swf files in html page. client swfs require direct access netstream objects on proxys netconnection. is @ feasible, or each client swf require own netconnection? i aware build entire application in flash , utilize single netconnection internally, not want do. thanks! that depends on want it. netconnections can stream videos , there no way have shared between different swfs on same page. on other hand, can used simple loading of data. small enough pass through localconnection without issues, depends on size of data. you need have netconnection complete load before being able send through localconnection . netconnection inaccessible other swf's, allow load data , send it. remember: localconnections serialize objects , not keep class data when arrives @ target location.

javascript - How can I use Java in an Ant buildfile? -

i'm trying write custom scriptselector, , need read contents of each file. is there way use java, , not javascript, language of scriptselector? if not, there way, silly sounds, read file object? <scriptselector language="javascript"> f = self.getfile(); println(f); //how read file? self.setselected(true); </scriptselector> here's how. along lines of: <scriptselector language="javascript"> importpackage(java.io); importpackage(org.apache.tools.ant.util); fileutils = fileutils.getfileutils(); f = self.getfile(); println(f); if( f.getabsolutepath().endswith(".xyz") ){ fis = new fileinputstream(f.getabsolutepath()); isr = new inputstreamreader(fis); println('reading it!'); filecontents = fileutils.readfully(isr); println(filecontents); self.setselected(true); } </scriptselector>

vb.net - Why isn't this Linq query on Dictionary<TKey, TValue> working as DataSource -

i have following in vb: dim sources = source in importsources select new _ {.type = source.key, .source = source.value.name} dgridsourcefiles.datasource = sources when debug, sources shows in-memory query , has 2 records within. yet datagrid view not show records. so why won't work? suggestions can either vb or c#... update when use: dim sources = (from source in importsources select new _ {.type = source.key, .source = source.value.name}).tolist() ...the datasource displayed. your linq query lazily evaluated , implements ienumerable<t> interface (as far know), means results not established until enumerator calls movenext somewhere (as happens within foreach loop, example). it seems datasource property not enumerate contents in way. it's expecting implementation of ilist (or 1 of few other interfaces—see below) can access items index. used internally control sorting, filtering, etc. in mind, it's setting datasource proper