Posts

Showing posts from June, 2015

C# - Share Types Between Modular Parts Of Application -

(this not modularity between assemblies modularity between simple c# classes/objects) application ( c# ) can divided following parts: components (display results , stuff) worker classes work (other thread form or component) main form (agent between components , worker classes using events , delegates) components , worker classes don't have using dependencies other namespace or class except ones framework. can't use framework types anymore. need custom classes. how share custom types between parts of application without breaking modularity ? common techniques ? edit: i'm trying use simple types int , float , string , point , pointf , arrays of of them. need add time stamps, quality values, ... can't convert them because data handled components big , performance must-have

winforms - How to troubleshoot error while opening downloaded pdf file in C#? Windows Application -

in windows application, have pdf file stored in database. problem is, when try open pdf file, error adobe reader not open 'tem1.pdf' because either not supported file type or because file has been damaged but when open downloaded pdf normally, not give error. getting error when try open them through application. the code try open pdf files stored in database follows: private void lstbookparts_selectedindexchanged(object sender, eventargs e) { if (lstbookparts.selecteditems.count > 0) { wicommonfunction.loadcommonsettings(); showinformation showdata = new showinformation(); string item = lstbookparts.selecteditems[0].text; string book = bookname; calculatecount(book); dataset ds1 = showdata.showbookpdf(item); datatable dt1 = ds1.tables[0]; filestream fs = null; var index = lstbookparts.selectedindices; int32 = (int32)(index[0]

MySql/SQL Orderby and Condition -

i trying mysql/sql queries , learning tutorials complicated queries. below query runs mentioned result set not understandable. the query retrieves "2" highest paid employees each department. select deptno, empno, sal emp e 2 > ( select count(e1.sal) emp e1 e.deptno = e1.deptno , e.sal < e1.sal ) order 1,3 desc; but not able understand 2 > , order 1,3 in query.? so understand query have run cause query separately follows: select count(e1.sal) emp e1 e.deptno = '1'; the above query returned me count of deptno value '1'. so means each departments counted!! i not sure happens in e.sal < e1.sal ?? running recursively ?? calculate highest paid employees?? can 1 me in understanding query! if can understand above logic can understand logic of query below: 4th top salary of employees: select deptno, ename, sal emp 3 = (select count(b.sal) emp b a.sal < b.sal) order sal desc; sorry not

python - openCV Configuring incomplete, errors occurred -

i'm trying install python opencv being new python got error below , need know means (and maybe how solve)? i installed (mac running python 2.7 in virtualenv). sudo port selfupdate sudo port install opencv sudo port -v install opencv +python27 then: sudo pip install pyopencv ... , got error: error: -- configuring incomplete, errors occurred! configuring pyopencv via cmake... error: error occurred while running cmake configure pyopencv. may want manually configure pyopencv running cmake's tools: mkdir build cd build cmake-gui .. or cmake .. cd ..

iOS Objective-Zip corruption issues -

i using flyingdolphinstudio's objective-zip objective-c zipping library. using zip .txt file following answer given in this question . for case, not have array cycle through single file have following: zipfile *zipfile= [[zipfile alloc] initwithfilename:zip_file_name mode:zipfilemodecreate]; nsdictionary *attributes = [[nsfilemanager defaultmanager]attributesofitematpath:txt_file_name error:&error]; nsdate *date = [attributes objectforkey:nsfilecreationdate]; nsdata *filedata = [nsdata datawithcontentsoffile:txt_file_name]; zipwritestream *stream = [zipfile writefileinzipwithname:txt_file_name filedate:date compressionlevel:zipcompressionlevelbest]; [stream writedata:filedata]; [stream finishedwriting]; [zipfile close]; the zipping process seems work, .zip file correct name , non-zero size. however, when try , un-zip on mac, runs .cpgz loop. , judging this article , presume because file getting corrupted somewhere in there. when upload server , try open on linu

java - Android - Nesting Fragments No View Found -

i have 3 fragments , arranged shown below: "frag , frag c not connected, frag b , c are. each fragment contains 1 listview every time triggered event go next fragment." fragment ---> (inside frag a )fragment b ---> (inside frag b )fragment c fragment a(main.xml) fragment b(r.id.contentfragment) fragment c(r.id.contentfragment) i can display fragment , fragment b , okay, but if call fragment c b i got "no view found in contentfragment=0x7f040039" . main.xml <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/white" android:id="@+id/framelayout" >

javascript - Make AJAX GET query to a url and insert content returned to a div -

given url - how can make ajax query (on page load) url above , insert content returned in empty div tag on html page? <div id="ajax-result"></div> i have tried .load method jquery not working var url jquery(function($) { $('#ajax-result').load('url'); }); any ideas? due same origin policy , can't make ajax calls domain different of code. a possible solution proxy request through server side script on domain. you'd make ajax call own domain, invoke script request other domain via server server communication. third party give response server side script, in turn can pass response on through ajax response.

How to get a result of the correct class when concatenating data in R? -

i have found c , rbind class of result based on class of first argument. has caused problem me because presence of na first argument coerces date vectors numeric vectors. compare result of these 2 class calls: x <- sys.date() y <- na class(c(x, y)) # "date" class(c(y, x)) # "numeric" and likewise rbind : x <- data.frame(column=sys.date()) y <- data.frame(column=na) class(rbind(x, y)$column) # "date" class(rbind(y, x)$column) # "numeric" how can ensure result of these concatenations date vector, regardless of order of arguments? coerce first argument desired class: c(as.date(y), x) c(as.date(x), y)

java - Data not inserted to db -

i trying insert data db using spring,hibernate,jpa .but when try insert data not give errors. data has not been inserted well. ideas ? my persistence.xml <?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="guestbookpu" transaction-type="resource_local"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <class>com.sanja.test.mydao.entity.user</class> <properties> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.driver"/> <property name="hibernate.connection.password" value="welcome

LINQ get two records from each record -

i have list of objects of type: myobject .startdate .enddate .number for each object want return 2 objects of: newobject .date .number in in 1 object date enddate , number. other object date startdate , number negative number myobjects.selectmany(o => new[] { new newobject { date = o.enddate, number = o.number }, new newobject { date = o.startdate, number = -o.number } } );

regex - htaccess redirect from /foo/bar/ to foo.php?q=bar -

as question states have managed foo.php?q=bar /foo/bar ,using below rewritecond %{query_string} ^q=(.*)$ rewriterule ^foo\.php$ foo/%1? [r=301,l] how want /foo/bar redirected foo.php?q=bar while checking if foo = foo, file named dosearch exists , gets redirected dosearch/data now want see if /(.*)/(.*) that first match dosearch , if dosearch.php?q=$2 edit: this new htaccess keeps giving me "too many redirects" options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{query_string} ^q=(.*)$ rewriterule ^dosearch\.php$ dosearch/%1? [r=301,nc,l] rewriterule ^dosearch/([^/]+)? dosearch.php?q=$1 [nc,l] any appretiated guys...... hello think got following appends no query though there....if can point out...it nice. options +followsymlinks +multiviews rewriteengine on rewritebase / rewritecond %{the_request} ^[a-z]{3,9}\ /dosearch\.php\?q=(.*)\ http/ rewriterule ^dosearch\.php$ dosearch/%1? [r=302,l] rewriteru

xml - xs:integer validation issue with pattern restriction and canonical representation -

i have problem receive third party xml document according third party xml schema. schema uses pattern restriction on xs:integer element: <xs:simpletype name="numericinteger_length8to8"> <xs:annotation> <xs:documentation xml:lang="en">format limitations: n8</xs:documentation> </xs:annotation> <xs:restriction base="xs:integer"> <xs:pattern value="-?[0-9]{8,8}" /> </xs:restriction> </xs:simpletype> the xml received shows integers of 8 digits 1 or more leading digits zeros: <examplecode>01234567</examplecode> when parse xml valid matches pattern. next, have send out same xml text message again. xml renderer sends out canonical representation of integer, without leading zero: <examplecode>1234567</examplecode> the receiving system tries validate message sent , throws error value 1234567 no longer matches pattern restriction.

html - redirect after form submit jquery -

i have submit form target = _blank , redirect page other. html <form id="registration_form" name="registration_form" method="post" action="actionurl" target="_blank"> <input type="button" name="submit" id="submit" value="submit" /> </form> jquery $(document).ready( function() { $('#registration_form').submit( function(e) { var flag=validate(); if(flag) $(location).attr('href',redirectionurl); return flag; }); $("#submit").click(function(){ $('#registration_form').submit(); // triggers submit event }); }); if change button type submit form submitting per validation flag redirection doesn't work. if use button instead of submit redirection takes place form not submitting. where have been wrong. help. thank you. i think in hard way, since define target _blank, sub

Why doesn't this Java regex compile? -

i trying extract pass number strings of of following formats: passid_132 passid_64 pass_298 pass_16 for this, constructed following regex: pass[i]?[d]?_([\d]{2,3}) -and tested in eclipse's search dialog. worked fine. however, when use in code, doesn't match anything. here's code snippet: string idstring = filename.replaceall("pass[i]?[d]?_([\\d]{2,3})", "$1"); int result = integer.parseint(idstring); i tried java.util.regex.pattern.compile("pass[i]?[d]?_([\\d]{2,3})") in expressions window while debugging, says "", whereas java.util.regex.pattern.compile("pass[i]?[d]?_([0-9]{2,3})") compiled, didn't match anything. problem? there's nothing invalid tegex, sucks. don't need character classes around single character terms. try this: "pass(?:id)?_(\\d{2,3})"

perl - sprintf : fixed point, big numbers and precision loss -

i need read numbers in database , write them text file using perl. in table numbers, data format defined numeric (25,5) (it reads 25 digits, including 5 decimals). i format numbers in file sprintf "%.5f", $myvalue force 5 decimals , noticed greats values, there precision loss numbers more 17 digits : db = 123.12345 file = 123.12345 (ok) db = 12345678901234891.12345 file = 12345678901234892.00000 (seems rounded upper integer) db = 12345678901234567890.12345 file = 12345678901234567000.00000 (truncation ?) what perl's greatest precision fixed decimal numbers? i aware of concepts , limitations of floating point arithmetic in general, not perl monk , not know internals of perl don't know if normal (or if related @ floating point). not sure either if internal limitation of perl, or problem related sprintf processing. is there workaround or dedicated module problem? some notable points : this additional feature of system uses perl, using tool

java - Using gesture control -

im learning how use gesture builder recognize gestures , use them in development. this snippet of code : public void ongestureperformed(gestureoverlayview overlay, gesture gesture) { arraylist<prediction> predictions = olib.recognize(gesture); // want @ least 1 prediction final edittext et_text = (edittext) findviewbyid(r.id.edittext1); if (predictions.size() > 0) { prediction prediction = predictions.get(0); if (prediction.score > 0.1) { // work //toast.maketext(this, prediction.name, toast.length_short) //.show(); string s ="o"; if (prediction.name == s) { et_text.settext("o"); toast.maketext(this, "test", toast.length_short) .show(); } } } } i got gesture called o , idea when make gesture type o in edittext cant figure out why dosent ? it recognizes gesture in first

android - How to set alarm or push notification -

i trying make reminder application on android. have taken data user , saved in database. how trigger alarm or push notification on user entered date? to create push notification, have register on console api. can't post link , because of low reputation , own key. used tutorial create , handle push notification. http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ can't understand why need alarm user. implement alarm after elapsed time, can create service: http://developer.android.com/reference/android/app/service.html there can create own alarm or use 1 of standard. sorry, can't provide code example, because question general.

javascript - How do I get number of arrays from an object -

i have json webservice in following format. { name:['a','b'], name:['cd','ef'], age:{...}, address:{...} }. here have 2 arrays & 2 objects inside object , these (array & objects) numbers may vary. need is, how can number of arrays alone main object? there may exist way solve problem need code in .js (javascript file). when tried: object.keys(mainobject).length; it gives total count of array + objects in main object. var data = { name:['a','b'], othername:['cd','ef'], age:{a: 12}, address:{a: 'asdf'} } var numberofarrays = object.keys(data).filter(function(key) { return data[key] instanceof array; //or array.isarray(data[key]) if array created in frame }).length; alert(numberofarrays); note: won't work in older versions of ie jsfiddle to make work browsers don't support it, use shims mdn: object.keys array.filter

javascript - Why is my innerHTML is overwriting style properties of the parent class? and how do i solve this? -

im aron , im newbie javascript this problem: i'm trying create new content form input in html if enter many characters in form, new html doesn't break down @ right width. i hope explained correctly. here link site here javascript: function plaatsmagnet() { console.log('plaatsmagnet'); $('#magnetcontent').prepend('<div id="magnetjes" class="large-3 columns"></div>'); var textmagnet = $('#textmagnet').val() var naammagnet = $('#inhoud').val() var divtag = document.createelement("div"); divtag.id = "magnetje"; divtag.classname =" panel"; divtag.innerhtml = "<h5>" + (naammagnet) + "</h5>" + "<p>" + (textmagnet) + "</p>"; $('#magnetjes').append(divtag); }; i hope guys can me! :)

visual studio - CMake compiler identification unknown under Windows 7 64 bits only without admin rights -

i using cmake 2.8.10 , 2.8.11.2 under windows 7 64 bits machine. cmake installed administrator rights account. use visual studio 2008 professional. account has not administrator rights. cmake works when launch cmake generator "visual studio 9 2008". not work when launch cmake generator "visual studio 9 2008 win64". following error : "the cxx compiler identification unknown" , "the c compiler identification unknown" what strange if login administrator account, cmake works 2 generators above. how can make cmake work generator "visual studio 9 2008 win64" in case not have administrator rights ? thanks help. i having similar issue using cmake 2.8.12.1 , visual studio 2008 pro, 32 bit builds fine win64 not, here full call stack: cmake error @ c:/program files (x86)/cmake 2.8/share/cmake-2.8/modules/cmakedeterminecompilerid.cmake:446 (execute_process): execute_process given command argument no value. call stack (mos

C++ creating template specialisation in a typelist -

i have following struct: template<typename tag_type> struct tag{ typedef tag_type type; enum { value = -1 } }; i use class typeid identify specific classes @ runtime. each of these classes needs listed in typelist , each tag specialization needs have different value. is there way make value equal index of specialization in list. my goal make maintenance of list of specialized tag unique values easy possible... (i need make sure each type in list has unique value or part of system crash) edit: failed mention use values @ compile time... a non c++11 implementation of think mean, though not specify structure of typelist. template <typename h, typename t> struct typelist { typedef h head; typedef t tail; }; template <typename t, typename list, int n> struct typelist_index_i { typedef typename list::tail tail; enum { value = n + typelist_index_i<t, tail, n + 1>::value }; }; template <typename list, i

rendering - THREE.js independent colored particles -

i trying create particle system using three.js in each particle can have independent color (and size/scale). there example here http://threejsdoc.appspot.com/doc/three.js/examples/webgl_particles_billboards_colors.html is similar want do, api looks has changed, because not work latest three.js library. (e.g. color sethsv replaced sethsl). the following code uses typescript , jquery, idea: var w: number = 1000; var h: number = 1000; this.renderer = new three.webglrenderer({ antialias: true } ); this.renderer.setclearcolor(new three.color(0x222222), 1); this.renderer.setsize(w, h); this.control.append(this.renderer.domelement); this.scene = new three.scene(); this.camera = new three.perspectivecamera(50, w / h, 2, 3000); this.camera.position.set(0, 0, 3000); this.scene.add(this.camera); this.geometry = new three.geometry(); var vector: three.vector3; var texture: three.texture = three.imageutils.loadtexture("src/assets/ballflip.png"); var : number; var x

hibernate - Error SQL 979 with the group by -

i have problem java ee/hibernate application. query works in unit test, not in application. <named-query name="list.vacant.accessory"> <query>select proty, count(acc.id) producttype proty, accessory acc left join acc.producthistorylist phl phl.status 'en stock atos' , proty.id = acc.producttype.id , phl.statusdate = (select max(statusdate) producthistory ph ph.product=phl.product) group proty </query> </named-query> i have error : sql error: 979, sqlstate: 42000 ora-00979: not expression group by have idea ? thanks. i don't know hibernate mapping. purely query stand point: select proty, count(acc.id) producttype proty, accessory acc lef

Java- Interface makes use of an interface -

i'm studying code. 've found these 2 classes. don't understand how related. expression "t extends piecetype" mean, t stand for? piece.java: public interface piece<t extends piecetype> { /** * returns color. * @return color */ piececolor getcolor(); /** * returns type. * @return type */ t gettype(); } piecetype.java: public interface piecetype { /** * returns type's base rating. * @return base rating within range [0, 1000] */ double getrating(); } as mentioned, means type, t, pass piece must extend piecetype. here have interface extends piecetype: public interface newpiece extends piecetype { ... } you instantiate piece object doing this: piece<newpiece> apiece = new someimplementationofpiece<newpiece>(); because newpiece extends piecetype given in definition: public interface piece<t extends piecetype> { ... }

Workaround needed: webdriver/maven tests should run on each deploy in jenkins, but -

we have webdriver/testng/maven/java tests need run automatically after each deploy, been 4 days , cant damn thing work headlessly using xvfb. , not have access server, , jenkins configuration, other bugging poor guy operates these. so kind of workaround offer in case? can jenkins jobs on remote servers (say find server doesnt need run tests headlessly)? or there alternative xvfb? setup selenium tests use remote webdriver for info read here - http://code.google.com/p/selenium/wiki/remotewebdriver , http://docs.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-s-drivers update jeeny - "can jenkins jobs on remote servers (say find server doesnt need run tests headlessly)?" amey - "yes" but instead of running jenkins job on remote server, make selenium tests run on remote server. i assume initialize selenium webdriver browser instance command webdriver driver = new firefoxdriver(); change to driver = webdriver.remote("http://

php - Call to undefined function odbc_connect() message while connecting SAP Hana database -

i used odbc_connect() in php page connect hana database. works fine when run locally. upload same php page server , getting error: fatal error: call undefined function odbc_connect() the code: $connect = odbc_connect("team6datasource", "team6", "password1", sql_cur_use_odbc); team6datasource = datasource name. ip address = 54.217.234.218 can 1 please me? thanks i go through in google this instruction helpful you. download sql server odbc driver php client platform. (registration required.) if sql server odbc driver not available platform, check list of odbc-odbc bridge client platforms . odbc-odbc bridge an alternative sql server solution easysoft, can download site. install , license sql server odbc driver on machine php installed. installation instructions, see odbc driver documentation. refer documentation see environment variables need set (ld_library_path, libpath, ld_run_path, shlib_path depending on driver, plat

c# - Cannot fetch "birthday" field from Facebook in ASP.NET -

recently have decided integrate "log in facebook" feature on 1 of projects. seems work fine except 1 thing: no matter try, can't user's birthday. i've set application's permissions on facebook request "email" , "user_birthday", when log in facebook on project asked allow access basic data, 'friends list' , email - somehow, believe, fb confuses "user_birthday" "read_friendslist". can true or missing something? i using facebook c# sdk outercurve foundation of dotnetopenauth extension(s) in asp.net mvc 4 project. thank much! i made work using this tutorial. turns out sort of facebook bug, asking permissions explicitly made work. facebook javascript sdk worked fine me (i tried switch @ first).

google app engine - Implement reference field search feature using GAE/webapp2/Jinja2 -

i'm writing web application using googleappengine (gae), webapp2, jinja2 , twitter bootstrap. want manage objects may have location through web interface. i've got following location model (models/location.py): from google.appengine.ext import ndb class location(ndb.model): name = ndb.stringproperty(required=true) description = ndb.textproperty(required=false) address = ndb.stringproperty(required=false) latitude = ndb.floatproperty(required=false) longitude = ndb.floatproperty(required=false) i've got basic object model (models/object.py): from google.appengine.ext import ndb google.appengine.ext.ndb import polymodel location import location class object(polymodel.polymodel): name = ndb.stringproperty(required=true) description = ndb.textproperty(required=false) location = ndb.keyproperty(kind=location, required=false) position = ndb.stringproperty(required=false) i did create html template (templates/object-create.html)

Export javascript data to CSV file without server interaction -

if on nodejs server, write header, set mime type, , send it: res.header("content-disposition", "attachment;filename="+name+".csv"); res.type("text/csv"); res.send(200, csvstring); and because of headers, browser create download named csv file. when useful data generated in browser, 1 solution getting in csv file use ajax, upload server, (perhaps optionally save there) , server send these headers become csv download @ browser. however, 100% browser solution not involve ping-pong server. so occurred me 1 open new window , try set header meta tag equivalent. but doesn't work me in recent chrome. i new window, , contains csvstring, not act download. i guess expected either download in bottom tab or blank new window download in bottom tab. i'm wondering if meta tags correct or if other tags needed. is there way make work without punting server? jsfiddle creating csv in browser (not working - outputs window no down

javascript - Pass HTML table row to PHP via AJAX using POST -

i have page html table containing results query. next each row, have button that, when clicked, make lightbox appears small html form user can enter comment. when user clicks submit button on form, should send data contained in row (ie, each cell value array if that's possible) comment script, insert them in database. after done, small message saying appears, , user can go table lightbox disappears. my problem transmitting data php script process it. ajax javascript works alright, except don't know how send data. here code : function getoutput() { //get number of selected table row var = document.getelementbyid('rowclicked').value; //get table var table = document.getelementbyid('table'); //get comment var comm = document.getelementbyid('comment').value; var ajax = getrequest(); ajax.onreadystatechange = function(){ if(ajax.readystate == 4){ alert(ajax.responsetext); } } ajax.open("post",

sql - Generic function to append data into MS Access table using C# -

i have written function supposed insert 3 items ms access table using c#: public static void appenddatatotable(string connectionstring, string tablename, string[] headers, string[] values) { var myconn = new oledbconnection(connectionstring); var cmd = new oledbcommand("insert into" + tablename +" (x, y, z) values (@x, @y, @z)"); cmd.parameters.addrange(new[] { new oledbparameter(headers[0], values[0]), new oledbparameter(headers[1], values[1]), new oledbparameter(headers[2], values[2]) }); myconn.open(); cmd.executenonquery(); myconn.close(); } first, there seems mistake , cannot figure out what? second, possible make generic function if have 10 columns still works , dynamically resizes headers.length ? thanks! you not use sqlconnection / sqlcommand connect msaccess. use oledbconnection. correct , should work. can take of this link more information. you

c++ - Access array from Java-side -

i have method in java class called set field of class. field of type "char [] . try , access element of the char []` program crash. jni code: mid = env->getmethodid(cls,"setdata","([c)v"); env->callvoidmethod(obj,mid,myclass.data) //myclass.data: unsigned char data [8]; java code: public void setdata(char[] data2) { //data: char [] data = new char [8]; system.out.println("in method"); //"in method" printed console //data = data2.clone(); //i know im calling method correctly for(int = 0; < 8; i++){ data[i] = data2[i];} } i have made work, changing signature of method: //jni side mid = env->getmethodid(cls,"setdata","(cccccccc)v"); env->callvoidmethod(obj,mid,myclass.data[0],myclass.data[1],myclass.data[2],myclass.data[3],myclass.data[4], myclass.data[5],myclass.data[6],myclass.data[7]); //java side public void setdata(char c1,char c2,char c3,char

php - Regular expression for a redirect -

i'm trying write regular expression redirect , not having luck. in example, old url might exist this: example.com/about-us/default.asp example.com/the-team/default.asp which want redirect to: example.com/about-us/ example.com/the-team/ i've come this: /(\d*)/default.asp which doesn't work... i've tried this: /(\d*)/default\.asp as thought there might problem not having escape char '.', still no luck. can see i'm doing wrong? got working minitech pointed out: /(.*)/default.asp$ worked treat! thanks

SQL server bulk insert identity column -

i trying bulk insert table has identity column.but host file contains empty value identity column.when issue 'bcp' command,i error - starting copy... sqlstate = s1000, nativeerror = 0 error = [microsoft][sql server native client 10.0]unexpected eof encountered in bcp data-file sqlstate = 23000, nativeerror = 515 error = [microsoft][sql server native client 10.0][sql server]cannot insert value null column 'unique_id', table 'xx.dbo.yyy'; column not allow nulls. insert fails. sqlstate = 01000, nativeerror = 3621 warning = [microsoft][sql server native client 10.0][sql server]the statement ha s been terminated. bcp copy in failed if dont give empty value identity column,then error - unexpected eof encountered in bcp data-file. please in getting bcp work bulk insert table.. although suggest bulk insert data staging table first , insert data main table staging table. way can preserve identity co

zsh - How to disable table key in iTerm2 -

i using zsh , iterm2. use tab -key when want autocomplete command. if there no command autocompleted, cursor move forward not want. so there way disable cursor moves forward when no command can autocompeleted, thanks. the behaviour of tab on empty line can configured zstyle insert-tab : zstyle ':completion:*' insert-tab <val> where <val> can be true [ default ]: insert tab character false : perform completion (completion list contains commands) pending or pending=val : insert tab character if there unprocessed input (pasting text), otherwise perform completion so if don't want insert tab, can set false: zstyle ':completion:*' insert-tab false

Running Gradle plugin directly from command line -

in maven, if wanted analyze project sonar, do: mvn sonar:sonar using 'short' plugin name , goal. in gradle, there similar way run plugins, without declaring them in build.gradle script? there isn't currently, there @ point. can apply plugin out-of-band (in init.gradle ).

woocommerce: how to add new fields to variations form and show them on frontend -

using last versions of wordpress, woocommerce , cheope (theme). question: how to add fields in variations form (text , image field types) show them on frontend values change accordingly on changing of attributes-select values. e.g.: site sells candles , uses variable products, each kind of candle has several dimensions (with specific different prices), each of has different duration. duration important element want user informed about. same show available colors together. unluckily in standard variation form there no field can insert these or other features. please? updated 07-august-2013 succeeded in adding variations form new field displayed on back-end, can see here , inserting code can find here (please see comments too) in function.php file of theme. now, i’m not able field display each proper value on front-end (please take last comment in above linked page). tip or trick? thanks 1)add product attribute , check checkbox used variations , visible on produc

What is the difference between ".scan" and ".split" in Ruby language? -

this question has answer here: difference between string.scan , string.split 1 answer what difference between ".scan" , ".split" in ruby language? can give me example? i got confused it! scan extracts substrings match given regex. split extracts substrings not match given regex (and optionally, substrings match well).

mysql - in Rails, database call works in development but stalls in test -

i running test controller method shown below: it "should assigns instance var @items including item" @item = factorygirl.create(:item) :index response.should include(@item) end the controller method is: def index @item = item.select_items end where select_items scope method in items model: scope :select_items, where(items.arel_table[:select_field].not_eq(nil)) in development, works fine. in test however, a 500 error when test controller method in console no error when test model method in console a permanent hang when run spec in test.log, hang happens @ last line of following: connecting database specified database.yml admin load (0.5ms) select `admins`.* `admins` (0.6ms) release savepoint active_record_1 (0.2ms) savepoint active_record_1 sql (1.1ms) insert `items` (`various fields') (0.1ms) release savepoint active_record_1 processing admin::itemscontroller#index html admin load (0.4ms) select `admins`.* `admins`

html - style first child of <UL> (not sub <ul> without adding ID's or Classes) -

**thank answers. waiting on cache plugin removed before can test , confirm everythign working correctly. i have unordered list contains sublist. want update children of main <ul> "names" , "jobs" <ul> <li>names <ul> <li>mike</li> <li>bob</li> <li>steve</li> </ul> </li> <li>jobs <ul> <li>police</li> <li>fire fighter</li> <li>banker</li> </ul> </li> </ul> i want ability style child <li> 's of main <ul> not of sub items. trick can not add classes or id's list or sublist. can put whole thing in containing div. *note if add class or id add of them. premade template have no control over. i thinking this: <div id="mylist_container"> <ul> <li>na

javascript - Simplifying a jQuery functions -

i wondering method of simplifying script, because somehow repeating myself on again... $('.userprofile').click(function(){ card_profile.load(url_settings).dialog('open'); }); $('.cust-profile').click(function(){ card_profile.load(url_customer).dialog('open'); }); $('.my-profile').click(function(){ card_profile.load(url_my).dialog('open'); }); var obj = { '.userprofile' : url_settings, '.cust-profile': url_customer, '.my-profile' : url_my }; $.each(obj, function(sel, url) { $(sel).click(function(){ card_profile.load(url).dialog('open'); }); }); or $(".userprofile,.cust-profile,.my-profile").click(function() { var url = $(this).hasclass("userprofile") ? url_settings : $(this).hasclass("cust-profile") ? url_customer : url_my; card_profile.load(url)

c++ - Confusing outcome of C conditional operator -

int a=1,b=2,c=3; int x=1; int y=10; = x ? b : c; cout<< a; // outputs 2 (the value of b) = y ? b : c; cout<< a; // outputs 2 (the value of b) now, @ following. a=0; x=0; = x ? b : c; cout<< a; // outputs 3 (the value of c !!!!) why unusual behaviour ?? when , x both 0, expression evaluates false , otherwise, true . please explain. because x 0. recall ternary operator, if written condition ? : b returns a if condition true , b otherwise. using numbers, , number except 0 considered true boolean. x ? b : c in case 0 ? 2 : 3 , , since 0 false , evaluates 3. 3 gets assigned a variable , printed - nothing unusual going on here.

html - how to toggle particular field with same id or class? -

Image
the 'comment' field has 'id' , 'class', can't give unique 'id' because coming database (dynamic output). have tried 'toggle' (hide , show) jquery, when click particular 'comment' field of form (textarea) appearing (toggling). how toggle particular field same id or class? $(".commentform").hide(); $(".askforcomment").click(function(){ $(".commentform").toggle(); }); <div id='comments'> <div id='askforcomment' class='askforcomment'>comments?</div> <div id='viewcomments'></div> <form id='commentform' class='commentform'> <textarea cols='20' rows='2'></textarea> <input type='button'> </form> </div><!-- element looped (dynamic) --> you should target specific .commentform here : $(".askforcomment").cli

jquery - Apply x-editable for new appended td's -

i have table fields can add dynamically table data via jquery. problem elements add aren't having properties i've set group of td's until reload entire page , don't know has triggered take action new ones. here code: #js file function add_task() { task_name = $("#task-name").val(); due_date = $("#task-due_date").val(); var new_task = $.ajax({ url: "/add_task/", data: "task="+task_name+"&due_date="+due_date, success: function(task_id){ get_task(task_id); } }); } function get_task(task_id) { $.ajax({ url: "/get_task/"+task_id+"/", //get html single_task.html success: function(result){ $('#container').append(result); $('#task-'+task_id).fadein(500); } }); } #single_task.html <tr id="task-{{task.id}}"> <td><div id="task"> <a href="#" data-type="text" dat

c# - Retrieving records from table where a column may have multiple rows of data -

i have database several tables , using following query return record matches string(name). in mhp table there name field(primary key), num_sites , few more, these ones concerned with. in mhp_parcel_info table there many fields 1 of them being name(foreign key) . there parcel_id field , in case there may 1 parcel 1 name, there may many parcels name. as query return 1 of rows instances there multiple parcels name. what is: if there more 1 parcel name, have parcels put list(so can display in listbox on form). my sql skills limited , don’t know how go doing this. select mhp_parcel_info.*, mhp.num_sites mhp_parcel_info inner join mhp on " + "(mhp_parcel_info.mhp_name = mhp.mhp_name) mhp_parcel_info.mhp_name='" + strvalue + "'" this not can directly in sql. there's no way select data in parent/child structure in sql query - have post-processing step. since tagged c# , winforms i'm assuming inside .n

emacs - Using org-mode link attachment method, Windows 7 -

i want avoid copying/moving every file want attach attachment directory because redundant, or forces me use directory central project directory. might want attach useful reference entirely different folder. question is, there way use linking attachment method on windows 7 in emacs org-mode?

cassandra - Difference between Thrift and CQL 3 Columns/Rows -

at cassandra summit, mentioned thrift , cql 3 have subtle differences in definitions of columns , rows. google hasn't helped me understand difference. information can find metadata different, , such, shouldn't mix thrift , cql. what subtle difference (i've read bit metadata representations...)? in way break compatibility? why change better? i'm happy read docs me, i've been unable find related topic. here's reading path taught follow answer same question: intro apache cassandra 1.2 a thrift cql3 upgrade guide cql3 cassandra experts : datastax does cql support dynamic columns / wide rows?

javascript - Rotating 2D Vector by unknown angle such that its direction vector is [1,0] -

i trying rotate vector [x,y] around origin such when rotation completed lies on x axis. in order this, i'm first computing angle between [x,y] , [1,0] , applying simple 2d rotation matrix it. i'm using numericjs work vectors. math.anglebetween = function(a, b) { var x = numeric.dot(a, b) / (numeric.norm2(a) * numeric.norm2(b)); if(math.abs(x) <= 1) { return math.acos(x); } else { throw "bad input anglebetween";

c# - Creating custom attributes for methods that has specific signature -

i created simple class has attributeusage attribute. when tried build got error: attribute 'attributeusage' valid on classes derived system.attribute . then made class inherits attribute , fine. if use attributeusage attribute forces me inherit attribute class. question can make attribute forces methods have specific signature? thanks help! if understand correctly: looking tool controls compilation attributes. may check if stylecop or fxcop fit needs. alternatively might extend visual studio access source code model. extension may check source code (see http://blogs.msdn.com/b/sqlserverstorageengine/archive/2007/03/02/using-visual-studio-s-code-model-objects-for-code-base-understanding.aspx ), evaluates attributes , generate compiler warnings, errors whatever like. =================================== original answer: answer: have provide corresponding constructor [attributeusage(attributetargets.all)] public class helpattribute : system.attribute

javascript - How to get an image to not vanish even when the page refreshes -

so have button, , when clicked image shown, if page refreshed image disappears, , don't want that. how image stay when page refreshes. here image show function: <script> function showimage() { $("#loadingimage").show(); }; </script> and here button: <input name="failure analysis lab" style="white-space:normal;" onclick="movetext(this.name);showimage();form1.submit() " style="width: 272px; height: 30px;" type="button" value="7qkd failure analysis lab" /> you can use sessionstorage this. in init: var isimage = sessionstorage.getitem('isimage'); if (isimage !== null) showimage(); function showimage() { sessionstorage.setitem('isimage', '1'); $("#loadingimage").show(); }; if image has been shown value stored in temporary storage (will erased when browser closed - if want permanent use localstorage ins

java - translating bytes from korean to utf-8, what am I not getting here? -

there incomplete understanding here. if run code below, expect see: translatetest:: start start_korean: (6) c0 af c8 f1 c8 c6 expected_utf8: (6) c7 20 d7 6c d6 c8 found_utf8: (6) c7 20 d7 6c d6 c8 expected utf8 matches found? true what is: translatetest:: start start_korean: (6) c0 af c8 f1 c8 c6 expected_utf8: (6) c7 20 d7 6c d6 c8 found_utf8: (9) ec 9c a0 ed 9d ac ed 9b 88 expected utf8 matches found? false i think creating string, declaring bytes x-windows-949, , getting bytes utf-8 translate them 1 other. apparently, not correct this. public class translatetest { public static void main (string [] argv) { (new translatetest()).translate(); } void translate() { system.out.println("translatetest:: start"); try { // pages below linked http://msdn.microsoft.com/en-us/goglobal/cc305154 // please ignore lame bytestohex helper method. including completeness. // http://msdn.microsoft.com/en-us/goglo

browser - Check if Internet Connection Exists with Javascript? -

this question has answer here: detect internet connection offline? 13 answers how check if there internet connection using javascript? way have conditionals saying "use google cached version of jquery during production, use either or local version during development, depending on internet connection". the best option specific case might be: right before close </body> tag: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script>window.jquery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> this easiest way given issue centered around jquery. if wanted more robust solution try: var online = navigator.online; read more w3c's spec on offline web apps , aware work best in modern web browser

Javascript(gameQuery game) how can I get the next bottom element in the tilemap? -

how can next bottom element (id, class) of selected tile without loop through whole tilemap? e.g.: tile $('.gq_tiletype_4') rock in game , should fall down if next bottom tile $('.gq_tiletype_8') space is. loop throug whole tilemap , compare elements against there xy coordinates. think wrong way, because game performance slowing down. gamequery gives unique id each tiles constructed in following way: $.gamequery.tileidprefix+name+"_"+row+"_"+column this means if tilemap called "foo" can access tile @ position (a,b) writing: $("#"+$.gamequery.tileidprefi+"foo_"+a+"_"+b); in same way can deduce position (index-wise) of tile parsing it's id. means given tile can find it's position , probe state of tile bellow. how ever i'm not sure using tile-maps best solution since not supposed change. @ moment shouldn't cause problems cannot guaranty in future version wont break functions