Posts

Showing posts from January, 2013

PySide (1.1.2), cx_freeze, WinXP, Python 3.3: ImportError: DLL load failed -

i trying freeze python 3.3 code uses pyside libs using cx_freeze , of on windows xp (x86, sp2/3). the python setup.py build runs executable throws importerror : importerror: dll load failed: application has failed start because application configuration incorrect. reinstalling [...] the same builds run fine on windows 7 x64 (sp1). the versions using follows: python 3.3.0 (v3.3.0:bd8afb90ebf2, sep 29 2012, 10:55:48) [msc v.1600 32 bit (intel)] on win32 cx_freeze-4.3.1.win32-py3.3 pyside-1.1.2.win32-py3.3 both qt dll libraries copied build folder ( qtcore.dll , qtgui.dll ), library-zip contains both .pyc equivalents in pyside folder/module. this issue occurs simplest test-code ( and if code run on "live" python installation well *): from pyside import qtcore, qtgui if __name__ == "__main__": app = qtgui.qapplication("my application") win = qtgui.qmainwindow() win.show() app.exec_() using more up-to-date versio...

javascript - How to get the value of data-* attribute in knockout js -

i'm new knockout js , have came across issue in following lines of code <input type="checkbox" value="true" data-bind =" attr: { id: 'chk' + action.id, value: id, 'data-id': action.id }, checked: $root.checked" name="checkbox" class="checkbox"> i have added data-id , wanna value in knockout view model. how can knockout js var id = action.id(); check http://jsfiddle.net/yaroslavya/xd6ej/1/ . clicking different save buttons different action.id value. value connected data-id attribute.

Concatenation in JavaScript -

my code this var call_from='fb_test' jquery('.test').html("<img src=\"https://wwww.socialappshq.com/images/socialapps/loading.gif\" height=\"15\" width=\"15\" id=\"loading_image_\" + call_from + \">"); but it, not correctly concatenate please me when write html using javascript, prefer ' enclose strings , " enclose attribute values var call_from='fb_test' jquery('.test').html('<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '">');

android - What rendering technology is GrabCad Mobile App using? -

i wondering kind of rendering engine grabcad using visualization purpose mobile apps. 3d models rendered nicely. they have rolled out both ios , android apps. my hunch have built viewer directly on top of opengl if using commercial engine hoops or else great know.

kml - gx:Track updates and time slider in Google Earth Plugin -

my goal periodically update position of track, rendered in google earth plugin. using gwt-based web app , servlet produces kml updates. first create placemark <gx:track/> , specific id, push <create/> elements new <when/> , <gx:coord/> - similar how done here . updates fetched ge plugin , see time slider updated - time span longer each time update occurs. however, ge not show latest position, have move slider manually see recent position. there way force ge automatically? thinking of using <gx:multitrack/> , read somewhere it's not supported plugin. appreciated.. wish there more documentation on using networklinkcontrol updates <gx:track/> , i've been able find random forum posts. why don't update time using this var newtime = // time/date of update var timestamp = ge.createtimestamp(''); timestamp.getwhen().set(newtime); ge.gettime().settimeprimitive(timestamp);

java - How to get selected rows from a database into a jTable? -

i have database table has many patient details registration id, registration date etc. want perform date based search of patients , result jtable. ( example, if type 23-05-2013 registration date, patients admitted on 23 may should displayed in jtable. how do that? this code have used: public void gettabledata() { try { con = getconnection.getcon(); string sql = "select * patientrecords registration date = ?"; pst.setstring(1, regdate.gettext()); pst = con.preparestatement(sql); rs = pst.executequery(); if (rs.next()) { patient_table.setmodel(dbutils.resultsettotablemodel(rs)); } } catch (sqlexception e) { joptionpane.showmessagedialog(null, e); } } 1) should make own tablemodel implementation or extending abstracttablemodel 2) map patientrecords object world. entity name should in singular. have java-bean patientrecord . 3) you'll have list<patientrecord> data dataholder. fill while (...

javascript - calling a java script file type -

i noticed programmers use 2 ways of calling .js file. 1- way must have js file: <script src="lib/jquery.js" type="text/javascript"></script> 2- , way don't need js file : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script> and want know way better use. the first option using local files, second option using cdn. a cdn group of fast servers several common use files. useful save bandwidth , speed download of site. however, mentioned, have problems if end user don't have access internet. basically, if expect application executed online, cdn great option. if developing app executed offline (like crm company) better served using local files. if cdn down, website broke. more website down cdn.

c++ - Copying a std::string to char* -

this question has answer here: how convert std::string const char* or char*? 8 answers i trying create copy of std::string char*. function , seen result: void main() { std::string test1; std::cout << "enter data1" << std::endl; std::cin >> test1; char* test2; test2 = (char*)test1.c_str(); std::cout << "test1: "<< &test1 << std::endl; std::cout << "test2: "<< &test2 << std::endl; } enter data1 check test1: 0x7fff81d26900 test2: 0x7fff81d26908 i unsure if copy has been created or both of them pointing same location. how confirm this? you copying adress , using c cast in c++ use strdup instead char* test2; test2 = strdup(test1.c_str()); //free after or char *test2 = malloc(strlen(test1.c_str())); strcpy(test2, test1.c_str());

php curl how not to use the system hosts file for name resolution? -

because of security reasons,the system limit curl destination domains.for example ,a.xxxx.com in collection of safe domains.but ip address of domain not safe domain.that leads: $ch = curl_init('http:// 172.16.139.216:81'); //is fobbiden $ch = curl_init('http:// a.xxxx.com:81'); //is ok now want domain "a.xxxx.com" pointing other ip address. not have root permission of machine,i can't modify /etc/hosts . wanna in php script, there way? thx much.

eclipse - The attribute lookup is undefined for the annotation type Resource -

giving jms first shot, when try inject @resource(lookup="jms/connectionfactory") , error: the attribute lookup undefined annotation type resource i read how use java ee 6 @resource annotation , haven't study maven yet, wondering, if can fix issue other way rather using maven? i'm using eclipse way. the right fix right-click project in eclipse, java build path -> order , exports, select jre system library , click on bottom.

how to configure selenium(webdriver)framework under eclipse -

i have readymade framework selenium(webdriver)(datadrievnfreamework). please tell me how configure framework under eclipse . please me out put efforts search in google. kindly refer eclipse guide setting environment. basic setup, refer: http://selftechy.com/2011/03/18/selenium-setting-up-selenium-eclipse for parameterization, refer: http://diveintotesting.com/2013/02/23/parameterizing-selenium-webdriver-tests-using-testng-a-data-driven-approach/ for further coding using webdriver, refer: https://code.google.com/p/selenium/wiki/gettingstarted

Debugging unit tests run on cmd line using Eclipse -

i have large project has many dependencies, result, won't able build on eclipse. using maven , can build project on command line. know how run unit tests on command line. my question is possible debug unit tests running on command line using eclipse? the maven surefire plugin allows remote debugging of unit tests. you need call maven using following command: mvn -dmaven.surefire.debug test the tests automatically pause , await remote debugger on port 5005. can attach running tests using eclipse. can setup "remote java application" launch configuration via menu command "run" > "open debug dialog..."

Options for systat (iostat/sar) in cygwin? -

going through cygwin's search , cannot find linux sysstat apps (e.g., iostat or sar). searching web, found old messages of people unsuccessfully trying compile sysstat source on cygwin. has succeeded in adding sysstat apps cygwin? environment: cygwin_nt-6.1 t43 1.7.22(0.268/5/3) 2013-07-22 17:06 i686 cygwin on windows 7

plsql - Dont know how to solve a maybe infinitfe loop (Tree) -

i have problem. have element , list of elements, connected first 1 in way. want check, elements of list children of first. save result in array. pick first child , children. save , on , on , on. problem is, dont know exact number of relations. have many many loops , searches. need program every single loop , array (to save to) or there better way? edit: iam talking db tables. have 2 tables. want check children (data in table2) every element in table1. start loop in table1. elements in table 1 , table2 connected coordinates xy. iam searching elements in table2 table1_element1.xy == table2.xy. result there n children. want save them , start children new loop find every child children based on coordinates. save new result on , on. more clear? thank you. this problem can solved of recursion. in case termination condition when node don't have relation in list or when reach end of list storing children. thanks

python - How to remove certain characters from a list? -

suppose have list list = ['1a', 'gb', '3c', 'gd'] is there way remove second character of each character pair in list? thus producing... ['1', 'b', 'c', 'd'] this should it: [item[0] item in list]

ruby on rails - Where is the default "Welcome Aboard" page located in my app? -

i scoured app's directories, , can't find html page default rails welcome aboard page. cannot find route default welcome aboard page in routes.rb. how rails app route http://localhost:3000/ non-existent page in app? the rails server produces information: started "/" 127.0.0.1 @ 2013-07-31 02:00:13 -0600 processing rails::welcomecontroller#index html rendered /users/7stud/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/templates/rails/welcome/index.html.erb (0.1ms) completed 200 ok in 3ms (views: 2.5ms | activerecord: 0.0ms) so looks me there controller buried in gem somewhere handles request. since rails 4, "welcome aboard" page no longer located in public/index.html . - you've detected - located inside 1 of rails gems. so answered question yourself; "welcome aboard" page - in case - located @ /users/7stud/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/te...

classloader - MyClassLoader.defineClass java.lang.SecurityException: Prohibited package name: java.lang -

i try extend classloader. classloader.loadclass is: protected synchronized class<?> loadclass(string name, boolean resolve) throws classnotfoundexception {// put "throw"s here clean code below class<?> result = null; byte[] bytes = null; try { bytes = getclassfromfs(pathtoclass); //get .class file file system in bytes[] } catch (filenotfoundexception ex) { logger.getlogger(myloader.class.getname()).log(level.severe, null, ex); } catch (ioexception ex) { logger.getlogger(myloader.class.getname()).log(level.severe, null, ex); } system.out.println("myloader:мой loadclass загружает класс"); return defineclass(name, bytes, 0, bytes.length); // proplem here !!! return super.loadclass(name, resolve); } lines in "main" thread /*first argument - path file. file exist, checked it*/ myclassload...

symfony - How do I get the entity that represents the current user on a PHP template? -

as answered on question how entity represents current user in symfony2? shows how on controller, how do actual user entity on php template without having send on parameter template? the far was: $app->getsession()->getusername(); but gave raw var user name, want user entity . you can use $app->getuser() in php template , app.user in twig template. see: http://symfony.com/doc/current/book/security.html

set asp.net dropdown selected value with jquery -

i have code should work fine setting selected value on asp.net dropdownlist reason doesn't want work in case although works in other projects i've been working on. dropdown: <asp:dropdownlist id="ddlperc" runat="server"> <asp:listitem value="">select percentage</asp:listitem> <asp:listitem value="0.01">0.01</asp:listitem> <asp:listitem value="0.05">0.05</asp:listitem> <asp:listitem value="0.1">0.1</asp:listitem> <asp:listitem value="0.15">0.15</asp:listitem> <asp:listitem value="0.2">0.2</asp:listitem> <asp:listitem value="0.25">0.25</asp:listitem> <asp:listi...

c# - how to call my dll and use it in powershell script -

i have own dll written in c#. want call powershell script. did following; [system.reflection.assembly]::loadfile("e:\myclass.dll") $mycompobj = new-object myclass.student but when executing that, giving me error constructor not found. cannot find appropriate constructor type myclass.student am following wrong way this?? please me fix this. your class has got constructors (at least one). create object params $mycompobj = new-object myclass.student -argumentlist "arg1","arg2" ...

Copy excel cell data to ppt textbox -

i'm new macro. have excel sheet has names in column a. have ppt many slides. need macro in excel take these names, create textbox in each slide , paste there 1 one. like, "a1" value should go slide 1, "a2" value should go slide 2... can in this. thanks for automating excel within ppt or vice versa, visit faq site, http://www.pptfaq.com , search main page references naresh (that'd naresh nichani, wrote , allowed me include series of articles describing how pull data excel or access). study code provided in articles learn how pull data excel. then start single slide presentation nothing text box on first slide. if need more complex this, ask. sub makebradburyslides() ' you'd actuall fill array excel sheet ' demonstration purposes: dim adata(1 5) string adata(1) = "something" adata(2) = "wicked" adata(3) = "this" adata(4) = "way" adata(5) = "comes...

java - Custom RunTime Exceptions -

so regarding interview question asked. interviewer started on asking me how create our custom exceptions. on answering that, asked me how i'd create runtimeexceptions. said we'd create them in same way create checked exceptions. our custom exception extend runtimeexception class. asked in scenarios create own runtimeexception. couldn't think of answer that. in none of projects, created custom runtimeexceptions. i think should never create runtimeexceptions. jvm can fail in finite number of ways , handles them well. while writing application can't predict runtime exceptions can occur , hence shouldn't need handle them. , if can predict conditions, aren't runtimeexceptions then. since neither need new runtime exceptions, nor need handling of runtimeexceptions, why ever need create custom runtimeexception. can pre-think of possible failure condition should handled @ compile time , checked exception. right? things cannot handled @ compile time , ones depend on...

WPF Simple Binding to INotifyPropertyChanged Object -

i've created simplest binding. textbox bound object in code behind. event though - textbox remains empty. the window's datacontext set, , binding path present. can what's wrong? xaml <window x:class="anecdotes.simplebinding" x:name="mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="simplebinding" height="300" width="300" datacontext="mainwindow"> <grid> <textbox text="{binding path=bookname, elementname=thebook}" /> </grid> </window> code behind public partial class simplebinding : window { public book thebook; public simplebinding() { thebook = new book() { bookname = "the mythical man month" }; initializecomponent(); } } ...

c# - Gridview keep search while paging -

i have textbox write word search in gridview. research works first page of gridview, when go page research resets. here code : using system; using system.data; using system.configuration; using system.text.regularexpressions; using system.web; using system.text; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using system.data.sqlclient; using system.collections; using system.collections.generic; using system.io.compression; using system.io; public partial class _default : page { protected void page_load(object sender, eventargs e) { if (!ispostback) { this.binddata(); } } private void binddata() { string query = "select * ressources"; sqlcommand cmd = new sqlcommand(query); gridview1.datasource = getdata(cmd); gridview1.databind(); } private datatable g...

android - how to add one more linearlayout in my code? -

how expend linearlayout 3 button follow tutorial expend linearlayout 1 button add 1 more button how code not run follow answer how create expendable layout on each node simple add 1 more linearlayout whats worng inmy code me please <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <scrollview android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:id="@+id/llcontains" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation=...

javascript - Comparison to -1 or undefined don t work, either with == or === -

here sample of code: do { line=gets(smil); if (line===-1){console.log("abort");callback(-1);} console.log("line= "+line); }while(line.search("<video")===-1); the first output goes well, suddenly, get line= -1 typeerror: object -1 has no method 'search' gets custom function, wich return either string or -1 in case of error. i tried == instead of ===, same. i tried replace return -1 of gets undefined, get line= undefined typeerror: cannot call method 'search' of undefined instead. why if don t execute? edit: tried with var pline { pline=gets(smil); if (pline===-1){console.log("abort");callback(-1);} console.log("line= "+pline); }while(pline.search("<video")===-1); to avoid overriding variable, got same result it's two-fer question. 1st - you're overwriting variable line right after do . that's why you're getting uncaught typeerr...

esb - How can I share global elements between mule flows -

i'm starting out mule , noticed mflow files tend rather large , if use visual view in mule studio it's hard take in. read somewhere put each flow in different file , flows deployed , can call each other. the problem created own custom transformer want use in 2 different flows. if declare global custom transformer in each file error saying name exists. so tried , placed custom transformer in own mflow file , works in runtime problem mule studio doesn't seem understand @ "compile time" , mflow files riddled errors stating "reference unknown global element". how can import global elements 1 mflow file mule studio stops complaining. maybe isn't correct way @ all. if i'd happy know how achieve goal in other way. thanks in advance this known issue studio whereby doesn't recognise global elements in other config files still runs application fine: https://www.mulesoft.org/jira/browse/studio-1881 this should fixed in version 3.4...

.net - Unity BuildUp without DependencyAttribute -

i've got third party library returning class instace. it's out of cotrol want use unity inyect in public properties. can not add dependecyattribute properties because class not partial nor inheritalbe, wondering if can use unity xml configuration inyection. is possible use unity's xml configuration configure build dependencies? if answer yes. how configure xml it? i've tried: <register type="iservice" mapto="service"> <!--service has public constructor--> </register> <!--thirdpartyobj has no interface , no public constructor--> <register type="thirdpartyobj " mapto="thirdpartyobj"> <!-- inject property "service" --> <property name="service" /> //type of property iservice </register> this config work if unity resolve thidpartyobj buy not working in builup (null reference in service property) , can not resolve thirdpartyobj because has ...

Trigger Tab activate function - JQuery UI Tabs -

i run problem. html snippet looks this <div id="maintab"> <ul> <li><a href='#tabs-1'>tabgroup1</a></li> <li><a href='#tabs-2'>tabgroup2</a></li> </ul> <div id='tabs-1'> <a onclick="showsubtab1tab2();">showsubtab1tab2</a> <a onclick="showsubtab2tab2();>showsubtab2tab2</a> </div> <div id='tabs-2'> <!-- first sub tab --> <div id="subtab1"> <ul> <li><a href='#tabs-3'>tabgroup3</a></li> <li><a href='#tabs-4'>tabgroup4</a></li> </ul> <div id='tabs-3'> </div> <div id='tabs-4'> </div> ...

JQuery/Javascript HTTP POST not working in IE or Firefox -

i'm struggling getting http post work in firefox , ie, it works in chrome. here current code: $(function () { $('.scpracticetest').on('click', function (e) { var guid = jquery.guid.new(); var testcode = $(this).attr('testcode'); $.support.cors = true; $.ajax({ type : 'post', url: 'https://sc-practice.content.saville.int/sites/api/integration/savillelegacy/createcandidate.ashx', contenttype: 'application/x-www-form-urlencoded', data: { clientid: "4d102b05-8949-4b04-a87a-59ac5a88fc65", username: "practiceintegration", password: "practiceintegration", givenname: guid, familyname: guid, culturecode: "en-gb"}, success: function (data) { ...

multithreading - accessing dynamically created form elements from a thread in vb.net -

i new vb , .net , have task unable proceed. i start thread when screen1 loads. user goes screen2. on screen2 thread still running behind. when user performs action(say click) on screen2, trigger thread access elements on screen2 the elements in screen 2 dynamically created , not designed in ide. so in essence thread created on 1 form needs access dynamically created form elements on form. if question simple, please forgive me. if not clear please let me know , rephrase it. note: element talking picture box inside flow layout panel. thanks in advance eagerly(biting nails now) awaited , appreciated. edit lets thread called ctthread started in dashboard screen ctthread.start() this thread running endlessly, waiting trigger event. meanwhile user has gone screen called quizscreen , on screen(form) have update dynamically created elements names know. so when time right ctthread waiting (listener thread) call sub below. sub public sub changecomputerstatus(byva...

sql - Why cant I use GROUP BY in this Query -

when executed following query in ms sql management studio produced error. query: select u.username, r.rolename user u join userrole ur on ur.userid = u.userid join role r on r.roleid = ur.roleid group r.rolename error: msg 8120, level 16, state 1, line 2 column 'user.username' invalid in select list because not contained in either aggregate function or group clause. its been while had used sql , supposed basic command. still cant figure out reason. note: there no error if use group r.rolename, u.username this demonstrates single-value rule , prohibits undefined results when run group by query, , include columns in select-list neither part of grouping criteria, nor appear in aggregate functions (sum, min, max, etc.) . hope u understand. group by i dont know may want this.. select distinct u.username, r.rolename user u join userrole ur on ur.userid = u.userid join role r on r.roleid = ur.roleid

Magento - use pretty URL rather than query string params -

i using querystring params load video media in template file, , url looks this: http://mysite.com/?step=5&vid=1 the way map url template file standard way in cms, ie, in cms pages add url key 'steps' , route in /var/www/simplesteps/site/src/app/code/local/mage/page/etc/config.xml maps template .phtml file in /template/page/ i use urls without querystring params, like: http://mysite.com/step5/vid1 , or http://mysite.com/site/5/vid/1 whichever structure not matter parse request myself params inside template file. how can achieve url can still through same template file? if use magento, , standard controller/action path thing, can achieve : http://www.mysite.com/module/controller/action/param1/value/param2/value ex. http://www.mysite.com/company/video/view/step/5/video/1 then in controller function, can retrieve these params $_get value : $this->getrequest()->getparam('step'); or $this->getrequest()->getparam('video...

php - Merge two rows with different date but with the same attributes -

i have query select te.user_name, left(te.entry_datetime, 10) entry_date, cin.entry_datetime timein, cout.entry_datetime timeout time_entries te left join (select user_name, left(entry_datetime, 10) entry_date, min(entry_datetime) entry_datetime time_entries entry_type = 'time in' group user_name, entry_date ) cin on cin.user_name = te.user_name , cin.entry_date = left(te.entry_datetime, 10) left join (select user_name, left(entry_datetime, 10) entry_date, max(entry_datetime) entry_datetime time_entries entry_type = 'time out' group user_name, entry_date ) cout on cout.user_name = te.user_name , cout.entry_date = left(te.entry_datetime, 10) group te.user_name, entry_date; this output sqlfiddle user_name| entry_date | timein | timeout user1 | 28-jul-13 | 16:40:40 | 16:42:30 user2 | 28-jul-13 | 16:41:13 | 16:41:15 but found loop hole in solution, employees works overnight , time-out following day. when user let tim...

highcharts - Add hide all series to line chart -

i have line chart number of series elements on it. the chart allow me click each series in legend hide add item when clicked hides of series lines chart. can explain how achieve please? thanks add button or like. follow example fiddle highcharts own. http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/series-hide/ var chart = $('#container').highcharts(), $button = $('#button'); $button.click(function() { var series = chart.series[0]; if (series.visible) { series.hide(); $button.html('show series'); } else { series.show(); $button.html('hide series'); } }

How to send audio from ios and store in mysql using php? -

i have send audio file , ios app , store in mysql using php.i have converted audio file base64string , sent server.the problem can store few bytes of data in database. nsurl *aurl = [nsurl urlwithstring:@"url"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:aurl cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60.0]; [request sethttpmethod:@"post"]; nsstring *poststring = [nsstring stringwithformat:@"audiostring=%@,",audiostr]; [request sethttpbody:[poststring datausingencoding:nsutf8stringencoding]]; nsurlconnection *connection = [[nsurlconnection alloc] initwithrequest:request delegate:self]; if(!connection){ nslog(@"connection failed"); } if($_post["audiostring"]) { $sql="insert audiodetails (audiostring)values('$_post[audiostring]')"; $result=mysql_query($sql) or die(mysql_error()); } ab...

insert - MySQL how to take data from one column and put to another column under same ID and same table -

i have table products 3 columns id merchant selected (empty column) 1 roger 2 anthony 3 maria 4 joseph 5 serge i want make query (syntax wrong, idea explain try do) select * merchant '%thon%' products.merchant insert products.selected but place same id row, result should this id merchant selected 1 roger 2 anthony anthony 3 maria 4 joseph 5 serge would obliged hint how make such trick ! the query of @kickstart , @daghan correct: update products set selected = merchant merchant '%thon%' but have suggestion structure of table,if want make on of row selected, can change type of select column tinyint or boolean , table this: id merchant selected 1 roger 2 anthony 1 3 maria 4 joseph 5 serge this write easier query, , final query sth : update products set selected = 1 merchant '%thon%'

c++ - Converting void* to vector<int> -

i have function named deserialize takes input: int(*cmp)(void*,void*) so, function of type can taken parameter function. for example, if have point structure this: typedef struct{ int x, y; }point; now, cmp function this: int point_cmp(void* _p1, void* _p2){ point* p1=(point*)_p1; point* p2=(point*)_p2; return (!((p1->x==p2->x) && (p1->y==p2->y))); } this works. but want vector. i want write vector_cmp function can passed point_cmp deserialize. so, have tried thing it, wrong: int vector_int_cmp(void* _v1, void* _v2){ vector<int> *v1 = vector<int> *_v1; vector<int> *v2 = vector<int> *_v2; auto diff = 0; auto v1_it = v1->begin(); auto v2_it = v2->begin(); while(v1_it != v1->end() && v2_int != v2->end()){ if(*v1_it != *v2_it) diff++; v1_it++; v2_it++; } if(0 == diff && (v1_it != v1->end() || v2_it != v2->end())) diff =...

php - major difference between url rewriting and hiding url -

after of researching confused difference between url rewriting,pretty url , hiding url ...though 3 performs same functionality, difference between these 3 things?which useful seo ? seeing url can identify whether hiding url or url rewriting? you seem have been confused numerous terms have been used in articles , tutorials have read. hopefully out somewhat: pretty url : this called search-engine friendly url (because that's is), , like: users/benmajor/profile/ google places lot of weighting on url page accessed with, it's idea follow pattern. url rewriting : actual technology used convert pretty url system counterpart. example, using apache's mod_rewrite module, can convert users/benmajor/profile profile.php?user=benmajor using following rewriterule : rewriterule ^users/[(.*)]/profile/?$ profile.php?user=$1 url hiding : one's little more difficult answer, since don't know context in used, i'm going assume term means hide system url (i...

iphone - Add colors on MKMapView -

Image
i doing project contains mapview. need change of mapview adding different color on mapview. know can add route, circle etc on mapview.i attaching image below. if knows please give me hint how possible. appreciated. thank much.

javascript - How to make the user save a text box value as an image or file to their machine in html5 using jQuery -

what best way make user save text box value out use of server side scripting . using html5 , jquery . tried printing textbox putting inside iframe print() function of javascript , worked , want know whether other alternatives available .

javascript - How to set id to a <tr> generated from a JSON response? -

i want set id's dynamically rows. have this: function (json) { (var ib = 0; ib < json.length; ib++) { var tableib = document.getelementbyid("treatments"); var treatmentid = json[ib].id; var rowib = tableib.insertrow(-1); var cell1ib = rowib.insertcell(0); var cell2ib = rowib.insertcell(1); var cell3ib = rowib.insertcell(2); var cell4ib = rowib.insertcell(3); var cell5ib = rowib.insertcell(4); var buttonid = json[ib].id; cell1ib.innerhtml = json[ib].name; cell2ib.innerhtml = json[ib].time; cell3ib.innerhtml = json[ib].price + "kr"; cell4ib.innerhtml = json[ib].details; cell5ib.innerhtml = "button"; } }); the id want set json response , has variable buttonid . possible or should append each row this? : $('#treatments').append("<tr><td...

asp.net mvc - Conditional validation on model in MVC -

i have view & model use both edit , insert page record. 1 of business requirements field required on edit not on new. before particular feature added docket, had model so: [required(errormessage = "*")] [range(0.0, (double)decimal.maxvalue)] [displayname("cost")] [displayformat(dataformatstring = "{0:d}", applyformatineditmode = true)] public decimal proposedcost { get; set; } i either remove required property if insert form, or add if edit form. better approach? other validation done above. or can alter model state? thoughts? edit something should clarify still permitted insert cost on new, not required. if you're on mvc3/.net4, can use ivalidatableobject exists such purposes. quoting scottgu , ...the ivalidatableobject interface enables perform model-level validation, , enables provide validation error messages specific state of overall model.... you model like public class myviewmodel : ivalidatableobject { ...

Convert C realloc to Delphi -

int stackrealloc(stack* s){ if ((s->array = realloc(s->array,sizeof(int)*(s->size)*2)) != null){ s->size = (s->size)*2; return 1; } else return 0; } how can convert code( c ) delphi ( delphi7 ) ? the delphi function analagous c realloc reallocmem . you could, if wished, make literal translation of c struct delphi record, , call reallocmem . in delphi use dynamic array instead of raw pointers: var arr: array of integer; ... setlength(arr, length(arr)*2); there's no need struct contains both array , size because delphi dynamic array keeps track of own length. what's more not signal errors using 0 or 1 return value. instead not write explicit error checking in code , let runtime raise exception should call setlength fail. since appear implementing stack, use tstack class found in contnrs unit. in modern delphi use generics.collections.tstack<integer> instead. as aside, c code broken. fails handle errors correc...

Connection property has not been initialized c# -

im getting when execute non query .. calling executenonquery.... clsconnection.executenonquery("add_customers", commandtype.storedprocedure, paramlist); exception pop @ cmd.connection.open(); this whole executenonquery public static void executenonquery(string sql, commandtype type, list<sqlparameter> paramlist) try { dataaccess.clsconnection clsdb = new dataaccess.clsconnection(); using (sqlconnection cn =clsdb.opencon()) { sqlcommand cmd = new sqlcommand(); cmd = createcommand(sql, type, paramlist); cmd.connection = cn; cmd.commandtype = type; cmd.commandtext = sql; cmd.executenonquery(); } you don't assign connection object command when sqlcommand executes query needs open connection. first step search connection property see if has been initialized. property null , erro...

excel - Summing rows condition on two columns -

Image
i'd use array function conditional sum based on 2 columns. given example, each id want calculate sum of value column if column b -1 . id | b | value | ________________________ 1 a1 1 2 2 a2 1 3 3 a3 1 4 4 a3 -1 5 5 a3 -1 1 6 a2 1 5 7 a1 1 1 8 a2 -1 2 the outcome should be: id | value_total | ________________________ 1 a1 1 0 2 a2 1 2 3 a3 1 6 this gives outcome show example data: edit seems have ‘done trick’, explanation: =sumifs syntax sumifs(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...) so in case formula summing columnd values in corresponding row columnb value whatever happens in columnb row containing formula , columnc value -1 . the answer not repeat column unique values of id because 3 distinct ids shown in example and, conveniently, these first 3 , in order.

sql server - Slow SQL 2008 Cursor Performance - Index scan/seek -

Image
i have found interesting "issue" when using ado driver sql server 2008 (or rather when using specific sql cursors created driver). want execute following query: select id, televeid, teldayid, telmobid, qualityflag, weekbegin cef (televeid = '+44xxxx') or (teldayid = '+44xxxxx') or (telmobid = '+44xxxx') order id desc where there (for sake of example) 3 indexed on cef table tuples [id; televeid], [id; teldayid], , [id; telmobid] the query above "translated" driver in following way: declare @p1 int declare @p2 int declare @p5 int set @p5=4 declare @p6 int set @p6=4 declare @p7 int set @p7=-1 exec sp_cursorprepexec @p1 output,@p2 output,null,n'select id, televeid, teldayid, telmobid, qualityflag, weekbegin cef (televeid = ''+44xxxx'') or (teldayid = ''+44xxxx'') or (telmobid = ''+44xxxx'') order id desc',@p5 output,@p6 output,@p7 output exec sp_cursorfetch @p2,2,1,10 the pro...