Posts

Showing posts from May, 2013

css3 - Have a more consistent look and feel with IE8+, Chrome, Firefox -

i'm having problems getting of css3 properties such rounded corners on buttons show in ie 8 browser. rounded corners appear fine in ie9+, firefox, , chrome. i'm utilizing of bootstrap classes in mvc 4 web application. there way have more consistent styling older versions of ie such ie 8? have heard of css3 pie want see if there other alternatives available. can offer suggestions? here list of include files in application: <head> <meta charset="utf-8" /> <title>@viewbag.title</title> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <meta name="viewport" content="width=device-width" /> <meta name="description" /> <meta name="author" content="" /> @*----------------------------jquery------------------------------------*@ <script src="~/scripts/jquery-1.9.1.js"><

jquery - Why doesnt work CAMLQueryOptions code in operation: "GetListItems" in SPservices for display all items without folders? -

this code, works fine folders, want item without folders. code list items. var qo = '<queryoptions><viewattributes scope="recursive"/></queryoptions>'; $().spservices({ operation: "getlistitems", async: false, listname: list, camlviewfields: f, camllimit: l, camlquery: q, camlqueryoptions: qo, completefunc: function (xdata, status) { $(xdata.responsexml).find("[nodename='z:row']").each(function(i) { var lihtml = "<tr><td>" + $(this).attr("ows_title") + "</td> <td>" + $(this).attr("ows_linkfilenamenomenu") + "</td> <td>" + $(this).attr("ows_created") + "</td> </tr>"; var title = $(this).attr("ows_linktitle") $("#tasksul").append(lihtml); }); } }); the solution clear crystal. change code: $(xdata.responsexml).find("[nod

Python Module identifies as dict -

lets have lot of key-pair data. have data in package can imported. there way make modules work dicts, performance , extendibility reasons? example: common/pairs/ ├── buildings.py └── __init__.py import buildings buildings["foo"] == "bar" note: desired result can archived putting declaring buildings in __init__.py compiled every time, not drag , undroppable, , seems ugly. is there way achieve well? there way achieve @ all? not recommend it, can assign dict sys.modules . python doesn't care what's there module object. # buildings.py sys import modules if __name__ != "__main__": modules[__name__] = {'a': 1, 'b': 2, ...}

python - calling dot products and linear algebra operations in Cython? -

i'm trying use dot products, matrix inversion , other basic linear algebra operations available in numpy cython. functions numpy.linalg.inv (inversion), numpy.dot (dot product), x.t (transpose of matrix/array). there's large overhead calling numpy.* cython functions , rest of function written in cython, i'd avoid this. if assume users have numpy installed, there way like: #include "numpy/npy_math.h" as extern , , call these functions? or alternatively call blas directly (or whatever numpy calls these core operations)? to give example, imagine have function in cython many things , in end needs make computation involving dot products , matrix inverses: cdef myfunc(...): # ... many things faster python # ... # compute 1 value using dot products , inv # without using # import numpy np # np.* val = gammaln(sum(v)) - sum(gammaln(v)) + dot((v - 1).t, log(x).t) how can done? if there's library implements these in cython alrea

javascript - trouble with json, setting key name by variable -

var = { property: ((type == 'files') ? 'id' : ((type == 'folders') ? 'name' : '')) }; // have create dummy object property... return_json[type].push({ a['property']: content[type][index][a['property']] }); i'm trying return json client-side query, need key of returned object based on variable, , it's not working. under impression creating dummy object work, doesn't. firefox tells me error, missing : before property id @ a['property'] on second line. thanks! here's code in case need it. yes it's largely object oriented. these 2 functions used getting list of files user selected (this file manager) before ajax request delete files or whatever user trying do. things want return id of each file, not entire object, , that's run problem here. files, needs return 'id' whereas should return 'name' folders. getselectedjson: function(which = 0, onlyselected = true, jus

haskell - Alex right_ctx end-of-line ($) chokes on end of file -

in alex have rule looks this ^@ident\:$ {tlabel (init s)} so, single line starts identifier followed colon , end of line. this works fine unless line last in file , there not \n @ end. when happens $ not match , scan fails. need match either end of line ( \n ) or end of file? the easiest solution make sure input ends in \n appending 1 @ end of input. alternatively, can behavior want using predicate instead of $ . ^@ident\:/{ eoloreof } { ... } a predicate can examine input stream surrounding token , decide if should match or not. in case, have examine stream after token check \n or eof. the exact definition depend on wrapper you're using (the definition of type alexinput varies between wrappers), here's 1 got work using "basic" wrapper. eoloreof :: user -> alexinput -> int -> alexinput -> bool eoloreof _ _ _ (_, after) = case after of [] -> true -- end-of-file ('\n':_) -> true -- en

ruby on rails 3 - Using includes with AREL functions -

i have following classes in application: class prompt has_many :entries end class entry belongs_to :prompt belongs_to :user def self.approved where("is_approved") end end class user has_many :entries end and want display table of "approved" entries given prompt , users belong_to . generate list following query: prompt = prompt.find(prompt_id, :include => {:entries => :user}) but when run following loop, makes query each user rather using prefetched users prompt.entries.approved.each |entry| puts entry.user.id end how rewrite doesn't query each iteration of loop? it query each user because entries.approved calling query *where('is_approved')* each entry. find statement merely pulling of prompts , creating objects access child attributes. think need statement selects of entries have attribute 'is_approved' , run through loop printing ids. maybe try @entries = entry.where(is_approved: true).i

c# - creating one instance of a class object for several private functions -

i want create 1 instance of class object used several private functions in same form. have every function create new object so: player theplayer = new player(int.parse(strbox.text), int.parse(dexbox.text), int.parse(intbox.text), int.parse(perbox.text), int.parse(hpbox.text), int.parse(spbox.text), int.parse(mpbox.text), int.parse(expbox.text), int.parse(arbox.text), int.parse(cthbox.text), int.parse(goldbox.text), int.parse(meleedmgbox.text), int.parse(magicdmgbox.text), int.parse(stealthbox.text), int.parse(detectbox.text), int.parse(levelbox.text)); i have put 4 different functions. can see huge object many variables. want able create once use objects because when create new variable end having copy paste beast on functions. how can that? i'm new @ oop tried do, not knowing if work: public void playerinitialize() { string p = "p"; player theplayer = new player(int.parse(strbox.text), int.parse(dexbox.text), int.parse(intbox.tex

mutliple css documents, list style problems -

my website has 2 different css style documents. first index page, uses lists tabs @ top link bar between title , rest of it. has code: index.css : u1 { list-style-type:none; } along code applies li elements. the other css document rest of site. want use lists of other parts, i'm having issue. while li elements overwriting properly, can't u1 element show bullets in rest of site. i've tried using u1.a , u1.b , doesn't fix it. main.css : u1 { list-style-type:circle } try overwriting adding !important u1 { list-style-type:circle!important; } and/or add css file rule page want different.

How do I use autohotkey to create a new text file by right click -> New -> New text document? -

i want create new text file right click -> new -> new text document using autohotkey. how do this? new autohotkey. edit: using autohotkey, can assign shortcut tasks such running particular program notepad. writing scripts. can find details on autohotkey website. want write keyboard shortcut manually automate "right click -> new -> new text document" functionality. i figured out done adding following script autohotkey's existing script. ^+t:: click, right, 1024, 355 (or other mouse co-ordinates matter) send w send t return however, syntax wouldn't work when tried. tell me what's wrong , tell how should correct syntax? as ken white said have built in windows explorer, right click > new > new text document, it's kinda pointless having 1 doing same thing. however, if want use autohotkey create new text file more efficiently , faster recommend script settitlematchmode regex msgbox, 64, newtextfile, usage: when i

html - Creating a JQuery Mobile style list view (without JQM) -

i'm trying make list view looks similar list in link below (but not using jqm). http://view.jquerymobile.com/1.3.1/dist/demos/widgets/listviews/#list-formatted after experimenting various methods on past few days (including bad attempt @ duplicating jqm properties), have: http://jsfiddle.net/gnnn2/ there still number of problems though: li border-bottom appears on top instead of bottom at small width, dot overlaps text instead of showing ellipses the dot (arrow) not vertically centered here html: <ul> <li> <a href="#"> <div> <span class="label">richard f. godwin</span><br/> <span class="subtext">direct research representative</span><br/> <span class="subtext">ann arbor, mi</span> </div> <img class="icon"></img> </a> </li> </ul> and css: body { ma

css - Media Query:Setting padding-top based for iPhone screen -

normal css: .container-step1 { text-align: center; margin: 0 auto; padding-top: 12%; width: 50em !important;/*60em*/ height: 35em; } for mobile want update padding-top:25%; . tried: @media screen , (max-device-width: 480px) { .container-step1 { text-align: center; margin: 0 auto; padding-top: 25%; width: 50em !important;/*60em*/ height: 35em; } } it didn't work. safari still referring normal css. max-device-width vs max-width . max-width work on desktop & mobile , max-device-width work on mobile. also, need add css updated in query. remove redundant css. .container-step1 { text-align: center; margin: 0 auto; padding-top: 12%; width: 50em !important;/*60em*/ height: 35em; } @media screen , (max-device-width: 480px) { .container-step1 { padding-top: 25%; } }

.net - Visual C++ Watch for key sequence -

if have form application in c++, how set watches specific key sequence perform action? like, instance, watching user tap arrow keys in specific order, , when happens open form? (aparrantly .net? i'm new doing forms, i'm little lost here.) as long you're okay requiring main form have focus, simple version involves setting keypreview property true , adding handler previewkeydown : #using <system::windows::forms.dll> // brevity of example using namespace system; using namespace system::windows::forms; public ref class form1 : form { private: // desired key sequence static array<keys>^ contra = { keys::up, keys::up, keys::down, keys::down, keys::left, keys::right, keys::left, keys::right, keys::b, keys::a, keys::launchapplication1}; // how far sequence user int keyseqpos; // other data int lives; void form1_previewkeydown(object^ sender, preview

javascript - How to merge make PhotoBooth and face detection to work together? -

this simple solution have not been able figure out @ all, i'm trying photobooth.js , face detection script seen here face detection javascript work in same page, want detect faces within photobooth window. have working demo of photobooth on jsfiddle here: jsfiddle photobooth demo from understand given example code detect faces need id canvas correctly? example code var face_detect = require('face_detect'), canvas = require('canvas'); // ... initialize canvas object ... var result = face_detect.detect_objects({ "canvas" : mycanvas, "interval" : 5, "min_neighbors" : 1 }); console.log('found ' + result.length + ' faces.'); (var = 0; < result.length; i++){ var face = result[i]; console.log(face); } so how go getting example code work photobooth? appreciated newbie out!

actionscript 3 - AS3 package does not reflect location -

i have fla class referencing 'com.poole.blackjack.game', , folder path starting @ fla root of 'com\poole\blackjack\game'. when compile, get: 'c:\users\stephen\desktop\blackjack\com\poole\blackjack\game\player.as, line 1 5001: name of package 'com.poole.blackjack.game' not reflect location of file. please change package definition's name inside file, or move file. c:\users\stephen\desktop\blackjack\com\poole\blackjack\game\player.as' i tried changing reference , folder name 'game', get: 'c:\users\stephen\desktop\blackjack\com\poole\blackjack\game\player.as, line 1 5001: name of package 'com.poole.blackjack.game' not reflect location of file. please change package definition's name inside file, or move file. c:\users\stephen\desktop\blackjack\com\poole\blackjack\game\player.as' it's flash misinterpreting filepath, though has worked until now. annoying! it seems package using 'game' - lowercas

how to create HTML table inside the script in javascript -

i have javascript api send email in can use html, creating table inside not working , tables not show. here code: <script> $(document).ready(function(){ $("#commandemail1").click(function() { presenter.command("emailsend",{ "toemail": "imran.hussain@celeritas-solutions.com", "toname": "celeritas", "subject": "email test", "body": "single attachment", "bodyhtml":"<table width="200" border="1"><tr><td>&nbsp;</td><td>&nbsp;</td> </tr><tr> <td>&nbsp;</td><td>&nbsp;</td> </tr></table>", "attachments": [""] }); return false; }); }) </script> use single quo

python - PYTHONPATH conflict -

i trying import zipcodedatabase in helloworld.py . helloworld.py exists @ /google-app-engine/helloworld zipcodedatabase module exists /usr/local/lib/python/python2.7/dist-packages pythonpath = /usr/local/lib/python/python2.7/dist-packages;/usr/local/lib/python/ when compiling helloworld still getting " zipcodedatabase module not found". why isn't being picked pythonpath ? i highly doubt you've got module called zipcodedatabase . naming convention typically reserved class resides within module . modules lowercase or lower_snake_case, represent file containing module. i'm assuming you've installed pyzipcode here, may different module. # assuming pyzipcode.py in dist-packages directory $ python -c 'from pyzipcode import zipcodedatabase' if i'm wrong above, sure you're running version of python has zipcodedatabase module installed? some troubleshooting steps: $ python $ python --version $ python -c 'import

Basic query on Mysql Insert Statement -

i have n number of records in table ,i wanna move records 1 table other old table table1 , new table2 .i have query sub query select records table insertion . assuming 10000 records while inserting on 6000 record gets exception in , got end,but still table2 empty , here wanna know 5999 records have been inserted in databse ? thanks in advance ,, if unworthy answer or cause let me know reason down vote can improve i have query sub query select records table insertion i assume have inesrt table2(<column list>) select <column list> table1 ... running move records. if so, insert statement run part of transaction , committed if statement executed successfully, i.e. if able insert records returned select query. otherwise, transaction gets rolled , no records inserted. here wanna know 5999 records have been inserted in database? these records have been inserted worktable in tmp location while executing insert statement. have been committed

database - GridView and Hyperlink -

Image
i new vb , programming in general, however, trying develop simple application can add , save daily records database. 1 of columns in database table used input paths/directories files in computer (e.g. c:\users\m\documents). when type in the file location , run application column contents viewed text , not hyperlink. explain how convert text in specified column hyperlinks (clickable)? thank you there column type datagridviewlinkcolumn, cannot edit cells content @ runtime in datagridview (only source code). another solution: use datagridviewtextboxcolumn column type. to link style: can use cell defaultcellstyle property make blue text. to mouse icon: can handle datagridview's cellmouseenter event change datagridview.cursor property when mouse on link column. with datagridview's cellclick or cellcontentclick event can handle click on link.

java - Change schema dynamically -

how can set postgres schema dynamically in java? tried doing: this.getdatasource().getconnection().setschema("myschema"); i using spring-jdbc , this jdbcdaosupport instance. note: don't want go database twice, set search_path not solve problem efficiently. run statement: set schema 'myschema'; to change current schema or set search path, can access tables in e.g. public , myschema: set search_path public, myschema; (note difference in how specify schema name in 2 statements: first 1 has use single quotes, second 1 not) you can change search path permanently specific user, using alter user... .

c# - call a method in code-behind from client side script -

i'm using asp.net. i want update part of page (not whole page) without sending page request server. want in client side. for this, think should use ajax , javascript . i've created handler page: handler.ashx i send request , response in plain text: javascript xmlhttprequest.open("get", url); //applyupdate function response in client side. xmlhttprequest.onreadystate = applyupdate; xmlhttprequest.send(null); code on handler.ashx response.write("plain text response"); now in applyupdate function can use plain text , show in client browser. but problem this: i have placeholder1 control in asp.net: <asp:placeholder id="placeholder1" runat="server"></asp:placeholder> how can assign plain text (the response !) label control , add label placeholder1 control !? mean how can use these codes in client side: label lb1 = new lable(); lb1.text = plaintext; placeholder1.controls.add(lb1); these

javascript - How can I use the jQuery Zoomy plugin in catalog product_list Prestashop -

i want make here http://www.templatemonster.com/prestashop-themes.php . add script sunsean.com/zoomi/zoomi.js in header , change product_list <div class="center_block"> <a href="{$product.link|escape:'htmlall':'utf-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'utf-8'}"> <img class="zoomi" src="{$link->getimagelink($product.link_rewrite, $product.id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'utf-8'}" {if isset($homesize)} width="{$homesize.width}" height="{$homesize.height}"{/if} /> {if isset($product.new) && $product.new == 1}<span class="new">{l s='new'}</span>{/if} </a> <h3> <a href="{$product.link|escape:'htmlall':'utf-8'}"

android - Before onCreateView starts -

in pagefragment; inflate layout in oncreateview. want inflate layout before oncreateview loads. inflated 1 time / or every fragment; not important. how can achieve ? public class pagefragment extends fragment { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.page_quiz, container, false); tv = (textview) view.findviewbyid(r.id.text); linearlayout ll = (linearlayout) view.findviewbyid(r.id.questionlist); return view; } } you have provide layout return parameter in oncreateview() , not means have inflate there. layout can come anywhere. can inflate layout in onattach() or in oncreate() . use getactivity() layoutinflater instance: view layout = layoutinflater.from(getactivity())

php - How to disable File uploader? -

i want like, when user upload file,after want make file uploader disable. in other word,user not allow upload file once file uploded. i have tried <script type="text/javascript"> document.getelementbyid(file1).disabled = true; </script> <input type="file" name="submission_file" id="file1"> but not working. how can this? you not placing single qoutes on id document.getelementbyid('file1').disabled = true; detailed answer <script> function diablefield() { document.getelementbyid('file1').disabled = true; } window.onload=diablefield; </script>

c - Syntax highlight operators such as *,-> -

i'm using spf-13 vim distribution on os x (this problem not specific distribution). tried few different color schemes (solarized, default, desert) , none of them highlight c specific operators such *,->, etc. further reading showed depends on regex defined identify these operators. i'm not versed enough in vim script/regex try modification yet on color scheme. is possible modify solarized or other scheme highlight these operators in c? ideal if there color scheme supports this. colorschemes define colors syntax/highlight groups defined in syntax files (and default groups). since default c syntax file doesn't appear define these operators (or other, actually) there's nothing can colorscheme make them stand out. it's syntax file should mofified… or extended. this syntax file extends default syntax file with, among other things, operators.

jquery - Sliding Panel Reveal -

i have made sliding panel simple jquery, not wanted. what want, literally this: http://jquerymobile.com/demos/1.3.0-beta.1/docs/panels/ panel appears when click "reveal". right now, panel "overlay" command, not want. tried extract code website above, it's mess :p i grateful if of come sliding panel "reveal". preferably using jquery. thank in advance! this current coding. $(document).ready(function(){ $('#show_menu').on('click' , function() { $('div.panel').animate({ 'width' : 'show'} ,500, function() { $('div.home').fadein(400); }); }); $('span.close').on('click' , function(){ $('div.home').fadeout(400 , function() { $('div.panel').animate({ 'width':'hide'}, 500); }); }); });

ios - Change Button Label -

i new ios app development. working on simple application displays 2 words on screen , user selects 1 , app outputs have selected x. i have created 2 plists , have loaded them onto array , randomised them in array. on view have 2 buttons want words display on them. however, having 2 problems.. 1 . want label on buttons change when app starts. user doesn't have tap on button or anything. 2. want 1 random word array_1 (loaded plist) appear on random button. either button_1 or button_2 , same list array_2. here have done far. (with forums (: ) - (ibaction)buttonpressed:(id)sender { // load contents of plist onto array nsstring *path = [[nsbundle mainbundle] pathforresource:@"wordsone" oftype:@"plist"]; nsmutablearray *words = [nsmutablearray arraywithcontentsoffile:path]; //shuffle them using fisher–yates shuffle algorithm (int = words.count-1; i>=0; i--) { int r = arc4random_uniform(words.count); [words exchangeo

ruby on rails - Best way to order across associations -

i have 3 models: class post has_many :comments end class comment belongs_to :user belongs_to :post end class user has_many :comments end now in controller, i'd call @post.comments , order these comments user.postcode. tried following didn't work: class post has_many :comments, :order => "user.postcode" end i tried: class comment def order_by_user_postcode includes(:user).order("user.postcode asc") end end class postscontroller @post.comments.order_by_user_postcode end which results in undefined method activerecord::relation how can write method chain @post.comments sort user.postcode? you must order: has_many :comments, :order => "users.postcode" table name users not user. the second option: you must implement method class method (or scope), not instance method def self.order_by_user_postcode joins(:user).order("users.postcode asc") end or scope: scope :order_by_

Passing record as a function result from Delphi DLL to C++ -

i experiencing strange things right now. when passing struct c++ delphi dll parameter works fine. however, want receive record result either wrong values or exceptions. deactivated alignment of record passing them should work! heres code! delphi dll: tsimplerecord = packed record nr1 : integer; nr2 : integer; end; //... function ttest() : tsimplerecord; cdecl; begin result.nr1 := 1; result.nr2 := 201; showmessage(inttostr(sizeof(result))); end; c++ call : #pragma pack(1) struct tsimplerecord { int nr1; int nr2; }; //... typedef tsimplerecord (__cdecl testfunc)(void); testfunc* function; hinstance hinstlibrary = loadlibrary("reactions.dll"); if (hinstlibrary) { function = (testfunc*)getprocaddress(hinstlibrary, "ttest"); if (function) { tsimplerecord result = {0}; result = function(); printf("%d - %d - %d", sizeof(result), result.nr1, result.nr2

css - Commas in @font-face irritate Firefox -

Image
i wanted use font using following @font-face rule: @font-face { font-family: 'web symbols'; font-style: normal; font-weight: 400; src: local('web symbols'), local('websymbols'), url(http://localhost/blog/webfonts/websymbols-regular.otf) format('opentype'); } but not work, ff not use right font, although knows it: but interestingly uses font, when remove 1(!) comma src -rule, no matter of both commas. bug in firefox or doing wrong? compared font-face provided google not able find differences.

javascript - To create a transparent background for subscription box -

this going real tough me now, , can't solution this. hope many of must have seen site which, when enter site see homepage .. transparent layer comes , shows subscription box close button above it. can .. layout .. it's simple, accomplished this <div class="subscribecontainer"> subscribtion box here... </div> <style> .subscribecontainer{ position:fixed; left:0; right:0; bottom:0; top:0; background:transparent;/* default anyway or next line */ background:rgba(0, 0, 0, 0.5); /* semi transparent */ display:none;/* hidden default */ } </style> then can use jquery fade .subscribecontainer in $(document).ready(function(){ $('.togglesubscribebutton').on('click', function(){ $('.subscribecontainer').fadein('slow'); }); }); or if want fade in when window loads, so $(window).load(function(){ $('.subscribecontaine

javascript - How to control css of images on top of a full page semi-transparent overlay div -

i've got full page overlay covering page on load. script have attached close if clicked. purpose of overlay instructional page, have transparent .png images want anchor different areas of page. i have on listed example below, want have full opacity , spacing away top left corner of page... when load it, set .4 transparency , jammed upper left corner. i'm no css expert, , have been spinning wheels this. can help? <script language="javascript" type="text/javascript"> $(function () { var docheight = $(document).height(); $("body").append("<div id='overlay'><div id='home_text'><img src='/images/overlay_test_home.png'></div></div>"); $("#overlay") .height(docheight) .css({ 'opacity': 0.4, 'position': 'absolute', 'top': 0, 'left': 0, &#

javascript - Calling a function (ex. namespace.show) by name -

i want call function namespace based on name. perhaps background: want is, dynamically bind pages via $.mobile.loadpage(instrurl, { showloadmsg: false }); , then, based on current page, invoke function within loaded page. example: each page has showfilter function, event attached main.html - page should call matching function in current page. i tried solutions, jquery too, nothing works me. this function code: function namespace() { } namespace.showfilter = function () { alert("test"); } and want "invoke" or "call" via name. tried @ least. $(document).ready(function() { var fn = window["namespace.showfilter"]; fn(); }); i error typeerror: fn not function here fiddle http://jsfiddle.net/xbces/1/ you can call in following way: $(document).ready(function() { window["namespace"]["showfilter"](); }); or $(document).ready(function() { window["namespace"].showfilter(

c# - Index and length must refer to a location within the string. RAD Treeview -

i have telerik rad treeview & listbox.from server side need when node clicked & if node value 1 disable radlistbox.but exception throws this index , length must refer location within string. public void disablelistbox() { try { if (convert.toint32(treeobj.selectedvalue.substring(0,1)) == 1) { radlistboxproducts.enabled = false; } } catch (exception ee) { } } it means code treeobj.selectedvalue.substring(0,1) is returning empty string. debug code , place mouse on treeobj.selectedvalue to see returning. to avoid exception can first check returning string of atleast length 1 if(treeobj.selectedvalue.length > 1) //assuming selectedvalue returning string { //your code }

twitter bootstrap - Knockout conditional binding -

ok, i've been been building spa application, , looking have different layout depending on whether site viewed on phone or laptop. if using bootstrap, provides conditional hiding/showing of css classes, , while works nicely does, doesn't work when layout changes beyond point. alternative layout, wind needing put 2 sets of divs on 1 page, use conditional javascript code wipe out inner html of target div. prevents charts being populated parts of page never seen. var setviewscape = function () { var l = $(".positiondetails").length; if (l == 0) { settimeout(function() { setviewscape(); }, 10); } else { if (window.innerwidth <= 899) { $(".landscape").html(""); $(".phonescape").css("visibility", "visible"); } else { $(".phonescape").html(""); $(".landscape").css("visibility

android - How To Make JmDNS Work On A Large Network -

i'm working on adding discovery our app using ( http://jmdns.sourceforge.net/ ). it's working correctly on small home network. fails on large network @ office. seem recall reading if app blocks more 5 seconds get's reset. , appears what's happening. first, how can sure that's problem? of course, main question how can can make jmdns work on large network. , more general question do when need more 5 seconds? small snippet of code (it's in asynctask): inetaddress bindingaddress = inetaddress.getbyname(ipofthisdevice); jmdns = jmdns.create(bindingaddress); servicelist = arrays.aslist(jmdns.list("_myappname._tcp.local.",5000)); // 5 second timeout here code used in android app seems work @ office? /* zeroconf browser - http://melloware.com/ copyright (c) 2010 melloware inc rights reserved. */ package com.melloware.zeroconf; import java.io.ioexception; import java.net.inetaddress; import java.net.unknownhostexception;

arrays - prime number test in Ruby -

i have array a = [1,2,3,4,5] . want test of numbers prime , wanted produce output {1=>false, 2=>true, 3=>true, 4=>false, 5=>true} . any 1 liner appreciated. the below work you,using prime#prime? : require 'prime' = [1,2,3,4,5] hash[a.zip(a.map(&prime.method(:prime?)))] # => {1=>false, 2=>true, 3=>true, 4=>false, 5=>true}

delphi - How to add thumb images to TRzGroup Item Menus -

Image
i creating sidebar images of trzgroup. have created trzgroup caption print , added item named print it. planning add small printer icon image @ left hand side of menu item shown in figure @ bottom. how can done ? object rzgroup2: trzgroup items = < item caption = 'print' imageindex = 4 onclick = rzgroup2items0click end> opened = true openedheight = 47 dividervisible = false smallimages = imagelist1 special = true caption = 'print now' parentcolor = false end while code extracted somewhere in code smallimage attribute assigned imagelist1. assume image menu. checked @ object inspector there smallimages property not sure how create imagelist1 , assign smallimages. drop timagelist delphi component palette (win32 page) onto form (or in data module used form). double-click new timagelist , click add button on imagelist editor appears, , add images. clo

Parsing a pcap file in python -

this question has answer here: pcap python library? [closed] 4 answers i trying parse through pcap file in python. goal able pull out type of tcp or udp file , time start/end. have advice in packages might useful use , documentation them or advice in general on writing it? i use python-dpkt. here documentation: http://www.commercialventvac.com/dpkt.html this know how though sorry. #!/usr/local/bin/python2.7 import dpkt counter=0 ipcounter=0 tcpcounter=0 udpcounter=0 filename='sampledata.pcap' ts, pkt in dpkt.pcap.reader(open(filename,'r')): counter+=1 eth=dpkt.ethernet.ethernet(pkt) if eth.type!=dpkt.ethernet.eth_type_ip: continue ip=eth.data ipcounter+=1 if ip.p==dpkt.ip.ip_proto_tcp: tcpcounter+=1 if ip.p==dpkt.ip.ip_proto_udp: udpcounter+=1 print "total number of packets

jquery - how to add effect 'hide ("slow")' to div inside a PHP while -

i have form repeated several times within div called "formscontainer" in php while, want make form submit respective div disappears effect hide ("slow") here example code <script type="text/javascript"> $(function() { $("form").each(function() { $(this).validate( { submithandler: function(formbeingsubmitted) { $.post('process.php', $(formbeingsubmitted).serialize(), function(data) { $('#results').html(data); $ (formbeingsubmitted).hide("slow"); }); } }); }); }); </script> </head> <body> <?php { ?> <div id="formscontainer"> <form method="post" id="form1"> <label for="name" id="name_label">form </label> <input type="text" name="name" id=&

Assignment to part of a multi-dimentional array in VHDL -

i want change of elements in array, can figure out how it. this line: sig3(1) <= (11, 12); gives me error entity t1 end entity; architecture testbench of t1 type type3 array(1 2, 1 2) of integer; signal sig3 : type3; begin process begin -- sig3 <= ((11, 12), (13, 14)); -- works sig3(1) <= (11, 12); -- error: "incompatible types assignment." wait; end process; end architecture; the way have defined array unfortunately precludes method favour of assigning: if decalre type this: type type3 array(1 2, 1 2) of integer; signal sig3 : type3; assignments have specify index: sig3(1,1) <= 11; sig3(1,2) <= 12; you can define 2d array array of 1-d arrays though type type4 array(1 2) of integer; type type5 array(1 2) of type4; signal sig5 : type5; you can assign this: sig5(1) <= (11,12); unfortunately, can't work in other dimension.

How to use php-pear with vagrant and chef behind a proxy? -

i'm using recipe git://github.com/opscode-cookbooks/php.git install php chef on vagrant box (ubuntu). unfortunatly box behind proxy. it seems have call that: pear config-set http_proxy http://domain:3128 how can call , can call it? you can call via execute resource, after installing php itself: include_recipe "php::default" execute "set proxy pear" command "pear config-set http_proxy http://domain:3128" end php_pear "pear_package" version "x.x.x" action :install end ...

How to implement __eq__ in shapely (python) -

i have question regarding shapely , usage of == operator. there exists function test equality of geometric object: .equals() . == not work. point((0, 2)).equals(point((0,2)) returns true. however: point((0, 2)) == point((0, 2)) returns false i able use == operator check if point present in list. 1 use case be: if point not in list_of_points: list_of_points.append(point) as far understand, not work because == returns false . know there exists alternative in using any() function, prefer in keyword: if not any(point.equals(point) point in list_of_points): list_of_points.append(point) would large effort implement __eq__ in shapely/geometry/base.py ? think of naive implementation of __eq__ ? class basegeometry(object): def __eq__(self, other): return self.equals(other) or class basegeometry(object): def __eq__(self, other): return bool(self.impl['equals'](self, other)) one side effect of implementing _

javascript - Android/iPhone WebView realtime update performance -

i want make webview interface app, it's require real-time updates chart bars. did before , have idea performance point of view if it's working good? android , iphone/ipad. rest of code made using standard sdk, interface want make html5 javascript. thanks!

getting all the data from mysql database table is not working in java -

Image
i trying data table.but it's giving me first row twice result (as have 2 rows in database) here code string data[]=new string[10]; string[] result; product p= new product(); int serial=0; try{ string sql="select * product"; rslt=st.executequery(sql); //where private static statement st, private static resultset rslt; while(rslt.next()){ data[1]=rslt.getstring("p_code"); data[2]=rslt.getstring("p_name"); /* data[3]=rslt.getstring("description"); data[4]=rslt.getstring("measurement"); data[5]=integer.tostring(p.remainproduct(data[1])); data[6]=p.getsellprice(data[1]); serial+=1; data[0]=integer.tostring(serial); dtb.addrow(data); */ system.out.println("code :"+data[1]+" "+&quo

python - _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10055)") -

i'm getting following error when running python script on 2008 vm running mysql server 5.6 using ajax traceback (most recent call last): file "mypythonjob.py", line 22, in <module> db = mdb.connect('localhost', 'website','servername', 'website') file "c:\python27\lib\site-packages\mysqldb\__init__.py", line 81, in connect return connection(*args, **kwargs) file "c:\python27\lib\site-packages\mysqldb\connections.py", line 187, in __init__ super(connection, self).__init__(*args, **kwargs2) _mysql_exceptions.operationalerror: (2003, "can't connect mysql server on 'localhost' (10055)") i can watch in resource monitor cpu climbs 100% after 75 seconds @ point mysql.exe has 30 threads , python.exe has 6 threads error kicks out , python.exe terminated , mysql server un reachable 2mins comes on line. import os, datetime, pymssql , time, subprocess import mysqldb mdb today =