Posts

Showing posts from June, 2011

jquery - Javascript is not rendering in my SPA -

i have following written in home.js file: define(['services/logger'], function (logger) { var vm = { activate: activate, title: 'home view' }; return vm; //#region internal methods function activate() { logger.log('home view activated', null, 'home', true); return true; } //#endregion var editor, html = ''; function createeditor() { if (editor) return; // create new editor inside <div id="editor">, setting value html var config = {}; editor = ckeditor.appendto('editor', config, html); } function removeeditor() { if (!editor) return; // retrieve editor contents. in ajax application, data // sent server or used in other way. document.getelementbyid('editorcontents').innerhtml = html = editor.getdata(); document.getelementbyid('contents').style.display = ''; // destroy editor. editor.destroy(); edi

excel vba - Concatenate multiple ranges using vba -

i hoping can me problem. basically, have number of ranges need concatenate independently , put values of concatenated ranges different cells. example want to: concatenate values in range a1:a10 , put result in f1 want concatenate range b1:b10 , put result in f2 want concatenate range c1:c10 , put result in f3 etc i have tried use following macro. stuck; macro seems doing concatenating range a1:a10 , putting results f1 (which want). stores information first concatenation memory when next concatenation, in cell f2 concatenated results of f1 , f2 joined. i have tried searching lots of forums, since code made myself can't find solution, sure common problem , doing wrong possibly not setting variable correctly. thanks in advance help, sub concatenate() dim x string dim y string m = 2 5 y = worksheets("variables").cells(m, 5).value 'above has range information e.g. a1:a10 in sheet variables each cell in range("" & y & "&

c - EXPORT_SYMBOL in header causes "exported twice" errors -

i have header file declaration of several global variables in following format: constants.h #ifndef constants_h #define constants_h extern unsigned var; export_symbol(var); #endif constants.c #include "constants.h" unsigned var = 10; foo.c #include "constants.h" when try compile kernel module, following error each respective exported symbol: warning: /home/vilhelm/proj/constants: 'var' exported twice. previous export in /home/vilhelm/proj/foo.ko i suspect symbols being exported every time include constants.h header file, don't understand why. shouldn't include guard in constants.h prevent export_symbol(var) being read multiple times? shouldn't include guard in constants.h prevent export_symbol(var) being read multiple times? the include guard prevents header being included more once in same source file. can't prevent being included via multiple source files. remember objects sources linked single

html - How can I get height: 100% to account for existing pixel-heighted elements within the same div? -

i have container defined height containing 2 divs, first has pixel-defined height , second fill remaining space of container, i.e. 100% minus first div's pixel-defined height. is there solution problem doesn't involve javascript? can use javascript solution (and in fact javascript changing container's height brought me here), seems should have lower-level support, , looks might become quite cascading problem. example http://jsfiddle.net/h3gsz/1/ html <div id="container"> <div id="top_content"></div> <div id="remaining_content"></div> </div> css #container { width: 400px; height: 400px; border: 5px solid black; } #top_content { background-color: blue; width: 100%; height: 50px; } #remaining_content { background-color: red; width: 100%; height: 100%; } edit an answer provided original fiddle, in simplifying question allowed answer introduce new p

c - How to properly set up serial communication on Linux -

i'm attempting read , write data , fpga board. board came driver create terminal device called ttyusb0 whenever board plugged in. on fpga, asynchronous receiver , transmitter implemented, , seem work. however, there seems issue on c side of things. i've been using test vectors test if fpga outputting proper information. i've noticed few things things: the device not open correctly the terminal attributes fail retrieved or set. the read non-blocking , doesn't retrieve proper value. below how set terminal , file descriptor options. of taken here: http://slackware.osuosl.org/slackware-3.3/docs/mini/serial-port-programming any advice or comments why program may failing helpful. #include <stdio.h> // standard input/output definitions #include <string.h> // string function definitions #include <unistd.h> // unix standard function definitions #include <fcntl.h> // file control definitions #include <errno.h> // error numbe

forms - how to save to a local server and email a php webform as a pdf -

i work company uses large amount of web forms on our intranet (based on apache server) i need way able generate pdf these web forms, save file on our server, , send copy specified email addresses. php forms put html email template , sent when submit button pressed. the saved forms need have individual file name (eg storename.date.formname.submittedby.pfd) can keep record of important ones. im still noob programming, might need simple answers. thanks! your question not 100% clear. email forms html. assume mean data user has entered. have wkhtmltopdf great , easy user html pdf converter. maybe helps getting started.

verilog - Trouble with VGA Controller on CPLD -

Image
what attempting create vga controller lattice machxo cpld in verilog. the problem i attempting display color red resolution of 640x480 @ 60hz using 25.175 mhz clock internal cpld; however, when plug cpld monitor "out of range" message; no monitor try can understand resolution like. what i've tried i have simulated code in modelsim (pictures included), , appears save 1 issue. when count amount of time steps have occurred during v-sync display zone (when h-sync drawing) , divided frequency of h-sync, 479 pulses -- 1 short of 480 lines should drawing. don't understand coming i've check timings many times, , suspect may symptom of problem, i'm not sure. the numbers i'm using generate numbers timings tiny vga: tinyvga.com/vga-timing/640x480@60hz below code, , pictures of timings modelsim, thanks. module top(reset, h_sync, v_sync, red); input wire reset; output wire h_sync; output wire v_sync; output wire red; wire rgb_e

how to trace emacs menu? -

is there way see emacs doing when choose action menu? example i'd see lisp commands executed when click on tools --> spell checking --> automatic spell checking this useful learning include init file enable automatic spell check default. thanks. menus implemented keymaps, , describe-key handles mouse events in general, can use: c-h k (select menu item) in instance see: <menu-bar> <tools> <spell> <flyspell-mode> runs command flyspell-mode, interactive autoloaded lisp function in `flyspell.el'. bound <menu-bar> <tools> <spell> <flyspell-mode>. (flyspell-mode &optional arg) toggle on-the-fly spell checking (flyspell mode). [...] actually tracing lisp calls different question ( trace-function , built-in elp profiling library, debug-on-entry , 2 debuggers in general useful tools), in case clicking menu item calls function interactively, there's nothing trace :)

algorithm - Are bit-wise operations common and useful in real-life programming? -

i bump interview questions involving sorted/unsorted array , ask find sort of property of array. example finding number appears odd number of times in array , or find missing number in unsorted array of size 1 million . question post additional constraints such o(n) runtime complexity, or o(1) space complexity. both of these problems can solved pretty efficiently using bit-wise manipulations. of course these not all, there's whole ton of questions these. to me bit-wise programming seems more hack or intuition based, because works in binary not decimals. being college student not real life programming experience @ all, i'm curious if questions of type popular @ in real work, or brain twisters interviewers use select smartest candidate. if indeed useful, in kind of scenarios applicable? are bit-wise operations common , useful in real-life programming? the commonality or applicability depends on problem in hand. some real-life projects benefit bit-wise ope

c++ - How to call on a function found on another file? -

i'm starting pick c++ , sfml library, , wondering if defined sprite on file appropriately called "player.cpp" how call on main loop located @ "main.cpp"? here code (be aware sfml 2.0, not 1.6!). main.cpp #include "stdafx.h" #include <sfml/graphics.hpp> #include "player.cpp" int main() { sf::renderwindow window(sf::videomode(800, 600), "skylords - alpha v1"); while (window.isopen()) { sf::event event; while (window.pollevent(event)) { if (event.type == sf::event::closed) window.close(); } window.clear(); window.draw(); window.display(); } return 0; } player.cpp #include "stdafx.h" #include <sfml/graphics.hpp> int playersprite(){ sf::texture texture; if(!texture.loadfromfile("player.png")){ return 1; } sf::sprite sprite; sprite.settexture(texture); re

ios - Size of a ViewController Containers UIView -

i have viewcontroller container 400 high on iphone5. when use on iphone4 squashes view everything. in case want view appear same size on phones. vc.h @property (strong, nonatomic) iboutlet uiview *viewforcontainer; vc.m @synthesize viewforcontainer - (void)viewdidload { [super viewdidload]; cgrect rect = [viewforcontainer frame]; rect.size.height = 400; [viewforcontainer setframe:rect]; } why can't force height this? .. going have make new storyboard it? short answer: select view , choose editor > pin > height. rid of unnecessary bottom constraint. long answer: you should stop you're doing , understand you're doing - in particular, autolayout. it's everywhere, default, whether or not, 1 may know it.

Chrome API responseHeaders -

based on documentation: https://developer.chrome.com/extensions/webrequest.html#event-onheadersreceived i tried display response via console like: console.log(info.responseheaders); but returning undefined . but works though: console.log("type: " + info.type); please help, need responseheaders data. you have request response headers this: chrome.webrequest.onheadersreceived.addlistener(function(details){ console.log(details.responseheaders); }, {urls: ["http://*/*"]},["responseheaders"]); an example of use. 1 instance of how use webrequest api in extension. (only showing partial incomplete code) i need indirectly access server data , making use of 302 redirect page. send head request desired url this: $.ajax({ url: url, type: "head" success: function(data,status,jqxhr){ //if not head request, `data` contain response //but in case need headers `data` empty compareposts(jqxhr.getresponsehead

c++ - Convert Boost Ptime To EST UTC-5:00 -

i using following code current date time (mountain time) const boost::posix_time::ptime = boost::posix_time::second_clock::local_time(); //in mountain time = 2013-apr-08 20:44:22 now using following method conversion ptime feedconnector::mountainttoeasternconversion(ptime colotime) { return boost::date_time::local_adjustor <ptime, -5, us_dst>::utc_to_local(colotime); } //this function suppose give me time in newyork (east standard time) , getting 2013-apr-08 16:44:22 thsi time wrong suggestion going wrong ? as far understand wrong time means has 1 hour difference expected, i.e. -4 hours instead of expected -5 hours. if yes, problem us_std type pointed last parameter of local_adjustor declaration. if specify no_dst instead of use_dst . code works expatiated , difference -5 hours. following code demonstrates ( link online compiled version ) #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/local_time

java - NumberFormatException: Invalid long: "588657600000-0400" -

-588657600000-0400 getting response this. not able convert date format invalid long. new date(long.parselong("/date(-588657600000-0400)/")); is there anyway, can construct new date object when response string in such formats. question related 1 asked earlier. java.lang.long.parselong exception the exception thrown here "04-09 01:39:25.793: e/androidruntime(8011): java.lang.numberformatexception: invalid long: "588657600000-0400" i tried @ calendar class, http://docs.oracle.com/javase/6/docs/api/java/util/calendar.html not find method me date object without passing long. what split input string in 2 values ? date foo2 = new date(long.parselong("-588657600000") + long.parselong("-0400")); btw, date : mon may 07 16:59:59 brt 1951 hehehe edit : this dont check input values, , assume allways have minus import java.util.date; public class mimimi { public static void main(string[] args) { string inp

loops - Wordpress pagination showing same content on page 2 -

i can’t link site i’m working on because it’s running locally right now. i’m trying use pagination on home page happens it’s displaying link page 2 , page 3 it’s not showing different content when click links. i’m using bootstrap framework (no plugin). want try pagination without using plugin. i have query running on home page pulls in latest 3 posts first 3 columns (1,2,3). i have additional query running on home page pulls in next 3 posts 3 columns beneath first 3 (4,5,6). when pagination displays, click on numbers , url changes in address bar content remains same. there way can use pagination continue display 3 columns on top , 3 columns on bottom? please help, thanks! in functions.php have: function bootstrap_pagination($pages = '', $range = 2) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages)

java - Iterate through TreeMap - Return a set of all values of the keys of the map -

i have database maps course names student id numbers. need iterate through map create set contains students in database. code have far. appreciated!! //return set of students in school public set<integer> allstudents() { set<map.entry<string,set<integer>>> entries = database.entryset(); set<integer> students = new treeset<integer>(); (map.entry<string,set<integer>> pair: entries){ students.add(); } return students; } // end allstudents you do: for (map.entry<string, set<integer>> pair : entries) { students.addall(pair.getvalue()); }

java - Use of || operator for alternative assignment -

in javascript, may define: num = numerator || 0; denom = denominator || 1; yet, in java, cannot applied. without using conditionals (explicitly written), there concise way achieve "if undefined, assign this"? maybe enough. num = numerator != null ? numerator : 0; denom = denominator != null ? denominator : 1;

ARM GCC Compiling errors (Windows 7) -

here entered command , spits out: unfortunately, google has not been of help, have tried several things (from extremely beginner knowledge) , have not been able solve it. c:\users\z\workspace\test\src>gcc main.c c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none -eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit': exit.c:(.text.exit+0x2c): undefined reference `_exit' c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none -eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): in function `_sbrk_r': sbrkr.c:(.text._sbrk_r+0x18): undefined reference `_sbrk' c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none -eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-writer.o): in function `_write_r': writer.c:(.text._write_r+0x20): undefined reference `_write' c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/ar

jsp - sendRedirect not working in liferay 6.1 CE installed on windows server -

i new liferay. using liferay 6.1 ce. have requirement navigate first.jsp page second.jsp page. in first.jsp page, there <form> , values of form's input fields should passed on second.jsp . having processaction first.jsp , on submitting parameters, here action method: public void saveproject(actionrequest actionrequest, actionresponse actionresponse) throws ioexception, portletexception { system.out.println("saving data"); string prjtitle = paramutil.getstring(actionrequest, "title"); portleturl redirecturl = null; string redirectjsp = "/html/abc/second.jsp"; string portletname = (string)actionrequest.getattribute(webkeys.portlet_id); themedisplay themedisplay = (themedisplay)actionrequest.getattribute (webkeys.theme_display); redirecturl = portleturlfactoryutil.create(portalutil.gethttpservletrequest (actionrequest),portletname, themedisplay.getlayout().getplid(), portletrequest.render_phase);

ios - AVFoundation - What was minFrameDuration superseded by? -

i'm walking through part of avfoundation tutorial , 1 of sample parts of code uses avcapturevideodataoutput method "minframeduration". when put own code warning saying it's been depreciated. upon searching "minframeduration", find a documentation page informs me "minframeduration" has been depreciated, superseded, , no longer supported, of course doesn't tell me superseded by. can tell me it's been superseded with? thank much. that avcaptureconnection's videominframeduration. few links refer to avfoundation release notes ios 5 this question on so

java - getting stacktrace with context to thread -

i trying current stack-trace of thread in java. have explored following methods: one of easiest way of printing stack trace of current thread in java using dumpstack() method java.lang.thread class another way printing stack trace using printstacktrace() method of throwable class is there other approach can current stack trace of thread in java more efficient? below class have designed.. public class stacktraceexample { private static final logger logger = logger.getlogger(stringreplace.class.getname()); public static void main(string args[]) { //calling method print stack trace further down first(); } public static void first() { second(); } private static void second() { third(); } private static void third() { //if want print stack trace on console use dumpstack() method system.err.println("stack trace of current thread using dumpstack() method"); thread.currentthread().dumpstack(); //this way print stack trace current method

javascript - how to share url + parameter using addthis social plugin? -

Image
how share url + parameter using addthis social plugin? had read addthis api, can not find whey add parameters. http://support.addthis.com/customer/portal/articles/381263-addthis-client-api <!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>hello world</title> </head> <body> <!-- addthis button begin --> <div class="addthis_toolbox addthis_default_style "> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_compact"></a> <a class="addthis_counter addthis_bubble_style"></a> </div> <script type="text/javascript"> var addthis_config = { // want share link url + my_defined_paramater, how set? url: location.href+'refer_id=1900' //not correct }; </script> <script type="text/javascrip

java - List all subpackages of a package -

Image
i looking way list subpackages of arbitrary package in java. something this: package basepackage = getpackage("com.mypackage"); for(package subpackage : basepackage.getsubpackages()){ system.out.println(subpackage.getname()); } is there way it? in advance. how ide(let's netbeans) it? update: i trying find mappers package mybatis. in project, mappers packages has name "*.mappers". example: "a.b.mappers" or "a.b.c.mappers". thing know base package, , not sure how many mappers packages under it. update: here code trying use reflection library it: private set<string> getpackagesnames() { reflections reflections = new reflections("com.mypackage"); set<class<? extends object>> allclasses = reflections.getsubtypesof(object.class); set<string> packagenames = new hashset<>(); for( iterator<class<? extends object>> = allclasses.iterator(); it.hasnext(); ) {

translate animation - How to give the x y position to image control at runtime in windows phone 7? -

i have set canvas in background , adding image pieces child of background canvas, want move specific image control given x y position of background canvas have tried kind of code given below bg_canvas.children[it].rendertransform = new translatetransform(); translatetransform trans = bg_canvas.children[it].rendertransform translatetransform; doubleanimation animation = new doubleanimation(); animation.to = 80; storyboard.settarget(animation, trans); storyboard.settargetproperty(animation, new propertypath(translatetransform.xproperty)); storyboard story = new storyboard(); story.children.add(animation); story.begin(); it's working problem moving image control not placed @ correct x position of background canvas , it's been taking x position image placed, 0th x position starts image control placed on canvas need set x position of background canvas image control placed.

javascript - How to keep a variables value outside of the function? -

i have following 2 functions take input drop down menu using onchange <script> current_fin = "none"; current_mat = "pine"; // pass current selection variable use. function getmaterial() { var mat = document.getelementbyid("dropdownone"); var current_mat = mat.options[mat.selectedindex].text; $("#price").html("material is: " + current_mat + "<br/>" +"finish is: " + current_fin); } function getfinish() { var fin = document.getelementbyid("dropdowntwo"); var current_fin = fin.options[fin.selectedindex].text; $("#price").html("material is: " + current_mat + "<br/>" +"finish is: " + current_fin); } </script> all write value of selected div #price. problem arises when change 1 , other. if switch between 2 boxes variables revert default value none , pine. want them retain value outside of function, if switch box 1 oa

visual studio 2012 - WiX msi custom action not running on limited privileges on Windows 7 -

have been trying create wix installer latest project. have strange issue if run msi via cmd prompt admin works fine, custom actions kick off without fuss , works fine, if double click msi custom actions don't work , installer fails. i'm using visual studio 2012 , using windows 7. <!--custom actions--> <binary id='customshortcut' sourcefile='$(var.customdir)\testinstallercustom.ca.dll'/> <binary id='customdir' sourcefile='$(var.customdir)\testinstallercustom.ca.dll'/> <binary id='removedir' sourcefile='$(var.customdir)\testinstallercustom.ca.dll'/> <customaction id='customshortcutid' binarykey='customshortcut' dllentry='customshortcut' execute='immediate' impersonate='no' return='check' /> <customaction id='customdirid' binarykey='customdir' dllentry='customdir' execute='immediate' impe

.net - nHibernate Envers MOD -

i new nhibernate envers, tracking entity changes @ property level, creates columns properties names suffix of _mod default, there option of changing suffix. http://envers.bitbucket.org/#envers-envers-tracking-properties-changes-queries but, need columns names these mod flags based on columnname_mod instead of propertyname_mod. where can change configuration. clues helpful. thanks, su you can't today. the reason works way consistency - "mod columns" doesn't have "mapped" 1 single database columns property. eg components, user types multiple columns , forth, use 1 mod column though audited data (can be) represented multiple columns. if want to, can report issue here https://nhibernate.jira.com/browse/nhe

asp.net mvc - call controller action from signalR -

is there way call mvc controller action signalr hub? noticed when doing controller context null. there way it? or maybe solution. thanks according understanding of signalr. should have must implemented "hub" abstract class. in controller should have must implemented "controller" abstract class. suppose have call action of our controller signalr hub controller must implemented hub abstract class. more 1 abstract class cannot implement in 1 class. hence not possible call action of controller signalr hub. but can try follow: create 1 class have implemented "hub" abstract class create instance of controller using mock in class , call action implemented "hub" class. please correct me if wrong.

How to run more than one query at a time in SQL Server -

i have generate big report consists of 45 insert statements. how can run more 1 insert statement @ time splitting queries groups. use stored procedure , using u can return value also.

actionscript 3 - AS3 Facebook API: Access Token Error Message -

i working on actionscript air mobile project in flashdevelop using facebookmobile api , sort users' friends lists. i'm using facebookmobile.batchrequest() information want , works fine. working code: var installedbatch:batch = new batch(); installedbatch.add("me/friends?fields=installed,name", handlefriendslist); facebookmobile.batchrequest(installedbatch); the resulting json object passed handlefriendslist() contains list of user's friends. each friend contains id , name field. friends have app installed contain installed field set "true". condense down 1 line using facebookmobile.api(), when try , error. attempted code: facebookmobile.api("me/friends?fields=installed,name", handlefriendslist); this should result in same json object being passed handlefriendslist(), instead error complaining don't have active access token. error: message = "an active access token must used query information current user." t

How to get data from MySql using javascript in leaflet -

i have tables in mqsql database. have fetch data mysql table using javascript & show in map of leaflet. can any 1 tell me how can fetch data mqsql using javascript ? calling mysql database directly client not option, you'll need sort of server side api. if insist on using javascript (on server), node.js valuable option.

c# - List expander in property grid , with genric ICustomTypeDescriptor -

i have generic class ( parameters.cs ) implements interface: icustomtypedescriptor . i use generic class several different classes, 1 of this: private parameters<class1> _class1parameters; public parameters<class1> class1parameters { { return _class1parameters; } set { _class1parameters= value; } } class1.cs: public class class1 { private list<position> _pos = new list<position>(); public list<position> pos { { return _pos ; } set { _pos = value; } } //other variables } position class: public class position { public string name { get; set; } public double position { get; set; } } right list displayed 3 points in propertygrid ("..."). i want displayed expander ("+"), how can through icustomtypedescriptor ? edit: i tried putting [typeconverter(typeof(expandableobjectconverter))] on pos list, did not help. finally manage

javascript - how to Resize child list box height in asp.net User control -

given following user control markup: <%@ control language="c#" autoeventwireup="true" codefile="searchitem.ascx.cs" inherits="myweb.controls.searchitem" %> <div id="container" runat="server" style="height: 100%; width: 100%;"> <div> <asp:label id="lblsearch" runat="server" text="search:"></asp:label> <br /> <asp:textbox id="txtsearch" runat="server"></asp:textbox> <input id="btnsearch" type="button" value="search" onclick="searchclick(this)" /> </div> <div> <asp:label id="lblitems" runat="server" text="available items:"></asp:label> </div> <div id="itemcontents" runat="server" style="min-height: 50%; width: 100%;border: 1px solid black;"&

sql server - how to convert the below subquery into joins using one update statement -

below complete query have , ultimate aim update claim table. should 1 statement without subquery, joins allowed because going run in appliance won't support subquery: declare @decwdrwn table(ctryid smallint, cmid int, decwdrwndt int); s ( select ctryid,cmid,dt, isnull(( select max(cmhistdttmid) claimhistory l st = 3 , l.ctryid = c.ctryid , l.cmid = c.cmid) , 0) maxdec, isnull(( select max(cmhistdttmid) claimhistory l st = 7 , l.ctryid = c.ctryid , l.cmid = c.cmid) , 0) maxset claimhistory c st =3 ) insert @decwdrwn select ctryid, cmid, max(dt) decdt s maxset > maxdec group ctryid,cmid your response appreciated... update claims set cmdclnwdwndt = ( select decwdrwndt @decwdrwn

java - Why will my JButton not update the imageicon? -

currently i'm trying make video poker. far consists of 2 classes: card int value, char suit, , boolean checked. card jbutton. deck stack of card objects. the jbutton in videopoker class won't update imageicon when draw card , , can't figure out why life of me. updates when want background image , again when want original image, why not new card? below code import javax.swing.*; import java.awt.event.*; public class videopoker extends jpanel implements actionlistener { private deck deck; private card[] cards; private jbutton draw; private final int maxcards = 5; public videopoker() { deck = new deck(); cards = new card[maxcards]; for(int = 0; < maxcards; i++) { cards[i] = deck.draw(); cards[i].addactionlistener(this); add(cards[i]); cards[i].seticon(new imageicon ("cards/" + cards[i].getvalue() + cards[i

jquery - search via fnServerData in datatables plugin issue -

i want pass data server page search with,i echo/print query on server file not concatenate if provide more 1 parameters.it shows last provided param in where.here code "fnserverdata": function ( ssource, aodata, fncallback ) { /* add data sender */ aodata.push( { "name": "type", "value": $('#type_dummy').val() }, { "name": "category_id", "value": $('#category_id').val() }, { "name": "region_id", "value": $('#region_id').val() } ); $.getjson( ssource, aodata, function (json) { /* whatever additional processing want on callback, tell datatables */ fncallback(json) } );

Python super() inheritance and needed arguments -

considering: class parent(object): def altered(self): print "parent altered()" class child(parent): def altered(self): print "child, before parent altered()" super(child, self).altered() # arguments needed? why child , self? print "child, after parent altered()" in python 2.7, why must child passed argument super() call? exact intricacies of using super instead of letting work. super figures out next class in method resolution order. 2 arguments pass in lets figure out - self gives entire mro via attribute; current class tells along mro right now . super doing basically: def super(cls, inst): mro = inst.__class__.mro() # derived class return mro[mro.index(cls) + 1] the reason current class rather base class because entire point of having super have function works out base class rather having refer explicitly - can cause problems if base class' name changes, if don't kno

javascript - Meteor.js Collection not being created in mongo -

server side code: if (meteor.isclient) { meteor.subscribe("messages"); template.hello.greeting = function () { messages = new meteor.collection("messages"); stuff = new meteor.collection("stuff"); return "welcome feelings."; }; template.hello.events({ 'click input' : function () { // template data, if any, available in 'this' if (typeof console !== 'undefined') var response = messages.insert({text: "hello, world!"}); var messages = messages.find console.log("you pressed button", response, messages, stuff); } }); } if (meteor.isserver) { meteor.startup(function () { // code run on server @ startup messages = new meteor.collection("messages"); messages.insert({'text' : 'bla bla bla'}); }); } client side code <head> <title>test</title> </head> <body> {{&

Android ActionBar has border when using Nine-Patch background -

Image
i'm using nine-patch png windowbackground android app. however, 1px border around actionbar. doesn't happen when use simple png. to test this, i've created basic app using wizard: android:minsdkversion="10" android:targetsdkversion="17" tested on galaxy nexus v.4.2.2 interestingly enough, xml layout preview in eclipse showing same border. /res/values/styles.xml <resources> <!-- base application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="appbasetheme" parent="android:theme.light"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="apptheme" par

Data out of cfit of sfit Matlab object -

is there way extract data out of cfit or sfit object? want extract matrix of fitted values out of sfit object without accessing every element of fit (very slow in 240x320 ). problem equivalent extraction of vector out of cfit object. there method defined on object, or similar? please, post code! thanks, nikola you can access element of sfit object sfit.element. example: sf = fit([x,y],z,'poly23'); sf linear model poly23: sf(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y + p12*x*y^2 + p03*y^3 coefficients (with 95% confidence bounds): p00 = 1.118 (0.9149, 1.321) p10 = -0.0002941 (-0.000502, -8.623e-05) p01 = 1.533 (0.7032, 2.364) p20 = -1.966e-08 (-7.084e-08, 3.152e-08) p11 = 0.0003427 (-0.0001009, 0.0007863) p02 = -6.951 (-8.421, -5.481) p21 = 9.563e-08 (6.276e-09, 1.85e-07) p12 = -0.0004401 (-0.0007082, -0.0001721)

sql - Proper pagination in a JOIN select -

i have sql statement select * users u left join files f on u.id = f.user_id f.mime_type = 'jpg' order u.join_date desc limit 10 offset 10 the relationship 1-n: user may have many files. this selects second 10-element page. the problem query limits/offsets joined table, want limit/offset distinct rows first ( users ) table. how to? target postgresql , hsqldb you need limit select on outer table first , join dependent table result. select * (select * users limit 10 offset 10) u left join files f on u.id = f.user_id

Python 32-bit development on 64-bit Windows -

is possible install 32-bit python (2.7 series) on windows 7/8 64-bit develop 32-bit applications? i'm sure answer yes confirmation. you can install 32 bit software on 64 bit windows because has built-in 32 bit emulator. if going use 32 bit python, make sure libraries use 32 bit too.

Java complains about final field not initialized in default case of a switch -

i want initialize final field in different ways. therefore have created enumeration type , perform switch on it. public enum type { a, b, } i have added default case switch assertion warn fellow programmers in case add new enumeration constant , forget update switch. default: assert false : "missing type detected"; java detects flaw in argument , complains blank field may not have been initialized. how should deal situation? public class switchexample { public enum type { a, b, } private final int foo; public switchexample(type t) { switch (t) { case a: foo = 11; break; case b: foo = 22; break; default: assert false : "missing type detected"; } // blank final field foo may not have been initialized } } instead of assert false : "missing type det

ruby - Installing Compass & Susy on Ubuntu 12.04 -

i'm trying install compass , susy on ubuntu 12.04. what have tried following steps on console: sudo apt-get install rubygems1.8 sudo gem install rubygems-update # instead of sudo gem update --system sudo update_rubygems sudo gem install compass # installing compass & sass sudo gem install susy so gems installed , listed when following command: gem list but now, when try create new compass project with compass create project i following error: /usr/local/bin/compass: /usr/bin/ruby1.9.1: bad interpreter: no such file or directory my current ruby version 1.8.7. installed ruby 1.9.1 , working. console still says current ruby version 1.8.7 my question: have run both ruby versions working? there way under ubuntu? it's working, know, it's bit confusing. using ubuntu's package manager multiple ruby versions bit of lost cause. most people use rvm , allows install , switch between multiple rubies easily. other popular options rbenv , chr

wcf - Is portable class libraries are beneficial for window 8 store apps -

is portable class libraries beneficial window 8 store apps. trying create architecture window 8 app in have wcf restful service data. problem don't want create proxy classes each entity in window 8 project, want use datalayer in have entities , business logic's, data layer has reference in wcf service return me xml/json result. need consume service in window 8 app need map data proxy classes don't want create. so problem can refer datalayer window 8 app project, @ time found impossible window 8 app project doesn't support system.data. or, can 1 tell me pattern should use achieve goal. does portable class libraries me out of ? portable class libraries used solve problem of sharing backend code (business logic/data layer) between multiple frontend client apps (windows 7, windows 8, silverlight, windows phone, , xbox 360). if writing both windows 8 app , else (say windows phone app), put backend logic in portable class library, , build assembly referen

c# - RegEx Get Error Message -

i new @ regex , wondering if there way display error messages user such he/she did wrong using regex. there hypotetical regex.geterromessage thing? user enters string , match regex pattern, if there no match show error. let have such expression ^[0-9]{0,8}$ . far understood expression telling match on digits number length less or equal 8. problem user have entered letter or he/she entered more 8 digits. can error message somehow regex or have write own each case? if want message user-friendly, have write own message every regex check. even if regex point specific character in input, message spooky, incorrect character @ position 7 expression ^[0-9]{0,8}$ a better option use masked input in ui, user cannot enter anything, digits.

core data - coredata- relationship failing to behave properly -

Image
this structure of coredata architecture. after adding entries 'artists', using them newly added 'album' entries working perfect. but problem shown in img- 2 & 3, after assigning 'michael jackson' 'insomniac 2010' album & adding same artist 'baby ft ludacris' losing reference album 'insomniac'. this code save context in albumdetailviewcontroller.h - (void)entityrecordstableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath forentity:(id)entity { artist *selectedartist = entity; uitableviewcell * cell = [tableview cellforrowatindexpath:indexpath]; [cell setselected:no animated:yes]; if ([self.pickedartists containsobject:selectedartist]) { [self.pickedartists removeobject:selectedartist]; [cell setaccessorytype:uitableviewcellaccessorynone]; editingalbum.artist = self.pickedartists; [self savethecontext:editingalbum.managedobjectcontext]; //

sql - CTE loop in loop -

this question exact duplicate of: cte looping query 1 answer situation: got 2 tables. 1 there 2 fields startdate & enddate. , 1 table there 1 field date. when got 3 days between start- , enddate. must insert 3 rows in new table. i have next code , insert perfect line in table availability. with view_solidnet_training ( select cast('2013-04-09' datetime) datevalue union select datevalue + 1 view_solidnet_training datevalue + 1 <= cast('2013-04-11' datetime) ) insert obj_availability select 34, datevalue, 'am', 2, 'test' view_solidnet_training; but now, after inserts lines in new table, stops. after loop, must change the start , enddate again in new values of next row in view: view_solidnet_training. so there possible solution, or should make new loop check if id of view not zero? as understand question think s