Posts

Showing posts from September, 2011

c# - Mvc4 giving me this error 'jQuery.validator.unobtrusive' is null or not an object' -

i have written client side custom validation in separate javascript file named (mycustomvalidations.js) and code javascript(mycustomvalidations.js) file jquery.validator.unobtrusive.adapters.add ("selectedvaluewithenteredvaluecheck", ["param"], function (options) { options.rules["selectedvaluewithenteredvaluecheck"] = options.params.param; options.messages["selectedvaluewithenteredvaluecheck"] = options.message; }); jquery.validator.addmethod("selectedvaluewithenteredvaluecheck", function (value, element, param) { console.log(value); console.log(param); var usrenteredvalue = parseint(param); var ddlselectedvalue = json.stringify(value); if(ddlselectedvalue == 'amount') { if(usrenteredvalue < 10 || usrenteredvalue > 20) { return false; } } return true; } ); and view .. @scripts.render("~/bundles/...

java - My treemap breaks after sorting it because "comparator used for the treemap is inconsistent with equals" -

i needed sort treemap based on it's value. requirements of i'm doing such have use sorted map. tried solution here: sort map<key, value> values (java) comments say, make getting values map not work. so, instead did following: class sorter implements comparator<string> { map<string, integer> _referencemap; public boolean sortdone = false; public sorter(map<string, integer> referencemap) { _referencemap = referencemap; } public int compare(string a, string b) { return sortdone ? a.compareto(b) : _referencemap.get(a) >= _referencemap.get(b) ? -1 : 1; } } so leave sortdone false until i'm finished sorting map, , switch sortdone true compares things normal. problem is, still cannot items map. when mymap.get(/ anything /) null still. i not understand comparator inconsistent equals means. i not understand comparator inconsistent equals means. as per contract of comparable interface . ...

logging - Database design or architecture suitable for storing logs, real time reporting and utilized as log correlation engine -

the problem face related storing , retrieving reasonably fast millions of logs. work on collecting everyday logs firewalls, intrusion detection , prevention systems, application logs, user activity etc., storing them on database, perform real time reporting , correlating them identifying intrusions etc. after working , building system syslog , mysql found out bottlenck @ moment database. have experience on relational database. on other hand totally lost on technologies exist , came knowledge in database field. so nosql databases (mongo, cassandra etc) better , outperform tranditional databases (mysql, oracle, mssql etc)? have read until there no aggregation functions , consequently reporting not feasible, right? dataware houses better needs? know used reporting not real time. true or there implementation today support maybe near real time might acceptable? found out more or less different way of designing database schema , traditional databases excellent candidates that. true? ...

Authentication and getting a session token from Quickblox in Python -

i'm doing through rest api. 2 questions 1) want push existing data quickblox custom object. how many rest calls need? (i not clear whole state of affair involving computer security.) first (a) session token. , follow create new record here ? 2) i'm trying session token i'm getting {"errors":{"base":["unexpected signature"]}} response. here code genereate nonce, signature, , getting session token: # of course these not 0, x, , y's. appid = '0000' authkey = 'xxxxxxxxxxx' authsecret = 'yyyyyyyyyyyyyy' def getnonce(): import random return random.random() def createsignature(nonce): import hashlib import hmac import binascii import time stringforsignature = 'application_id={id}&auth_key={auth_key}&nonce={nonce}&timestamp={timestamp}'.format(id=appid, auth_key=authkey, nonce=nonce, timestamp=time.time()) hmacobj = hmac.new(authkey, ...

java - What is the safe way to get the array class name at runtime? -

here example code requires obtaining class name of array unknown @ runtime: //for calling methods declared similar // void method(string... values); //for primitive type have other overloads , following //is generic classes @suppresswarnings("unchecked") private static <t> void invokevaridic(method m, object host, t... values) throws illegalaccessexception, illegalargumentexception, invocationtargetexception, classnotfoundexception{ assert(values.length>0); //we assume users passes @ least 1 value class<? extends t[]> c = (class<? extends t[]>) class.forname("[l" + values[0].getclass().getname() + ";"); m.invoke(host, arrays.copyof(values, values.length,c)); } since type erasure nature type of values object[] , cannot pass m.invoke because requires string[] . since forcing user pass @ least 1 value can use type of values[0] construct new array. i don't know t[].class is. i com...

javascript getting url using location.search not working -

i using chrome 28.0.1500.95 m version, when use javascript code window.location.search or location.search or window.location.hash it returns null in javascript doc given return url. can 1 me out of this. thanks in advance. if you're looking fetching url then window.location.href;

javascript - which performance is good? -

i learn android webview. there problem. i have xml has logs. i figure out 2 methods. using javascript read xml logs show on webview. first read xml logs on android's main code , , send every logs to javascript. i'm not sure performances good.

localhost - how to print response in android app -

hi new android , trying post data localhost not getting response or error public void postdata(string valueiwanttosend) { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://10.0.2.2/text.php"); try { // add data list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("myhttpdata", valueiwanttosend)); httppost.setentity(new urlencodedformentity(namevaluepairs)); // execute http post request httpresponse response = httpclient.execute(httppost); } catch (clientprotocolexception e) { // todo auto-generated catch block } catch (ioexception e) { // todo auto-generated catch block } please suggest me how can print response can come know issue from response: stringbuilder builder = new stringbuilder(); int statuscode = response.getstatuscode(); if (statuscode == 200) { httpentity entity = response.gete...

Regex Python with order for OR | pattern -

how can return ordered list regex? still kind of learning regex. for example, lets have list = [a,b,c,c,b,a,g] , want have b's first, followed a's, lastly a's in list. how can regex it? i thinking: pattern = re.compile('b|c|a') [letter letter in list if pattern.match(letter)] but comes out ['a','b','c','c','b','a'] what want ['b','b','c','c','a','a'] how possible? thanks! regular expressions dealing patterns in text, search , extract substrings string. want actual intelligent processing. outside scope of regex put quite easy in python :) you make sound there should 'a', 'b', or 'c' in list can write simple comparison function def cmp(c): return {'a' : 1, 'b' : 0, 'c' : 2}[c] then give sorted sorted(your_list, key=cmp) simple that.

selenium - how to hover over menu and sub menu -

with following code, able hover , click on 1 level hierarchic. ctl00_mnumainn2 -> new public static void openfundnewpagetest() { navigatefrommainpage("td#ctl00_mnumainn2", "new"); //driver.findelement(by.linktext("new")).click(); waitforpageload(); } public static void navigatefrommainpage(string objectidentifier, string menulink) { string js = "$(" + "'" + objectidentifier + "'" + ").mouseover();"; ((ijavascriptexecutor)driver).executescript(js); driver.findelement(by.linktext(menulink)).click(); } if there multiple level of submenu ctl00_mnumainn2 -> fund -> hierachi -> new how can make them work? also not able identify link on page. you can use this webutilities.executescript(driver, "$('.context_menu').show()"); replace '.context_menu' respective css selector. then can find element , click it.

html5 - Kinetics JS "Click" or simple "Touch" event for Mobile device -

i using kinetic-v4.3.0-beta2.js i want handle mobile touch event on group ios & android. i binding event such following group.on('touchstart', function (evt) { $('#onpopmenu').popup("open", { x: leftposition, y: topposition }); }); i tried 'touchend', 'touchstart' , 'tap' got partial success in "tap" in case, shape draggable tap event not fire because object move it's place. but if shape not draggable work fine. i tried 'touchend' , 'touchstart' event popup menu close after event fire in ios , android opening jquery mobile popup touching group! the popup menu open 2-3 seconds when touchstart event fired. anyone faced same problem kinetic js mobile events? how handle "click" or "touch" event it. i checked http://www.html5canvastutorials.com/kineticjs/html5-canvas-mobile-events/ reference had no luck! i developing application phonegap + jqm + kinetics j...

clang - segmentation fault in virtual method invokation -

clang uses following scheme define concrete type in llvm ir: %"mytype" = type {virtual_method_types, field_types, super_types} and in order call virtual method (e.g. virtual int f(){}) following scheme used: %0 = load %"mytype"** %this %1 = bitcast %"mytype"* %0 i32 (%"mytype"*)*** %vtable = load i32 (%"mytype"*)*** %1 %method = getelementptr inbounds i32 (%"mytype"*)** %vtable, i64 0 (index of f() in vt) %ld = load i32 (%"mytype"*)** %method %call = call i32 (%"mytype"*)* %ld (%"mytype"* %0) however, if following scheme used instead, should changed in above code prevent seg fault? %"mytype" = type {field_types, super_types, virtual_method_types} this line gets pointer @ start of object, vptr (pointer virtual table): %1 = bitcast %"mytype"* %0 i32 (%"mytype"*)*** if place vptr @ end of object instead, code need change use extractvalue on...

Taking User confirmation in drools 5.4 -

i have requirement in if validation fails , have ask user whether continue or not . if user says yes , have persist data in db , if user says no data won't persisted in db . the validations performed in validate.drl . once these validations performed,i have ask user if wants continue or not. process flow follows: start -> input.drl -> validate.drl -> takeuserconfirmation.drl -> persistdata.drl in above flow, have add logic in takeuserconfirmation.drl user should confirm if wants continue or not. depending on answer given i’ll restrict rule in persistdata.drl . execute if user confirms persistence. how can achieve this? can human task i.e. work item handler useful case? how pause drools flow , take user confirmation , start same flow again ? the question why want in drools. rule file doesn't seem right place user interaction. rather return application code collection of objects validation failed (you can flag them) , if confirmed execute ...

pointers - Accessing points inside structs inside unions - C -

i have following data structures struct a_str { union { struct { struct c_str *c; } b_str; struct { int i; } c_str; }; } struct c_str { struct d_str; } struct d_str { int num; } i trying access num in struct d_str. reason keep on getting segmentation fault. struct a_str *a = init_a(); //assume memory allocation , init ok. a->b_str.c->d_str.num = 2; what wrong? probably not allocating memory a->b_str.c in init() function, may reason a->b_str.c pointing garbage location , segmentation fault due accessing memory not allocated - illegal memory operation. if init() function correct, there should not problem (syntax-wise code correct). below have suggested inti() function allocated memory nested structure correctly (read comments). struct a_str *init() { struct a_str *ret = malloc(sizeof(struct a_str)); // memory `struct a_str` struct c_str *cptr = malloc...

python - Rearrange the attributes in a node lxml -

this question has answer here: python - lxml: enforcing specific order attributes 3 answers i have element node <relationship type="http://schemas.openxmlformats.org/officedocument/2006/relationships/fonttable" id="rid61" target="media/image1.png"/> i need attributes sorted in order. output should like <relationship id="rid61" type="http://schemas.openxmlformats.org/officedocument/2006/relationships/fonttable" target="media/image1.png"/> how rearrange this? using lxml library thanks there no way set specific order of element attributes using lxml . element.attrib dictionary, dictionaries in python unordered collections. also see: python - lxml: enforcing specific order attributes

jquery - How to make a horizontally animating border on links when hovered? -

so, goal i'm trying accomplish here idea have horizontal navigation bar border shows when hovered , slides mouse on other links in navigation bar, , moving mouse away navigation bar hides border again except active page. have seen somewhere, cannot remember where. similar this , without snap. border should fade when nothing hovered. i'm not experienced jquery this, i'm asking may have ideas, try , explain simple possible. have tried searching couple days on animation no avail. if possible in pure css, great, i'm not sure because depends on movement of cursor. in advance. have @ jsfiddle demo some js function $("#example-one").append("<li id='magic-line'></li>"); /* cache */ var $magicline = $("#magic-line"); $magicline .width($(".current_page_item").width()) .css("left", $(".current_page_item a").position().left) .data("origleft...

c# - WCF Data Service-Timeout expired issue from mysql view -

i have created wcf datatservices mysql db. getting data tables in quick flash. when tried data view, throwing timeout exception. when tried directly in db data getting quickly. i tried setting following in web.config. <system.servicemodel> <bindings> <nettcpbinding> <binding name="nethttpbinding" maxbufferpoolsize="2147483647" closetimeout="00:01:00" opentimeout="00:01:00" maxconnections="10" receivetimeout="00:10:00" sendtimeout="00:10:00" maxbuffersize="524288" maxreceivedmessagesize="2147483647" /> </nettcpbinding> </bindings> <services> <service name="myservice"> <endpoint address="http://localhost:59825" binding="nettcpbinding" bindingconfiguration="nethttpbinding" name="h...

How to change the Img tag src through css only? -

how can replace image tag src value through css ? , want support in ie8 ,firefox ,chorme,safari <div class="any"> <img src="images/i.png"/> </div> replace src value through css only. thanks try setting background image , moving (with padding) out of box original image something this... edit had tweak bit have working... .any img { display: block; -moz-box-sizing: border-box; box-sizing: border-box; background: url(http://placehold.it/150) no-repeat; width: 150px; height: 150px; padding-left: 150px; } ... , here working example http://jsfiddle.net/nnarn/1/

c# - How to add a value to a existing .csv file -

i have information in .csv file @ click of button, add 1 number. so data table: years last paid: 2012 2012 2012 2012 and @ click of button, on selected columns years last paid: 2013 2013 2012 2013 so in laymans terms, how add 1 selected column when press button i dont have attempt because dont know how google search it, if there questions please ask, have in 3 hours present try this list<string> str = file.readalltext(@"completefilepath").split('\n').tolist(); list<string> updatedvalues = new list<string>(); foreach (var value in str) { int val = 0; if (int.tryparse(value, out val)) { updatedvalues.add((val + 1).tostring()); } } file.writealllines(@"completefilepath", updatedvalues);

c++ - Move files to Trash/Recycle Bin in Qt -

is there qt function move files recycle bin instead of deleting them, oses support it, or need use os-specific code? there no api yet. https://bugreports.qt.io/browse/qtbug-181 the issue closed , fix version is: future release edit: new issue has been opened @ https://bugreports.qt.io/browse/qtbug-47703 .

jquery - When items are hovered fast they're not returning to its default state -

with reference this question when mouseenter on each item, overlay disappearing, when mouseleave - overlay shows. when have more items, , fast hovering on them randomly, they're not returning it's previous state. it's quite annoying :/ why that? $('.item').mouseenter(function () { var $this = $(this); settimeout(function () { $this.find('.item-overlay').css('z-index', '-1'); }, 300); }).mouseleave(function () { $(this).find('.item-overlay').css('z-index', '1'); }); http://jsfiddle.net/w3gha/ try hover() : http://jsfiddle.net/kfs9h/ $(".item").hover( function () { $(this).find('.item-overlay').stop().css('z-index', '-1'); }, function () { $(this).find('.item-overlay').stop().css('z-index', '1'); } );

RTRIM(CLOB field) in Oracle PL/SQL -

please suppose have clob field in oracle table, in have stored creation script of package/procedure/function. i remove blanks at end of every line , but: a) dbms_lob.trim (clob field) procedure , not function; b) rtrim (clob) don't fail, not work achieve this. how can solve problem? please note spaces @ beginning of every line useful indentation of pl/sql source code stored in clob field, haven't removed. thank in advance kind , cooperation. to remove spaces @ end of each line use regexp_replace() regular expression function: regexp_replace(col, '\s+('||chr(10)||'|$)', chr(10)) here example(note: replace function used highlight spaces): with t1(col) as( select to_clob('begin '||chr(10)||chr(32)||chr(32)||'something going on here'||chr(32)||chr(32)||chr(10)|| 'end'||chr(32)||chr(32)) dual ) select replace(col, ' ', '_') with_spaces , replace( regexp_replace(col, ...

How can i code a time limit in my android game -

i have quiz game android has time limit. want there choices button if click 1 of buttons automatically intent class next level if didnt answer or click of button intent other class, thats why game has time limit. problem dont know how put time limit intent or transfer in class automatically if didnt click of button choices. tried sleep happen clicked correct answer , im on next level class sleep class intented sleep. please me problem. try handler didnt work public class easyone extends activity { button a, b, c; textview timer; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.easyone); = (button) findviewbyid(r.id.btn_ea1); b = (button) findviewbyid(r.id.btn_eb1); c = (button) findviewbyid(r.id.btn_ec1); a.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(getapplicationcontext(),"correct!...

java - ComboBoxRenderer cannot be converted to TableCellRenderer -

i try create combo box , add in table column. use example . when try col5.setcellrenderer(cmbrender); throws: "comboboxrenderer cannot converted tablecellrenderer". comboxrenderer class comboboxrenderer extends jlabel implements listcellrenderer { private font uhohfont; public comboboxrenderer() { setopaque(true); sethorizontalalignment(center); setverticalalignment(center); } public component getlistcellrenderercomponent( jlist list, object value, int index, boolean isselected, boolean cellhasfocus) { int selectedindex = ((integer)value).intvalue(); if (isselected) { setbackground(list.getselectionbackground()); ...

c# - Quickfix, Is there a "catch-all" method OnMessage to handle incoming messages not handled by overloaded methods? -

i use messagecracker crack(message, sessionid); within fromadmin , fromapp (i use version 1.4 of quickfix/n , message cracker seems handle admin messages, @ least overloaded onmessage(quickfix.fix44.longon message, sessionid sessionid){} handled correctly). my question is: in case have not overloaded onmessage methods incoming messages go through messagecracker there sort of "catch-all-other" message method called incoming messages cannot forwarded overloaded onmessage method? not want have quickfix send message rejects because, example fix server sends unhandled message which, however, may not essential process flow. want handle myself. not feel comfortable handle in try/catch because not feel cleanest approach. any advice? thanks no, there isn't. any respectable fix counterparty have spec tells messages types send (as fields these messages might contain). therefore, should know message types need support, , can provide onmessage call each of t...

Red5 video recorder is not smooth in centos server -

i have used red5 1.0 rc1 version, , @ time of video recording, sometime records , not. issue cannot find, can helps. thanks in advance. this article covers recording issues each red5 version. patched red5 1.0.2 fixes recording issues.

Rails validation from controller -

there contact page, offers enter name, telephone, email , message, after sends administrator's email. there no reason store message in db. question. how to: use rails validations in controller, not using model @ all, or use validations in model, without db relations upd: model: class contactpagemessage include activemodel::validations include activemodel::conversion extend activemodel::naming attr_accessor :name, :telephone, :email, :message validates :name, :telephone, :email, :message, presence: true validates :email, email_format: { :message => "Неверный формат e-mail адреса"} def initialize(attributes = {}) attributes.each |name, value| send("#{name}=", value) end end def persisted? false end end controller: def sendmessage cpm = contactpagemessage.new() if cpm.valid? @settings = setting.first if !@settings redirect_to contacts_path, :alert => "fail" end if contactpagemessage.rec...

git checkout for xcode -

so i've been watching videos facebook mobile devcon 2013 ( http://www.youtube.com/watch?v=mluautbgvem ) on youtube , every time explains new or new checkout , new code added project. different versions of project? how work? can explain git checkout , needed set 1 up? edit speaker git checkout on 38:49 the speaker has git repository multiple branches or tags each stage of demo/walk-through. git checkout used checkout given branch/tag/hash , files updated in-place. xcode detect files changes , refresh editor view , groups , files pane. to create kind of thing yourself, develop code , create branches @ various points using command git branch step2 , git branch step3 etc. after latest commit made. when doing demo, can git checkout step3 move point in commit tree.

php - combo box with countries as its id, and an input text that will do the autocomplete -

i made combo box contain country it's id, , have input text autocomplete. if select 1 of country combo box, want input text show me, when press words autocomplete function, of city include in country (assuming have in database). sample code below form city: <select name="city" id="city" /> <option value="">-- first select state --</option> <option value="">bangalore</option> <option value="">mumbai</option> <option value="">chennai</option> <option value="">gujrath</option> </select> area : <input id="loction" name="loction" type="text" /> script -------- $(document).ready(function() { $("#loction").autocomplete("get_course.php",...

javascript - jQuery UI Error - Uncaught SyntaxError: Unexpected Identifier -

i'm trying implement jquery slider that's bound select box part of questionnaire i'm putting together. however, i'm getting uncaught syntaxerror in chrome , expected ')' error in ie. the jquery i'm using follows , straight copy jquery ui site found here : <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { var select = $( ".minbeds" ); var slider = $( "<div id="slider"></div>" ).insertafter( select ).slider({ min: 1, max: 4, range: "min", value: select[ 0 ].selectedindex + 1, slide: func...

python - Get the max value for given keys in a dictionary? -

i have following list: information = [[u1, b1, 12], [u1, b2, 15], [u1, b3, 1], [u2, b1, 6], [u2, b2, 7], [u2, b3, 43]] i want return dictionary give me highest values pair of u , b, in case of given list be: bestvalues = {(u1, b2): 15, (u2, b3): 43} how achieve simple python code, can not import modules. you'd need sort (using sorted() , group (using itertools.groupby() , use max() on each group. from operator import itemgetter itertools import groupby key = itemgetter(0) bestvalues = {tuple(best[:2]): best[2] key, group in groupby(sorted(information, key=key), key=key) best in (max(group, key=itemgetter(2)),)} these standard-library modules. without imports, you'd have loop twice; first group everything, find maximum value each group: grouped = {} tup in information: grouped.setdefault(tup[0], []).append(tup) bestvalues = {} group in grouped.itervalues(): best = max(group, key=lambda g: g[2]) bestvalues[t...

actionscript 3 - Character movement tied to keypress, increases animation speed with increased character speed -

i've come across tough problem (at least me) can't figure out. have stick figure, , want make simple running animation depending on if moving left or right, tie animation speed how fast in x direction moving. below included code how character moves (all unncessary code game removed). xspeed want animation speed somehow linked too. relate absolute value of xspeed since can negative. ideally, i'd have 2 animations, 1 moving left , 1 moving right. thought making both animations on same timeline stickman1, doing this. if (xspeed > 0){stickman1.gotoandplay(2)} if (xspeed < 0){stickman1.gotoandplay(5)} assuming animation going right 3 frames long, beginning on frame 2, ending on 4, , animation going left 3 frames long, beginning on frame 5, ending on 7, , on frame 4 , 7 putting in code says gotoandplay(correct frame repeat) . said though, know it's bad practice coding on timeline, if possible stay away that. gets worse. have no idea how speed animation =(. t...

Tips for learning embedded linux -

i want learn basics of embedded linux. assuming need go , buy sort of hardware board , have linux kernel code. i have no idea start , tips/pointers welcome. ideally people point out full system (e.g. "board kit linux" these "manuals" good). also cost factor doing not business : ) thanks much, code you need: 1 - boards: started beagleboard . new beaglebone black available now. there's large support community beagles; many howto pages here , here , , ready install images . can build image (step 3). these boards have of peripherals may need play with, , can used computer ! 2 - books: mali noted, linux fast moving object, in phases of learning need solid reference. i'd suggest " embedded linux primer: practical real-world approach " has many examples , takes step-by-step. there's " building embedded linux systems ". 3 - firmware: a) toolchain, b) root filesystem , c) kernel image. " buildroot " easiest...

sql - Azure Mobile Services Insert function -

is possible handling handling external inserts/updates azure sql database azure mobile services (insert, update, directly db , etc.) know scripting. tables working fine, , visible mobile service manage center. need handle events direct sql requests db db management portal or azure web sites, without direct requests mobile service (rest api, , etc.) is question how execute sql commands mobile device directly against database (sql database) without first going through rest api , scripting layer mobile services provides? if so, answer no. mobile device needs way communicate database, uses api , scripting layer this. of course, build own web service layer works database. but, layer mobile services providing out-of-the-box. however, if question can issue sql commands against database using tools sql server management studio or other web sites, answer yes. sql database mobile services provides regular sql database. have full control on it. can connect , issue commands...

html - Bootstrap form aligned, vertical, and horizontal -

i trying make pretty form work boostrap-responsive.css mobile use. before used tables, , worked fine without bootstrap-responsive, becomes ugly when scaled down. what i'm trying accomplish : get headline/label each input in top(horizontal). aligned right side(so pretty on phone). have glyphicons prepended - makes difficult, since them can't format correctly if unclear of want accomplish, can take @ super hightech picture describes form: http://i.imgur.com/xcvl0hp.jpg my code half working code is: <form class="form-vertical" ....> <fieldset> <div class="row-fluid"> <div class="span8 input-prepend"> <label class="control-label" for="title">title</label> <span class="add-on"><i id="titleicon" class="icon-minus-sign"></i></span> <input type="text" name="title" id=...

php - mysql error in connection to the server -

this question has answer here: lost connection mysql server @ 'reading initial communication packet', system error: 0 20 answers i'm getting lost connection mysql server @ 'reading initial communication packet', system error: 2 error while i'm going connect db. if i'm using localhost working fine. when i'm using live ip address 1 below, i'm getting error: mysql_connect("202.131.xxx.106:xxxx", "xxxx", "xxxxx") or die(mysql_error()); please me. thanks. why not use localhost? try without port number. or please check server configuration , port using.

php - Pull data from incrementing XML files -

so heres scenario. i need pull data xml files located on web (individually easy enough), problem new file incremented filename added from time time. so example, 1 day filename may www.website.com/00001.xml , next day, new file added www.website.com/00002.xml i need create script, ideally in php, automatically refresh every couple of hours , pull data new xml file, if xml file not present yet retry same number again. can put rows in excel file. the question basically, best way go this? if point me similar thats out there, great. thanks in advance

c - Print Complex Structures with GDB -

please consider following structures: /* complex structure */ typedef struct { char_t s4_1 [15]; int_t s4_2; } struct4_st; typedef struct { char_t s3_1 [15]; int_t s3_2; } struct3_st; typedef struct { struct3_st s2_1; struct4_st s2_2; } struct2_st; typedef struct { int_t s1_1; char_t s1_2; struct2_st s1_3; } struct1_st; struct sample { int_t sample1; int_t sample2; char_t sample3[20]; struct1_st sample4; } test; if put break-point on function containing structure, can print parameters of structure in pretty-print format. my requirement is: i want use gdb output write code fill these structures. is there advanced command gives each struct member on seperate line, like: gdb$ <command> test required output: test.sample1=1 test.sample2=2; test.sample3="hello" test.sample4.s1_1=3 test.sample4.s1_2='t' thanks. there no built-in command in gdb that. if gdb python-enabled, isn't hard write yourself.

legend - Plotting multiple graphs with different colour on matlab -

i want draw 2 graphs in matlab different colors. want box in upper right corner names each of 2 graphs. code writing is: x=1:1:max %err_t_coupled,err_t_uncoupled arrays figure plot(x, err_t_coupled,'red',x, err_t_uncoupled,'blue') legend('uncoupled','coupled','location','northeast') title('maximum error') xlabel('iterations') ylabel('maximum error wrt d-norm') it produces desired graph. in top right corner, draws red line both coupled , uncoupled. instead want red coupled , blue uncoupled. solutions? the problem has fact err_t_coupled , err_t_uncoupled arrays, not vectors. this work: x=1:1:max %err_t_coupled,err_t_uncoupled arrays figure h1 = plot(x, err_t_coupled,'red'); hold on h2 = plot(x, err_t_uncoupled,'blue'); legend([h1(1) h2(1)], 'coupled','uncoupled','location','northeast') title('maximum error') xlabel('iterations...

php - Textarea regular expression -

i need test textarea accept following. new line \n , space \s , a-za-z, 0-9,? $@#()'!,+-/=_:.&€£* , % . edited: far tried: var regx = a-za-z0-9?$@#()'!,+\-=_:.&€£*%\s ; /*don't know method checking regular expression so, method validate_regex check/match */ regx.validate_regex(my_textbox_value); please answer how write regular expression using php , jquery. assuming textbox-id id of textarea var textboxvalue = $("#textbox-id").val(); var regx = /^[a-za-z0-9?$@#()'!,+\-=_:.&€£*%\s]+$/; if (regx.test(textboxvalue)) alert("correct"); // alerts else alert('incorrect!');​ try one: html: <textarea id="foo"> </textarea> <input type="text" id="bar"/> js: var regx = /^[a-za-z0-9?$@#()'!,+\-=_:.&€£*%\s]+$/; $('#foo').keyup(function() { if (regx.test(this.value)) $('#bar').val('correct'); else $('#b...

nltk - How to serialize a CObject in Python? -

i've trained svm classifier using nltk , svmlight python libraries , when call pickle.dump(my_classifier, outfile, 1) save classifier, throws error: file "/usr/lib/python2.7/pickle.py", line 313, in save (t.__name__, obj)) pickle.picklingerror: can't pickle 'pycobject' object: <pycobject object @ 0xc1cbd50> i read can't pickle cobject , didn't find solution save work though :/ how proceed? use python 2.7.3 for it's worth, know nltk , works fine when pickle other classifiers maxentclassifier or naivebayesclassifier opposed svmclassifier , think has svmlight library, it's first time use it. you can use method write_model(model, filename) svmlight library save it. maybe can teach pickle use custom protocol pickling.

sql - Replace a column values from 'male' to 'female' and 'female' to 'male' -

i have 1 table gender in 2 entries there 'male' & 'female' number of rows 2 entries only. want write procedure replaces these 2 values , output should below, i/p o/p sex sex ------------------------ male female female male female male male female i creating procedure, gives me error, using cursor fetch more 1 rows..i know can using 1 update statement want try please this.. declare v_gen gender%rowtype; cursor cur_gender select * gender; begin open cur_gender; loop fetch cur_gender v_gen; select * gender; if v_gen='male' update gender set sex='female'; else update gender set sex='male'; end if; exit when v_gen%notfound; end loop; close cur_gender; end; update table1 set "col" = (case "col" when 'male' 'female' else 'male' end); fiddle

c++ - How to transfer the `perspectiveTransform` position back to the img_scene's position? -

here source code: http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography the line interested in one: perspectivetransform( obj_corners, scene_corners, h); and @ scene_corners, coordinate strange, small, convert related img_scene object. function can it? thanks.

vb.net - Clickonce application has stopped working for WPF application -

i have created wpf application on windows xp using vs 2008. when published application, runs on xp doesnt run on windows 8 64 bit..i tried installing .net framework 3.5 sp1 on windows 8 not getting installed. when run clickonce application,it shows "projectname.exe has stopped working." can any1 me solve this. think need here: installing .net framework 3.5 on windows 8

css - Force HTML Tables To Not Exceed Their Containers' Size -

this question has been asked several times, none of answers provided seem me: see in action here: http://jsfiddle.net/blam/bsqnj/2/ i have "dynamic" (percentage based) layout 2 columns. .grid { width: 100%; box-sizing: border-box; } .grid > * { box-sizing: border-box; margin: 0; } .grid .col50 { padding: 0 1.5%; float: left; width: 50%; } in each of these columns have table supposed use full column width. .data-table { width: 100%; } .data-table td { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } my problem of columns in table have content needs truncated fit in given width of table. not happen, though. 2 tables overlaying each other. requirements: needs percentage based. can't set absolute sizes. each rows' height must not grow beyond 1 text line (which happen if remove white-space: nowrap) must work in chrome, firefox , internet explorer 8+ can't display tables below each o...

Grails - How to use named queries inside Criteria -

i have case where, need use named query inside criteria. doesnt work! is possible use named query inside criteria? if yes how? you can't. but can use namedquery 1 class in namedquery of class. refer this jira issue . (mainly jeff's comment)

c# - Access To A Resource Text File Within My Application -

i building windows phone 8 application struggling following problem. although can access text files on computer , cannot access text file created in resource folder created in application. does know how access textfile in folder belongs application ande use streamreader read it? thank ! you use application.getresourcestream method passing in uri of file, in order access streamresourceinfo object returned, has stream property access (which can pass streamreader , on). as uri, depends on build action (from properties window) have set file, ie. whether resource or content. if it's resource, uri should be: new uri("/assemblyname;component/path/file.txt", urikind.relative); if it's content, uri should be: new uri("path/file.txt", urikind.relative); note 'assemblyname' name of assembly project contains file. , 'path' forwardslash-separated path file within project taking account folder , subfolders in.

Issue with GlobalExceptionHandler Sharepoint 2010 -

i have fatal error not know how solve,even after several days of trying. error have : "could not load file or assembly 'globalexceptionhandler, version=1.0.0.0, culture=neutral, publickeytoken=ed6585c9914bae60' or 1 of dependencies. system cannot find file specified." for more details: -i had never before seen error when deployed project encountered error cited above... -so ,after change, assume action mentioned before caused me error. -for this, executed orders @ "windows powershell" as: stsadm-o-name deletesolution solutionname.wsp remove solution completely. -after that, made sure project deployed ​​is no longer in server. -later, when logged the" sharepoint central administration" on port 24427. ,in hoping not see error anymore ,i saw error has not disappeared . so , no longer have access " sharepoint central administration",as error remains. i grateful proposal you. thank & sorry english. . please t...

c# - How to remove the null value exception in the following statement -

the following code raising null value exception record rec = (record)obj.records.where(x => x.id == no).singleordefault(); there 3 potential places nullreferenceexception occur ( edit: know id int ): obj.records if obj null records.where(...) if records null x.id in lambda if there null entry in obj.records enumerable (ie x in context null ). here wouldn't (assuming compiles): singleordefault throw exception if there more one entry. if there isn't, return null reference type, or default value value type. (record) casting. since there no compiler error, assume record class. if there value, throw exception if it's invalid cast (and not null exception). (record)null valid reference type. you should debug , step through find out causing exception.

ios - Allocate any mutable object with immutable class or vice versa -

this may sound pretty strange people.. went on ask this.. obviously, no 1 wants it.. make concept clearer, want ask. this: nsstring *mystring=[[nsstring alloc]init]; nsstring *mystring=[nsstring string]; as far understand, gives pointer object of nsstring class, but, if this: nsstring *mystring=[[nsmutablestring alloc]init]; nsstring *mystring=[nsmutablestring string]; if happens, kind of class "string" belong.. , since have initialized mutable class, can i send messages of nsmutablestring class "mystring", object of nsstring class ?? whatever case can know concept behind this.. also, can in case of arrays, dictionaries , many other calsses. yes. type of object 1 used alloc method. if allocated nsmutablestring, object member of nsmutablestring class. nsstring *mystring=[[nsmutablestring alloc]init]; what's going on it's have pointer allocated object type of it's parent class, compiler not see methods of nsmutablestring , warn...

arrays - How to display dynamic marker label info from database -

for past month or have been trying solve problem. checked website extensively, including tutorials find, , bought book. posted have had no luck. have more info help. have map in filemaker database. works fine, except 1 thing change. when roll on each marker see label show customers name, instead of static "marker 1", "marker 2", etc. included link dropbox has html, markersarray custom function , info that's passed html may needed. through trial , terror , can't figure out how make happen. or guidance appreciated. steve https://dl.dropboxusercontent.com/u/71328624/googlemapsdocs/html.txt https://dl.dropboxusercontent.com/u/71328624/googlemapsdocs/ss1geo.png instantiate variable calculates company name inside of loop. replace "marker" +i variable.