Posts

Showing posts from September, 2014

javascript - Shorten JS if or statement -

this question has answer here: how check if array includes object in javascript? 38 answers is there anyway shorten in javascript: if (x == 1 || x == 2 || x == 3 || x == 4) if (x == (1 || 2 || 3 || 4)) ? you can use use array.indexof [1,2,3,4].indexof(x) !== -1 you can use objects kind of hash map: //note: keys coerced strings // don't use method if looking object or if need // distinguish number 1 string "1" my_values = {1:true, 2:true, 3:true, 'foo':true} my_values.hasownproperty('foo') by way, in cases should usi "===" strict equality operator instead of == operator. comparison using "==" may lots of complicated type coercion , can surprising results sometimes.

delphi - How is right to format and validate edit control to accept only float or currency values -

i have application needs accept float or currency values in edit control. question must format , validate edit controls input accepts numbers, comma or dot (comma or dot depends on system locale). , formatting ##.## (45.21). want 1 method can control edit controls wehre float formatting , validating used. right have code in onchange event uses trystrtofloat method, "'' not floating point number" errors. maybe guys have done more me , have great examples how right. if want continue using same validation approach, enhance algorithm consider edge cases (and how want manage that). for example, can consider accepting empty string valid input , don't throw exception, or not. must consider how want perform user interaction in case of malformed input. example if user enters invalid number, want stop user input values @ same millisecond... or can take more natural approach (for example, validating until user thinks correct). you can manage validatio...

emacs - set path in aquamacs -

i switched computers , can't figure out how able auctex search correct path find template tex files (for use \input{}). thought aquamacs uses $path bash_profile or bashrc doesn't seem work. suggestions? thanks! try auctex-config.el . might have edit set correct paths texbin , other binaries necessary. if have auctex-config.el, might need edit set paths correctly.

Program to compare two xml file -

i compare 2 xml files using kind of program ( may using xlst or java), actual need exclude xpath's comparision. if program written may can configure them in configuration file. not sure xslt. there open source library action ? tool runs on batch mode me this supports java , .net : xmlunit

lucene.net - Lucene sorting in (keyword, alphabetical) order -

how sort search results in following order (query phrase, alphabetical). give example, if have documents in index, each 1 field (foodname). food names of documents are fat chicken chicken breast chicken lasagna if query search word "chicken", results in following order chicken breast chicken lasagna fat chicken please note boosting factor these documents same in indexing stage. appreciated thanks -venu i'll give high level overview of i'd do. consider using food ingredients / recipes types dictionary & assigning higher boosting words in index matches items in food dictionary. , perhaps go further, assign weights keywords in food dictionary. here's example of food ingredients dictionary .

python - Can I read from the AppEngine BlobStore using the remote api -

i trying read (and subsequently save) blobs blobstore using remote api. error: "no api proxy found service "blobstore"" when execute read. here stub code: b in bs.blobinfo.all().fetch(100): blob_reader = bs.blobreader(str(b.key)) file = blob_reader.read() the error occurs on line: file = blob_reader.read() reading file personal appspot via terminal with: python tools/remote_api/blobstore_download.py --servername=myinstance.appspot.com --appid=myinstance so, reading blobstore possible via remote api? or code bad? suggestions? we added blobstore support remote_api. make sure you're using latest version of sdk, , error should go away.

table - Create an activerecord class that has a field that behaves like an enum (but is a reference to another activerecord class) -

sorry long title, question rather simple: i have 2 classes, player , role (they activerecord table) class player { ...various fields... [belongsto("roleid")] public role role {get;set;} } class role { ...various fields... [property] public string name {get;set;} } a player, can have 1 role, (for me), doesn't matter if role has 0-1-2-many players, omit hasmany attribute (my example easy, database bigger this). role behaving user-defined enum, possible this? correct way? edit 1: if have similar situation need role belogs 1 player (onetoone), again omit part "role" class (so role doesn't know association) if specify belongsto attribute , not hasmany attribute, want done, role doesn't matter if has 0-1-2-many players.

Why isn't PInvoke crashing in case of violated calling convention (in .NET 3.5)? -

my solution has unmanaged c++ dll, exports function, , managed application pinvokes function. i've converted solution .net 3.5 .net 4.0 , got pinvokestackimbalance "a call pinvoke function [...] has unbalanced stack" exception. turned out, calling __cdecl'ed function, __stdcall: c++ part (callee): __declspec(dllexport) double testfunction(int param1, int param2); // default __cdecl c# part (caller): [dllimport("testlib.dll")] // default callingconvention.stdcall private static extern double testfunction(int param1, int param2); so, i've fixed bug, i'm interested in how did work in .net 3.5? why (many times repeated) situation when nobody (neither callee, nor caller) cleans stack, did not caused stack overflow or other misbehavior, worked ok? there sort of check in pinvoke, mentioned raymond chen in article ? it's interesting, why opposite type of breaking convention (having __stdcall callee pinvoked being __cdecl) not working @ a...

php - Dijkstra algorithm optimization/caching -

i have following dijkstra algorithm 3 input variables (start, stop , time). takes 0.5-1s complete. hosting provider says it's using resources , should implement caching mechanism. question is, how? because have 3 variables, if 1 of them changes - whole result different (because have additional statements time, nevermind). how implement caching mechanism or optimisation? i have 1700 nodes . <?php require_once("../includes/db_connection.php"); ?> <?php require("../includes/functions.php"); ?> <?php require("../includes/global_variables.php"); ?> <?php // function put "maxvalues" time (in case 10 000 because know can't take longer source end node) function array_push_key(&$array, $key, $value) { $array[$key] = $value; } // start counter $timem = microtime(); $timem = explode(' ', $timem); $timem = $timem[1] + $timem[0]; $start = $timem; // provided values $star...

c++ - Make Custom Self-Extractor -

i'll explain want, , i'll explain how i'm trying achieve it. want know if i'm gonig right way, or if there easier. what want : self-extracting executable happens have additional entry point (which makes executable suitably usable if dll). additional entry point must not part of compressed payload. entry point, strangely enough, not execute lzma functions (please don't ask why...long story). fyi: making executable dll entry point trivial matter - know how that. how i'm pursuing this : i've downloaded lzma sdk , build own c++ self-extractor. there appears no lzma api documentation. evidentally, if want learn how use lzma must read either .\c\util\7z\7zmain.c or .\cpp\7zip\bundles\lzmacon\lzmaalone.cpp. don't know if studying fastest learning tool. once create self-extraction code, add dll entry point need , build. resulting exe self-extractor concatenate zip file (a dos command should suffice concatenate 2 files). should achieve goal. ...

facebook - Uploading photo Rest API without posting to wall -

i'm doing fb app users able upload photo photo album created @ same time. problem want photos go album avoiding post of same photos on users wall , in users news feed. not sure if that's possible or if there's workaround. thanks help you need use parameter no_story=1 within call. this not documented on album or photo , on user , works photos well. related to: facebook upload photo without news feed post? possible?

Flash vs HTML5 for Facebook Games - A Business Perspective -

i'm in planning , learning stages of building facebook game. past year foremost question has been, "flash or html5?". rather try decide answer that, thought give markets both more time mature , learn how design game , how manage server element. over last year i've devoured thousands of pages of text concerning game development , business development, along getting solid footing in as3, python, php, c# , javascript. so, i'm interested in picking system best job rather than, example, starting off assuming game logic in python because that's enjoy most. the game @ core strategy game , plan use many mobile phones extensively in addition standard facebook "invite friends" features. graphics won't flashy , in places rather flat because of thematic elements, rather 3d isometric farmville or other flash facebook games. so technological perspective html5 doesn't have real advantage can see on flash, , neither flash have real advantage on htm...

lua - (Secure) Random string? -

in lua, 1 generate random values, and/or strings using math.random & math.randomseed , os.time used math.randomseed . this method has 1 major weakness; returned number random current time, and interval each random number one second , way long if 1 needs many random values in short time. this issue pointed out lua users wiki: http://lua-users.org/wiki/mathlibrarytutorial , , corresponding randomstrings receipe: http://lua-users.org/wiki/randomstrings . so i've sat down , wrote different algorithm (if can called that), generates random numbers (mis-)using memory addresses of tables: math.randomseed(os.time()) function realrandom(maxlen) local tbl = {} local num = tonumber(string.sub(tostring(tbl), 8)) if maxlen ~= nil num = num % maxlen end return num end function string.random(length,pattern) local length = length or 11 local pattern = pattern or '%a%d' local rand = "" local allchars = "" ...

php - LightOpenID forbidden when redirecting back -

i'm trying use lightopenid, should simple , case of uploading files testing works. when use example-google.php click login button, first time asked me login google , allow/remember site i'm building. redirects example-google.php?login , load of attributes. page says "forbidden. don't have permission access path/to/folder/example-google.php on server." if delete attributes including ?login in url, "login google button" have file permissions correct. if click button on redirects me forbidden page right away, google remembering i'm logged in , happy site using login. i've rattled brain on this, tried searching , sorts. appreciated i'm near point of abandoning openid (because other libs seemed more trouble implement). after lot of searching on issue, got work. issue apache server or hosting provider's apache server has mod_security configured block urls in querystrings. hosting provider hostgator, , did ask them whitelist dom...

How to send an SMS type message using Processing data? -

i have code written in processing works serial monitor arduino fio . have few sensors on fio output warning message when value surpasses threshold. how warning statements sent phone number text message well? if need send email particular phone (i.e. own) or small set of phones known in advance, many carriers have email sms gateway. example, sms verizon phone 304-555-1212, send email 3045551212@vtext.com see: http://en.wikipedia.org/wiki/list_of_carriers_providing_email_or_web_to_sms here example on how send email processing: http://www.shiffman.net/2007/11/13/e-mail-processing/

mysql - Does a Rails foreign_key have to be an integer? -

we have imported data 3rd party provides non-integer unique ids. in rails 2.2.2 able use :foreign_key on our has_many relationships non-integer column , worked. but upgrading rails 2.3.8 , seems force foreign_key integer. has found way working? according this answer , procedure has completed using execute : create_table :employees, {:id => false} |t| t.string :emp_id t.string :first_name t.string :last_name end execute "alter table employees add primary key (emp_id);" and sean mccleary mentioned , activerecord model should set primary key using set_primary_key : class employee < activerecord::base set_primary_key :emp_id ... end

How to assign values using fields_for with a has_many association in rails 3 -

i have 2 models described below. make when user creates product, have select categories exist in categories table. tables: products: id, name categories: id, name categories_products: category_id, product_id class product has_and_belongs_to_many :categories accepts_nested_attributes_for :categories end class category has_and_belongs_to_many :products end class productscontroller < applicationcontroller def new @product = product.new @product.categories.build end def create @product = product.new(params[:product]) if @product.save redirect_to @product, :notice => "successfully created product." else render :action => 'new' end end end views/products/new.haml = form_for @product |f| = f.text_field :name = f.fields_for :categories |cat_form| = cat_form.collection_select :id, category.all, :id, :name, :prompt => true howeve...

mysql - PHP: Is implementing the database layer as a singleton acceptable? Code inside -

i know singletons bad. bad this, too? class daomysql { private static $instance; private $pdo; private function __construct() { $this->pdo = new pdo('mysql:dbname='.mysql_default_database.';host='.mysql_hostname, mysql_username, mysql_password); $this->pdo->query('set names \'utf8\''); } /** * @return daomysql */ static public function singleton() { if (!isset(self::$instance)) { $c = __class__; self::$instance = new $c(); } return self::$instance; } /** * @return pdo */ public function getpdo() { return $this->pdo; } } to use this, this. (this bean class data objects extends.) public function delete() { $calledclassname = get_called_class(); $query = "delete `" . $calledclassname::table . "` `id` = $this->id"; return daomysql::singleton()->getpdo()->exec($q...

oracle - VBS Removing files within a directory using FileSystemObject with exceptions? -

i work rather finnicky oracle business intelligence software , have issues entail, clearing out specific data on users systems, , synchronizing server pull down data again. i've got vbs script i'm working on removes key directories, , renames others , stops services etc. where i'm stuck on 1 specific directory. using filesystemobject, easiest way remove every single file within directory exception of single folder? so, specific example, have c:\oraclebidata\sync\config where want delete inside of "sync" directory, exception of config directory. takers? snippet: option explicit const folderspec = "c:\oraclebidata\sync" const excludefolder = "c:\oraclebidata\sync\config" deletesubfolders createobject("scripting.filesystemobject").getfolder(folderspec), excludefolder public sub deletesubfolders(byref myfolder, exclfolder) dim sf each sf in myfolder.subfolders if not (lcase(sf.path) = lcase(exclf...

ios4 - Getting Error : " CorePlot-CocoaTouch.h: No such file or directory" while implementing Core-Plot in iPhone SDK -

i getting following error when try implement core-plot in iphone app. coreplot-cocoatouch.h: no such file or directory i downloaded installed core-plot package below link http://code.google.com/p/core-plot/w/list still not seem work , gives error mentioned above. what wrong? please , suggest. thanks use link . , add -all_load , -objc in other linker flags (get info -> build (in linking section find other linker flags)). and give complete path in header search paths (in search path section) core-plot framework. looks .../core-plot/framework.

c++ - Boost Spirit Qi Re-Establish Skipping with custom skip grammar -

i have grammar has, until now, been using standard boost::spirit::ascii::space / boost::spirit::ascii::space_type skipper. i have rules use skipper , don't, like qi::rule<iterator, ptr<expression>(), ascii::space_type> expression; qi::rule<iterator, ptr<term>()> term; when use non-skipping nonterminal (like term ) inside of skipping nonterminal (like expression ), works expect - whitespace matters inside term nonterminal. further, until now, have been fine including nonterminals use skipper inside of nonterminals don't using qi::skip restablish skipping, such as index = (qi::lit('[') >> qi::skip(ascii::space)[explist >> qi::lit(']')]); this way, whitespace not significant inside of [] braces, outside. however, want add own custom skipper (i want make newlines significant , later add comment-skipping). skipper grammar looks like: struct skip_grammar : qi::grammar<iterator> { qi::rule<iterator...

c++ - Where are const objects stored -

i understand functions should not return references automatic variables. wanted understand constant objects stored i.e if stored in memory section along static global variables . here code on visual studio 8 . looks const objects stored auto variables. assuming things right or implementation specific or depend on whether constructor trivial ? would great if explain why each of these cases behave way do. //here i'm intentionally returning ptr local const ptr hope syntax right const char* const* get_const_char_ptr() { const char * const ptr = "downontheupside"; return &ptr; } const int& get_const_int() { const int magic_number = 20; return magic_number; } const string& get_const_string() { const string str("superunknown"); return str; } const string* get_const_string_ptr() { const string str("louderthanlove"); return &str; } int main() { //case1 const int &i = get...

Drawing a circle (with sectors) using HTML, CSS, or jQuery -

Image
i want draw circle sectors on without using external images image below: i'd prefer using html, css, or jquery, if don't work, other language do. how raphael.js ? from web site: raphaël small javascript library should simplify work vector graphics on web. if want create own specific chart or image crop , rotate widget, example, can achieve , library. ... raphaël supports firefox 3.0+, safari 3.0+, chrome 5.0+, opera 9.5+ , internet explorer 6.0+.

How to create Fixed Bid projects in OpenERP? -

im trying implement openerp v6.0.0rc in company services company. boss told me create fixed bid projects. searched lot , found openerp has no functionality so. tried using analytic accounts(fixed cost contracts).i create new analytic account. tried generate invoice creating new analytic entry manually. analytic account->all analytic entries->new when try save entry warning pops - " parent record doesnt exist " tried lot, cant around this. please me warning. or if knows other way create fixed bid project. regards nikhil nikhil below. 1) create product type service. 2) create user. 3) create employee. here link product , employee. when creating employee go tab time sheet , there select product of type service. 4) go project task working on , change person assigned it. change user employee/user created in points 2 , 3. 5) make time sheet lines , things should work fine. all best.

Javascript Create JSON Hash Array for jQuery AJAX -

i desperately trying manually create json-style array in javascript send on network via jquery's ajax method. var fieldsobj = {fields:[]} $(".fact_field", fact).each(function(index, field){ var index = $(field).attr("data-index"); var name = $(".fact_field_label", field).text().trim(); var value = $(".fact_field_value", field).text().trim(); fieldsobj["fields"].push({index:index, name:name, value:value}); }); //... $.ajax({ type: 'put', url: url, data: fieldsobj, success: function(data){... }, complete: function(){... } }); what want following: {fields => [{index:0, name:1, value:2},{...},{...}]} what this: {"fields"=>{"0"=>{...}, "1"=>{..}, "2"=>{...}, "3"=>{...}} what doing wrong? when pass object data property, jquery pass url-encoded form parameters (e.g. foo=bar&moo=too ) in b...

c++ - Sorting vector of pointers -

i need sort collection of element . there specific advantage of sorting vector of element* i.e std::vector<element*> vectref; to sorting vector of element . std::vector<element> vect; assuming write comparator accordingly. element struct show below: struct element {     record *elm;             element(record *rec)     {         elm = new record();         //...copy rec     }     ~element()     {         delete elm;     } }; how expensive element 's copy constructor? deep copy of contained record object? sorting vector<element> require many copies of element objects unless swap overloaded properly. i'm not sure rules whether sort must use swap , if must use user's overloaded version of swap ; http://accu.org/index.php/journals/466 has information that. sorting vector<element*> copying pointers around, cheaper. c++0x changes this, assuming element has efficient move constructor , move assignment operator. ...

html - This form doesn't update the user selection at the drop down list when submitting the form through PHP -

<!doctype html> <html> <script type="text/javascript"> function updateselecttarget () { var id = this.options[this.selectedindex].value; var targets = this.parentnode.getelementsbytagname("select"); var len = targets.length; (var = len - 1; > 0; --i) { if (targets[i].id == id) { targets[i].style.display = "block"; } else { targets[i].style.display = "none"; } } } function initchangehandlers () { var i, el; var allselectelements = document.getelementbyid("myform").getelementsbytagname("select"); (i in allselectelements) { el = allselectelements[i]; if (el.classname == ...

.htaccess - htaccess rewrite 3 conditions to real domain -

i want write short htaccess script rewrite following conditions, want whole website, not homepage. eg. domain.com redirects www.domain.org www.domain.com redirects www.domain.org domain.org redirects www.domain.org note, needs work pages of site forced www.domain.org domain. example, domain.org/contact-us/ redirects www.domain.org/contact-us/ and domain.com/about/ redirects www.domain.org/about/ etc etc appreciate help. matt rewritecond %{http_host} ^(domain.com|www.domain.com|domain.org) rewriterule (.*) http://www.domain.org% {request_uri} [r=301,nc,l]

ios - Accessing SKProductResponse from outside of object -

i'm integrating in app purchase app , have created object implements delegate callback: - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response { nsarray *myproduct = response.products; // populate ui [request autorelease]; } as 1 of methods. in case have multiple skproduct objects returned response.products. i'd able access myproduct array outside of object in view controller reflect of skproduct details price , product description. here's interface declaration in app purchase class: @interface inapppurchasemanager : nsobject <skproductsrequestdelegate, skpaymenttransactionobserver> { nsarray *myproducts; skproductsrequest *productsrequest; } // public methods - (void)loadstore; - (bool)canmakepurchases; - (void)purchasefeature:(nsstring *)productid; @property (nonatomic, retain) nsarray *myproducts; @end then viewdidload method in view controller: - (void) viewdidload { ...

ASP.NET MVC Display Template for strings is used for integers -

i hit issue asp.net mvc display templates. model: public class model { public int id { get; set; } public string name { get; set; } } this controller: public class homecontroller : controller { public actionresult index() { return view(new model()); } } and view: <%@ page language="c#" inherits="system.web.mvc.viewpage<displaytemplatewoes.models.model>" %> <!doctype html> <html> <head runat="server"> <title>index</title> </head> <body> <div> <%: html.displayformodel() %> </div> </body> </html> if need reason display template strings create string.ascx partial view this: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol<string>" %> <%: model %> (<%: model.length %>) and here problem - @ runtime following exception thrown: "the model item pa...

android--unable to add listener to inflated table- -

i have table defined in xml , row defining view xml. let's need populate table 5 rows. running following code: final viewgroup table = (tablelayout)findviewbyid(r.id.table); view row = null; textview title = null; for(int i=0; i<5; i++) { row = layoutinflater.from(this).inflate(r.layout.row, null, false); title = (textview)row.findviewbyid(r.id.text_title); title.settext("val"); imageview x= (imageview)itemview.findviewbyid(r.id.remove); x.setonclicklistener(delimg); table.addview(row); } private onclicklistener delimg = new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub textview tv = (textview) findviewbyid(r.id.pname); tv.settext("deleted item!"); } }; it works fine when try add onclicklistener image, changes first row , not corressponding row. please help. where'...

vb.net - Need to exclued enter key from textbox -

the folowing code read text text based file textbox enter key displayed (as 2 small boxes) need code subtract absolute last character in textbox how can done? private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim readalpha system.io.streamreader readalpha = system.io.file.opentext("c:\alpha.val") textbox1.text = (readalpha.readtoend) readalpha.close() dim readbeta system.io.streamreader readbeta = system.io.file.opentext("c:\beta.val") textbox2.text = (readbeta.readtoend) readbeta.close() 'textbox1.text = "<enter first value>" 'textbox2.text = "<enter second value>" end sub you can replace character, this: textbox2.text = (readbeta.readtoend).replace(environment.newline, " ") but it's better check if string null: string.isnullorempty before. dim buffer string buffer = readbeta.readtoend if not ...

python - Does a StopIteration exception automatically propagate upward through my iterator? -

i'm implementing iterator in python wraps around iterator , post-processes iterator's output before passing on. here's trivial example takes iterator returns strings , prepends filtered myiter: each one: class myiter(object): """a filter iterator returns strings.""" def __init__(self, string_iterator): self.inner_iterator = string_iterator def __iter__(self): return self def next(self): return "filtered myiter: " + self.inner_iterator.next() when inner iterator finishes, raise stopiteration exception. need special propagate exception wo whatever code using my iterator? or happen automatically, resulting in correct termination of iterator. you not have special - stopiteration exception propageted automatically. in addition - may want read yield keyword - simplifies creation of generators/iterators lot.

delphi - How is Enumerator created with for in construction destroyed? -

i have collection derived tcollection, implementing getenumerator can use in construction like for lelem in lcollection the enumerator derived tobject, standard enumerators supplied delphi , therefor doesn't have owner. the delphi mentions if enumerator supports idisposable disposed of, .net of course. what wondering is, how , when , enumerator instance freed? for each for-enum statement compiler generates code corresponds pseudocode: enumerator := list.getenumerator; try while enumerator.movenext enumerator.current; enumerator.free; end; the code above generated enumerators implemented class instances. if enumerator implemented interface, last line not call .free merely decrement interface reference count allowing destroyed.

Send over 1000 emails per day via gmail, amazon sns, or own smtp -

i'm trying code mail sender service. built simple desktop application uses shared hosting mail server send html mails. it's not enough , plan switching gmail or amazon sns. for gmail have use min 15 different accounts able send 1500 emails. gmail blocks accounts , have login , change passwords. i've signed amazon sns not looks need. first have subscribe users send emails. emails sent no-reply@sns.amazonaws.com addres. service or can configure wish? i read suggestions lookup mx records destination mail servers how send 1000+ emails per day using asp.net web site i want minimum cost solution. best , there better solution? we use mailjet 3 sites now. used free plan (6000 / month) test set-up , reporting. 3 sites run on it. satisfied - since offer dedicated ip monitoring. according us, it's rather easy install. smtp easy , 1 of sites integrates api. i'd recommend

audio - Can we access podcast in our iPhone application? -

i have iphone application, want call podcast application in itunes in application. can please tell me if feasible, or other solution ? if meant accessing podcasts ipod content, can use mediaplayback framework have user select podcast open avasset normal.

ios - First method of Iphone Application -

which method called first when iphone application executes? i suppose int main(int argc, char *argv[]) in main.m file but practical purposes think need implement of uiapplicationdelegate's methods, depending on situation: application:didfinishlaunchingwithoptions: applicationdidbecomeactive: applicationwillenterforeground:

inserting a bulk list to mysql via php -

i have got text file. there names on every lines. here sample view: . . . oakes oakley obadiah obelix oberon obert obiajulu . . . i wanna insert them mysql using php. created table: create table names ( id int(11) not null auto_increment, name int(11) default null, primary key (id) ) could please kindly suggest me function make job? thanks... $strings = explode("\n", file_get_contents('your.txt')); then loop on $strings generate query.

Applet using JNLP: messages in Java console -

i displaying applet using jnlp. have written necessary files. jars signed. applet loading fine. getting lots of messages in java console contributing delay in applet loading. basic: jnlp2classloader.findclass: pack.xmldropdown$1: try again .. basic: jnlp2classloader.findclass: pack.xmldropdown$2: try again .. basic: jnlp2classloader.findclass: pack.xmldropdown$3: try again .. basic: jnlp2classloader.findclass: pack.xmldropdown$4: try again .. basic: jnlp2classloader.findclass: pack.xmlcomboboxmodel: try again .. basic: jnlp2classloader.findclass: pack.xmltooltipmanager: try .. ...so on. lots of messages in java console. ps. applet working fine. wanted know cause try again messages. try unchecking "enable tracing" in java preferences (advanced -> debugging -> enable tracing). worked me. on mac, there's app set java preferences in utilities folder (applications -> utilities).

How to read hex values from a file using fstream in c++? -

as title says, how read hex values using fstream ? i have code: (let's have "ff" in file.) fstream infile; infile.open(filename, fstream::in|fstream::out|fstream::app); int a; infile >> std::hex; infile >> a; cout << hex << a; but not give me output instead of ff . know there fscanf(fp, "%x", val) curious there way using stream library. update : my code right along, turns out error couldn't read "fff" , put in variable a,b,c this while (infile >> hex >> >> b >> c) { cout << hex << << b << c << "\n"; } can me this? have separate every hex values want read space? because infile >> hex >> setw(1) doesn't work.. you can use hex modifier int n; cin >> hex >> n;

.net - Setting outlook calendar reminders -

is possible use asp.net create calendar reminder in outlook? i using .net 3.5 , have ms outlook 2003. if possible, how can done? it can create calendar reminder in outlook installed on server machine. can't create reminder in outlook of user using application, because runs in sandbox of browser. if want create appointment on server, have here: http://www.codeproject.com/kb/cs/outlookappointments.aspx update: after clarified using exchange server, can use ews managed api create appointment . haven't used myself, can't further.

java - converting streams to blocks of strings and vice-versa -

i have developed java/scala xmpp client app sends data asynchronously using (say) write method , receives data using listener method. listener method receives data discrete xmpp message packets , processes them using processpacket method (which can modify based on want received data) i want hook 3rd party library reads data inputstream , writes outputstream . specifically, want inputstream of 3rd party library emulated using data received via listener method , outputstream emulated write method. what easiest way this? know requires conversion stream chunks of strings , vice-versa. hints appreciated. the xmpp message packet structure follows (though can changed if needed): <message = ... = ...><body>data</body></message> use bytearrayinputstream create input stream given string. have think encoding, because sending bytes instead of characters. string text = message.getbody(); // that's need? inputstream = new bytearrayinputst...

Can SQL 2008 R2 and a SQL express installation coexist on same machine without problems? -

i have sql 2008 r2 on computer , works fine database. if install visual web developer 2010 express says have install sql express , per dependency. prefer install web developer. will express installation effect current installation's operation @ all? yes can coexist installed separate services - see forum post

CakePHP multi-HABTM associations with pagination -

for e-commerce app i'm building using cakephp. have created db , afterwards baked app cake bake . models linked follows: product hasmany categoryproduct,imagesproduct category hasmany categoryproduct categoryproduct belongsto product,category image hasmany imagesproduct imagesproduct belongsto product,image i have tried in various ways obtain paginated view of products dependent of category_id no succes. have managed obtain array wanted $this->categoryproducts->findbycategoryid($id) , can't use built-in paginator cakephp resultant array. could tell me how formulate $options['joins'] array pass on paginate function in order same result, in paginated way? the sql want this: select p . * , i.filename products p left join ( category_products cp, categories c, images_products ip, images ) on ( cp.product_id = p.id , c.id = cp.category_id , c.id =2 , ip.product_id = p.id , ip.image_id = i.id ) this question perplexed me quite sometime. ...

c# - How can I deserialize this json data with JSON.Net? -

i'm not sure how define data property deserialize following json data... { "response": { "total_rows": 39, "data": [ [ "xxxxxxxxxxxxxxxxxbs2vi", "a7ac4aa7-7211-4116-be57-0c36fc2abeee", "aaaaaa", "crn burnley & victoria st", "richmond", "vic", "3121", "555-555-555", null, "real estate & home improvement > storage", null, null, -37.8114511488511, 145.009782837163 ], [ .. ] [ .. ] .... }, status = "ok" } so had .. public class resultdata { public response response { get; set; } public string status { get; set; } } and.... public class response { public int total_rows { get; set; } public ilist<string> data { get; set; } } but throwing exception, saying ...

streaming - How to distinguish "RTP over TCP" from "RTP over HTTP"? -

dear all: wanna ask questions streaming protocol. 1.if video streaming use rtsp video streaming sent add rtp header ,but why video streaming add rtp header via cgi command? 2.i distinguish "rtp on tcp" "rtp on udp",but differences between "rtp on tcp" , "rtp on http" i'm confuse ~ i think you're confusing rtp on http rtsp on http ( , therefore rtp ): see http://developer.apple.com/quicktime/icefloe/dispatch028.html more info.

c# - How to force SQL query return updated data in .NET? -

my c# program connects user request sql database, gets first open request, process , mark request closed. next open request. the problem same request sql query although marked 'closed'. suspect cached result instead of updated data. don't know how clear cache. i tried dispose sqldataadpater , create new 1 every time. tried add random number parameter sql select stored procedure. none of them worked. can please me on issue? thanks. the sql query is: select top(1) requestid, requesttype, requestxml request requeststatus='op' sql update command: begin tran update request set requeststatus=@requeststatus requestid=@requestid; if (@requestxml not null) update request set requestxml=@requestxml requestid=@requestid; commit tran c# code: sqldataadapter da = new sqldataadapter("srvgetopenrequest", cn); da.selectcommand.commandtype = commandtype.storedprocedure; sqlcommand cmd = new sqlcommand("srvupdaterequest", c...

ruby - Need help with require while modifiying a gem (active_merchant) -

i'm trying add new gateway active_merchant gem , i'm having 'require' issues when try run source. (i think problem not active_merchant -specific, more of general ruby environment issue, dont think specific gem in use has it.) this i've done: cloned git repo am, local directory "c:\users\jb\documents\aptana studio 3 workspace\active_merchant" went doing changes in "billing/gateways" directory (this background info..) copied "sample usage" example on am's git repo c:\users\jb\documents\aptana studio 3 workspace\simple_gw_test.rb , starts with: require 'rubygems' require 'active_merchant' ran "ruby simple_gw_test.rb" , got error message: <internal:lib/rubygems/custom_require>:29:in `require': no such file load -- active_merchant (loaderror) <internal:lib/rubygems/custom_require>:29:in 'require' simple_gw_test.rb:3:in '<main>' this understand...

objective c - 'NavController)' has its 'NIB Name' property set to 'VerwaltungsTableView.nib',... manner -

i want build application uitables , detailview. got warning called: 'selected verwaltung nav controller (verwaltung)' has 'nib name' property set 'verwaltungstableview.nib', view controller not intended have view set in manner. but think have objects in right manner. here , here can see errors , interfacebuilder. what causes warning? navigation controllers meant organise other view controllers. aren't supposed lay them out yourself. you're supposed create other view controllers, assign 1 of them navigation controller's root view controller, write code let user navigate other view controllers there. if you're trying table view controller nib show up, should assigning table view controller navigation controller's rootviewcontroller property.

Entity Framework - How to get filtered Master records along with filtered Detail records? -

my class relationship: classmaster 1----* classsessions goal: return classmasters have classsessions startdatetime greater current date, along these classsessions (filtered date). in t-sql i'd this: select * classsession join classmaster on classmaster.classid = classsession.classid classsession.startdatetime > getdate() i need realize same results in entity framework 4 query. thought work, not: var classes = ctx.classsessions .include("classmasters") .where(s => s.startdatetime > datetime.now) .select(s => s.classmaster) .tolist(); this give's me classmasters have classsession startdatetime > current date, classsessions property comes filled all classsessions, including older current date. want classsessions startdatetime > current date. what doing wrong? thank much! var masters = ctx.classmasters .where(cm => cm.classsessions.any...

dns - Amazon S3: Static Web Sites: Custom Domain or Subdomain -

amazon.com announced 1 can host static web sites in s3 bucket. went setup page @ http://docs.amazonwebservices.com/amazons3/latest/dev/index.html?websitehosting.html , created bucket static web site, , worked fine. have url of form http://[my bucket name].s3-website-us-east-1.amazonaws.com/. however, point subdomain own (e.g. static.mydomain.com) static web site @ amazon s3. has figured out how that? i appreciate can give me. it turns out make work, cannot map arbitrary subdomain arbitrary bucket. the qualified subdomain name must same s3 bucket name . suppose name of site static.mydomain.com . need create s3 bucket same name, named static.mydomain.com . once configure bucket s3 static web site, have url assigned looks http://static.mydomain.com.s3-website-us-east-1.amazonaws.com . go domain host , map subdomain url step 2. in enom.com, meant mapping host " static " address " static.mydomain.com.s3-website-us-east-1.amazonaws.com " cname rec...

asp.net mvc - .NET MVC: How to redirect response within a helper method -

i have code common number of controller actions pulled out private "helper" method consolidation. method expected "get" object me, though performs sanity/security checks , potentially redirect user other actions. private thingy getthingy(int id) { var thingy = some_call_to_service_layer(id); if( null == thingy ) response.redirect( anotheractionurl ); // ... many more checks, more complex null check return thingy; } public actionresult actionone(int id) { var thingy = getthingy(id); // more stuff return view(); } // ... n more actions public actionresult actionm(int id) { var thingy = getthingy(id); // more stuff return view(); } this functions exception elmah notifies me of exception: system.web.httpexception: cannot redirect after http headers have been sent. so, question is: there more correct way trying do? essentially, want cause current action stop processing , instead return redirecttorouteresul...

c# - How to add design-time support for Enabled property in Winforms -

i've created winforms usercontrol (visual studio 2008, 3.5 framework sp1). i've been able create of own public properties visual studio able handle (i.e. form designer reacts changing property values). i set enabled property checkbox control according enabled property of usercontrol. under usercontrol1.cs: `chkmycheckbox.enabled = enabled` i have tried putting both under enabledchanged event of usercontrol , overriding onenabledchanged method, neither seems catch. not toolbox caching issue (b/c can see other code changes taking effect). thanks in advance, -alan. the way control rendered @ design-time designers of control. core win32 controls not render disabled when in designer.

extending an image with Python Imaging Library -

i trying increase height of image using pil don't want image resized; want strip of blank pixels @ bottom of image. way of doing pil? guess 1 way make new image of required size , copy old image can't seem find right function this. oops, realized can image.crop() , resize image you.

IE problem with jQuery Cycle: slight displacement in pictures during transition -

my problem easier see explain: you can see during transition, there's small movement of pictures, looks bad. in firefox doen't happen. here's html code (there's php cakephp, whichs writes specified parameters, using regular html instead problem remains same): -- before reading code, save time, might want read below explanations of i've figured out that's causing problem -- <div id="home_title"> <h1>title</h1> <h3>text line</h3> <h3>text line</h3> <h3>text line</h3> <h3>text line</h3> <h3>text line</h3> <h3>text line</h3> </div> <div id="home_slideshow"> <div id="slideshow_container"> <div id="slideshow_frame"> <div id="slides_home"> <div class="slide"><?php echo $this->html->image('/gallery_pics/00294.jpg', a...

How to remove namespace prefix before an element using XSLT -

i have xml given below. ideally want remove namespace prefix before checkresponse tag. should <checkresponse> instead of <def:checkresponse> <?xml version="1.0" encoding="utf-8"?> <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://www.test.com/defaultnamespace/"> <soapenv:header/> <soapenv:body> <def:checkresponse> <checkresponseheader> <checkresponsenumber> <checkbuyerordernumber>450982323438</checkbuyerordernumber> </checkresponsenumber> </checkresponseheader> <checkresponsesummary>this response</checkresponsesummary> </def:checkresponse> </soapenv:body> </soapenv:envelope> regards, ravi kumar a

audio - How to find the fundamental frequency of a guitar string sound? -

Image
i want build guitar tuner app iphone. goal find fundamental frequency of sound generated guitar string. have used bits of code auriotouch sample provided apple calculate frequency spectrum , find frequency highest amplitude . works fine pure sounds (the ones have 1 frequency) sounds guitar string produces wrong results. have read because of overtones generate guitar string might have higher amplitudes fundamental one. how can find fundamental frequency works guitar strings? there open-source library in c/c++/obj-c sound analyzing (or signal processing)? you can use signal's autocorrelation, inverse transform of magnitude squared of dft. if you're sampling @ 44100 samples/s, 82.4 hz fundamental 535 samples, whereas 1479.98 hz 30 samples. peak positive lag in range (e.g. 28 560). make sure window @ least 2 periods of longest fundamental, 1070 samples here. next power of 2 that's 2048-sample buffer. better frequency resolution , less biased estimate, use longer bu...