Posts

Showing posts from January, 2015

python - How to write to cloudstorage using task chaining, The blobstore Files API did a nice job -

python - How to write to cloudstorage using task chaining, The blobstore Files API did a nice job - using blobstore file api, write very big blobfiles: create blobfile read info datastore , write (append) blobstore file pass datastore page cursor , blobstore file (next) task ....use other tasks same purpose and finalize blobstore file now gae gcs client cannot append , finalize. how write big files gcs without compose. compose not part of gcs client. files api still works fine, has been deprecated. below blobstore solution using task chaining: class blobdata(webapp2.requesthandler): def post(self): page = int(self.request.get('page', default_value='0')) info = data.get_data(.....) blob_file = self.request.get('blobfile', default_value='none') if blob_file == 'none': file_name = files.blobstore.create(mime_type='text/...', ...

regex - How to repeat a block of lines using awk? -

regex - How to repeat a block of lines using awk? - i'm trying repeat block of lines avobe occurs word number of times inticated in line. block of lines repeat have smaller number @ start of line. i mean, input: 01 patient-treatments. 05 patient-name pic x(30). 05 patient-ss-number pic 9(9). 05 number-of-treatments pic 99 comp-3. 05 treatment-history occurs 2. 10 treatment-date occurs 3. 15 treatment-day pic 99. 15 treatment-month pic 99. 15 treatment-year pic 9(4). 10 treating-physician pic x(30). 10 treatment-code pic 99. 05 hello pic x(9). 05 stack occurs 2. 10 overflow pic x(99). this output: 01 patient-treatments. 05 patient-name pic x(30). 05 patient-ss-number pic 9(9). 05 number-of-treatments pic 99 comp-3. 05 treatment-history occurs 2. 10 treatmen...

SQL Server seed value lower than max identity -

SQL Server seed value lower than max identity - i have table contains a column, integer, specified auto-incrementing primary key. create table [dbo].[table] ( [tablekey] [int] identity(1,1) not replication not null, [...] constraint [pk_tablekey] primary key clustered ( [tablekey] asc ) ( pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on, fillfactor = 80 ) on [primary] ) on [primary] this table has been having anywhere 0 - 7000 records inserted m-f, without issue. lastly fri ~4k records inserted identity values starting @ 2,064,682 , ending @ 2,068,076. morning received error... violation of primary key constraint 'pk_tablekey'. cannot insert duplicate key in object 'dbo.table'. duplicate key value (2067844). after going downwards lot of wrong paths found current seed table 2067845 . my...

javascript - Parallax background effect with ScrollTo and Localscroll -

javascript - Parallax background effect with ScrollTo and Localscroll - i have looked around hours trying figure out. have site built jsfiddle. <div id="window"> <div id="section-wrapper"> <div id="one" class="section"><p>one</p> </div> <div id="two" class="section"><p>two</p> </div> <div id="three" class="section"><p>three</p> </div> <div id="four" class="section"><p>four</p> </div> <div id="five" class="section"><p>five</p> </div> <div id="six" class="section"><p>six</p> </div> <div id="seven" class="section"><p>seven</p> </div> <div id="eight" class=...

vim - Can I somehow add my own info to the status line via vimscript -

vim - Can I somehow add my own info to the status line via vimscript - can somehow add together own info status line via vimscript? need create plugin update value in status line after time. thanks in advance. the 'statusline' alternative configures shown in status line. can add together value of arbitrary vimscript expressions via %{expr} syntax, e.g.: :set statusline+=\ %{localtime()} note gets invoked frequently, shouldn't much processing. alternatively, insert (buffer-local) variable, , utilize other means ( :autocmd ) update variable value when necessary. if plan create plugin reusable, improve not straight mess 'statusline' option, offer (global or autoload) function , instructions users include in personal alternative value. vim

VBA Getting program names and task ID of running processes -

VBA Getting program names and task ID of running processes - how programme names , task ids of running processes. shell() returns task id of initiated process. similar, task id , name of processes running , not created macro. i've found code returns programs names output lacks task ids info : http://www.vbaexpress.com/forum/archive/index.php/t-36677.html sub test_allrunningapps() dim apps() variant apps() = allrunningapps range("a1").resize(ubound(apps), 1).value2 = worksheetfunction.transpose(apps) range("a:a").columns.autofit end sub 'similar to: http://msdn.microsoft.com/en-us/library/aa393618%28vs.85%29.aspx public function allrunningapps() variant dim strcomputer string dim objservices object, objprocessset object, process object dim odic object, a() variant set odic = createobject("scripting.dictionary") strcomputer = "." set objservices = getobject("winmgmts:\\" _ ...

java - How to Make an HTTP POST with JSON object as data? -

java - How to Make an HTTP POST with JSON object as data? - can refer me single, simple resource explaining how in java create http post json object data? want able without using apache http client. the next i've done far. trying figure out how modify json. public class httppostrequestwithsocket { public void sendrequest(){ seek { string params = urlencoder.encode("param1", "utf-8") + "=" + urlencoder.encode("value1", "utf-8"); params += "&" + urlencoder.encode("param2", "utf-8") + "=" + urlencoder.encode("value2", "utf-8"); string hostname = "nameofthewebsite.com"; int port = 80; inetaddress addr = inetaddress.getbyname(hostname); socket socket = new socket(addr, port); string path = "/nameofapp"; ...

python - Replace HTML tags preserving their content using lxml -

python - Replace HTML tags preserving their content using lxml - i have html content (without html, body , head etc. tags). need strip style info tags , replace div tags p tags. i striping style info using: from lxml.html.clean import cleaner homecoming cleaner(style=true).clean_html(html) how can replace div tags p tags while preserving content of div tags (content of div tags should in new p tags). html = html.replace("<div>", "<p>") html = html.replace("</div>", "</p>") you full-blown html parsing , generating, above ok this. python lxml

osx - How to design a NSDatePicker that looks like Reminder's style? -

osx - How to design a NSDatePicker that looks like Reminder's style? - i want utilize date picker select date, saw style in reminder, how obtain style using nsdatepicker. helping! osx cocoa user-interface

java - sum(1/prime[i]^2) >= 1? -

java - sum(1/prime[i]^2) >= 1? - while trying devise algorithm, stumbled upon question. it's not homework. let p_i = array of first primes. need smallest i such that sum<n=0..i> 1 / (p_i[n]*p_i[n]) >= 1. (if such i exists). an approximation i 'th prime i*log(i) . tried in java: public static viod main(string args[]) { double sum = 0.0; long = 2; while(sum<1.0) { sum += 1.0 / (i*math.log(i)*i*math.log(i)); i++; } system.out.println(i+": "+sum); } however above doesn't finish because converges 0.7. 1/100000000^2 rounds 0.0 in java, that's why doesn't work. same reason doesn't work if replace 6th line with sum += 1.0 / (i*i) while should reach 1 if i'm not mistaken, because sum should incease faster 1/2^i , latter converges 1 . in other words, shows java rounding causes sum not reach 1 . think minimum i of problem should exist. on maths side of question, no...

c# - Convert hexadecimal string to an integer -

c# - Convert hexadecimal string to an integer - int value = convert.toint32('o'); byte[] b = new byte[] { ( byte)value }; file.writeallbytes(default.projectspath , b); when open file displays o , want write byte value file? remove the 0x convert: int = convert.toint32("0xfe".substring(2), 16); c# hex

node.js - Sequelize migration without file -

node.js - Sequelize migration without file - is there way utilize sequelize migrator without specified file? add/remove column in postgre database without using adding file , using custom method in javascript. posted issue on github, , responded quickly. node.js database-migration sequelize.js

c# - Windows Forms - How to break execution of currently executing code -

c# - Windows Forms - How to break execution of currently executing code - i have abstract windows form called addeditreminderform containing, amongst others, event handler , method: buttonsave_click performvalidations here relevant code addeditreminderform: protected virtual void buttonsave_click(object sender, eventargs e) { title = textboxtitle.text; description = textboxdescription.text; place = textboxplace.text; date = datepicker.value.date; time = timepicker.value.timeofday; performvalidations(); } protected void performvalidations() { if (string.isnullorempty(title)) { messagebox.show("error: title field left empty!"); return; } if (string.isnullorempty(description)) { messagebox.show("error: description field left empty!"); return; } if (string.isnullorempty(place)) { messagebox.show("error: place field left empty!"); return; ...

c# - How to delete specific entries from a table using Linq? -

c# - How to delete specific entries from a table using Linq? - class programme { static void main(string[] args) { pricingdemoentities demo = new pricingdemoentities(); var output = (from result in demo.demotables result.value == "array" select result).tolist(); output.removeall(x = > x.value == "array"); demo.savechanges(); } i want delete entries in table value = "array" using linq alone. tried in above way. values deleted in list not updated table. please suggest solution .![enter image description here][1] you not removing them db , doing modify output list has nil db context. foreach(var entry in output) demo.demotables.remove(entry); demo.savechanges(); in add-on should utilize using statement dispose dbcontext . using(var demo = new pricingdemoentities()) { ... } c# linq

c++11 - C++ when are typedefs in standard library containers not what you would expect? -

c++11 - C++ when are typedefs in standard library containers not what you would expect? - for standard library container types typedefs within container not naively think? in code, under conditions on type t , container container_type next static checks not evaluate true: typedef double t; typedef std::vector<t> container_type; std::is_same<typename container_type::value_type, t>::value; std::is_same<typename container_type::reference, t&>::value; std::is_same<typename container_type::const_reference, t const&>::value; std::is_same<typename container_type::pointer, t*>::value; std::is_same<typename container_type::const_pointer, t const*>::value; i know of std::vector<bool>::reference not bool& (and same const version thereof). are there others? for container containing objects of type t , standard (c++11 23.2.1/4) requires that: container_type::value_type t container_type::reference lvalue ...

python - How to add multiple elements in a list together by index? -

python - How to add multiple elements in a list together by index? - how add together elements of list index (simple math)? for example: a = 123456789 b = a[0] + a[2] + a[6] #does not work print (b) however, want sort of outcome: b == 11 you need larn python's types. first, want treat numbers string, create string literal: a = '123456789' now need coerce each part of string that's selected integer, int : b = int(a[0]) + int(a[2]) + int(a[6]) #works! you can store string list, don't have coerce ints each one: a = [1,2,3,4,5,6,7,8,9] or a = range(1,10) # in python 2 = list(range(1,10)) # in python 3 then b = a[0] + a[2] + a[6] print(b) prints 11 and should homecoming true b == 11 python list elements

javascript - Why does "(" cause a regex not to match? -

javascript - Why does "(" cause a regex not to match? - i have next string: var foo = "{(y-7)}({x + d})" var find = "{(y-7)}"; var replacement = "12"; var re = new regexp(find, 'g'); foo = foo.replace(re, replacement); but results in exact same string, without changes. but, if remove parens i.e "(" , ")" expression, seems work. why why won't match when expressions contain "("? characters have special meaning in regular look needs escaped. escape them putting backslash in front end of them, , set backslash in string need escape putting backslash in front end of it: var find = "\\{\\(y-7\\)\\}"; (in situations characters doesn't need escaping in regular expression, because can understood without it, start escaping characters have special meaning, can read on exact situations not needed.) demo: class="snippet-code-js lang-js prettyprint-override...

mysql - How to roll over time past 24:00 -

mysql - How to roll over time past 24:00 - i want @ add together 12 hrs time 430pm(16:30) when so, instead of going 04:30 going 28:30 how roll on 00:00 , 04:30. select addtime('16:00:00', '12:00:00'); you can add together random date time i.e 2014-01-01 16:30:00 , utilize combination of addtime , date_format function. first step adding 12 hours 2014-01-01 16:30:00 below select addtime('2014-01-01 16:30:00', '0 12:0:0'); the result of above syntax 2014-01-02 04:30:00 , need take time part of result select date_format('2014-01-02 04:30:00', '%h:%i:%s'); so 04:30:00 expected. below combined syntax of above produces same result select date_format(addtime('2014-01-01 16:30:00', '0 12:0:0'), '%h:%i:%s'); sql fiddle demo mysql time

c# - How can I send hyperlink to a person via Email? -

c# - How can I send hyperlink to a person via Email? - i trying send url through mail service embedded hyperlink not seem work in anyway. there solution send hyperlink help of emailtask? c# windows-phone-8

node.js - Store timestamp each users in sorted set Redis -

node.js - Store timestamp each users in sorted set Redis - i have little code: add id: redis.zadd('onlineusers', time, id, function (err, response) { //todo }); is right way save current timestamp user him id? delete id key: db.zrem('onlineusers', data.id); also, how multiple values sorted set keys: 1,2,3 is right way save current timestamp user him id? yes you can scores of multiple values using multi. function getscores(setkey, values, callback) { var multi = db.multi(); for(var i=0; i<values.length; ++i) { multi.zscore(setkey, values[i]); } multi.exec(callback); } usage getscores('onlineusers', [1,2,3], function(err, scores) { console.log(err, scores); }); node.js redis

How can I make Django search in multiple fields using QuerySets and MySql "Full Text Search"? -

How can I make Django search in multiple fields using QuerySets and MySql "Full Text Search"? - i'm django novice, trying create "search" form project using mysql myisam engine. far, manage form work, django doesn't seem search fields same way. results random. exemple: search in region returns no result or worst search in description works fine while howtogetin doesn't seem apply.. here model: class camp(models.model): owner = models.onetoonefield(user) name = models.charfield(max_length=100) description = models.textfield() address1 = models.charfield(max_length=128) address2 = models.charfield(max_length=128) zipcode = models.charfield(max_length=128) part = models.charfield(max_length=128) country = models.charfield(max_length=128) phone = models.charfield(max_length=60) howtogetin = models.textfield() def __str__(self): homecoming self.name here view: def campsearch(request):...

html - html5 video element, start and end times -

html - html5 video element, start and end times - i have html5 video element. <video id="video" loop="loop"> <source src="src.mov"> </video> i want start @ time in video (lets say... 10 seconds) , @ time (27 seconds) i know can in javascript, want in html. there start / end time tag video element? you can specify playback range appending start , end times source url. the times should in format: #t=[starttime][,endtime] from mdn: the playback range portion of media element uri specification added gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6). here's illustration play video, starting sec 2 , ending @ sec 3: class="snippet-code-html lang-html prettyprint-override"> <video controls autoplay> <source src=http://techslides.com/demos/sample-videos/small.webm#t=2,3 type=video/webm> <source src=http://techslides.com/demos/sample-videos/small.ogv...

jquery - Prevent tab content display in bootstrap 3? -

jquery - Prevent tab content display in bootstrap 3? - i using bootstrap , bootbox plugin, , have code here link plugin http://bootboxjs.com/#download i showing nex tab info attribute, need when user click on sec display bootbox alert , prevent sec tab show if check button not check? html <div class="tab-content"> <div class="tab-pane fade in active" id="step-1"> <p>first</p> <p><input type="checkbox" name="user" value="user">i not robot</p> </div> <div class="tab-pane fade" id="step-2"> <p>second</p> </div> </div> <a class="pull-left" data-toggle="tab" href="#step-1">first</a> <a class="pull-right" data-toggle="tab" href="#step-2">second</a> js $("a").click(function() { ...

converting regular javascript implementation to ruby on rails javascript implementation -

converting regular javascript implementation to ruby on rails javascript implementation - i have next code in regular index.html <!doctype html> <html lang="en"> <head> <title>template</title> <!-- bootstrap core css --> <link href="assets/css/bootstrap.css" rel="stylesheet"> <!--external css--> <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" /> <!-- custom styles template --> <link href="assets/css/style.css" rel="stylesheet"> <link href="assets/css/style-responsive.css" rel="stylesheet"> </head> <body> <!-- bunch of other code..... --> <!-- want ! --> <!-- js placed @ end of document pages load faster --> <script src="assets/js/jquery.js"></script> <script src="assets/js/...

responsive design - CSS: center element between floating elements -

responsive design - CSS: center element between floating elements - pretty simple question, can't seem find solution. have 5 elements: 2 floating left, 2 floating right. 5th element supposed in perfect center of div (#infographic), no matter screen width is. example: 1,2 -- 3 -- 4,5 or 1,2 ----- 3 ----- 4,5 html code: <div id="infographic"> <div class="icon-one"></div> <p>me</p> <div class="arrows"></div> <p>customer</p> <div class="icon-two"></div> </div> any suggestions element in center? i guess output looking : demo class="snippet-code-css lang-css prettyprint-override"> html, body,p{ margin:0; padding:0; } #infographic * { width:10%; height:30px; background:teal; padding:0; margin:0 1%; } #infographic .icon-one, #infographic .icon-one + p { float:left; } #infograph...

makefile - How do I change output of C program without editing it? -

makefile - How do I change output of C program without editing it? - this question has reply here: replace #define x macro value 1 specified in compilation command 1 reply how can edit executable during compiling, without changing source? [duplicate] 2 answers i have c programme not allowed edit looks this: #include <stdio.h> #ifndef year #define year "2013" #endif int main(){ printf("hello world " year "\n"); homecoming 0; } i need create makefile compile programme , alter year 2014, output "hello world 2014" without editing c program. how can this? the compilation command should start gcc -wall -dyear='"2014"' . code makefile suitable cflags settings. this answer should inspirational. ...

CSS animate text to image -

CSS animate text to image - the effect i'm looking obtain user first sees hint text without arrow , text shrinks downwards 0% width , see arrow instead. container should have plenty space barely fit text within of little bit of padding. don't know if explained enough. container shrinks fit size of content , content changes text image after amount of time. here html below. <a href="javascript:void(0);" class="scrolldownarrow"> <div class="relative"> <div class="hint"> <p>skip next section</p> <img src="assets/img/"insert arrow img here".png" /> </div> </div> </a> css *{ padding:0; margin:0; } .hint { display: block; height: 38px; line-height: 34px; text-align: center; border:2px solid #f6473e; border-radius: 20px; -o-border-radius: 20px; -moz-border-radius:...

asp.net mvc - Detect if Page was redirected from RedirectToAction() method -

asp.net mvc - Detect if Page was redirected from RedirectToAction() method - here actionresult methods : [httpget] public actionresult index(string cityid, string numbers, int days, bool onlyspecial) { lasttwoparameters lasttwoparameters = new lasttwoparameters(); lasttwoparameters.listcities = common.getdropdowncitieslist(); lasttwoparameters.listlasttworesult = new list<getreport_lasttwo_result>(); // if ispostback , execute if (!string.isnullorempty(cityid) && days > 0) { using (kqxs context = new kqxs()) { lasttwoparameters.listlasttworesult = context.getreport_lasttwo(cityid, numbers, days, onlyspecial).tolist(); } } homecoming view(lasttwoparameters); } [httppost]//run action method on form submission public actionresult index(list<cities> listcities, string cityid, string numbers, int days, bool onlyspeci...

android - MediaPlayer throws IOException for wav file -

android - MediaPlayer throws IOException for wav file - i have sound recording app on android, , i've encountered unusual issue on friend's phone. one of recordings did not work , throws: e/mediaplayer-jni(5996): qcmediaplayer mediaplayer not nowadays e/mediaplayer(5996): unable create media player e/com.audiorec.player.mediaplayer(5996): setdatasourcefd failed.: status=0x80000000 e/com.audiorec.player.mediaplayer(5996): java.io.ioexception: setdatasourcefd failed.: status=0x80000000 but playing success on windows media player, vlc player, etc !!!!!!!!! could take on header of "recordingnotok.wav" file? here both recordings for recordingnotok.wav file, sounds specified size of info chunk bigger file size: 00 f8 0a 00 in little endian 718848 bytes while whole file size 716844 , actual info size available chunk 716800 this number can found here (3rd line after 'data'): 52 49 46 46 24 f0 0a 00 57 41 56 45 66 6d 74 20 riff $...

ios - My view is not responding to setFrame if it is hidden -

ios - My view is not responding to setFrame if it is hidden - i had submit button set hiding. when seek adjust frame of it, can't seem move? (the reason create assumption because keyboard covers bottom half of screen , seek automatically adjust button if keyboard up) so hacky prepare have code running in keyboard listener: if (self.submitbutton.ishidden) { self.submitbutton.hidden = no; self.submitbutton.frame = cgrectsety(self.submitbutton.frame, cgrectgetheight(self.view.frame) - button_full_height); self.submitbutton.hidden = yes; } else { self.submitbutton.frame = cgrectsety(self.submitbutton.frame, cgrectgetheight(self.view.frame) - button_full_height); } is correct? you should register receive uikeyboardwillshownotification notifications. these notifications contain frame of keyboard on userinfo using key uikeyboardframeenduserinfokey . here, can move submitbutton avoid keyboard. ios

java - Why is it not enough to change just nextNode in this data structure? -

java - Why is it not enough to change just nextNode in this data structure? - in next info structure public class listnode<t> { t data; listnode<t> nextnode; listnode(t object) { this(object, null); } listnode(t object, listnode<t> node) { info = object; nextnode = node; } public t getdata() { homecoming data; } public listnode<t> getnextnode() { homecoming nextnode; } } public class list<t> { private listnode<t> firstnode; private listnode<t> lastnode; private string name; public list() { this("list"); } public list(string listname) { name = listname; firstnode = lastnode = null; } public void insertatfront(t insertitem) { if(isempty()) firstnode = lastnode = new listnode<t>(insertitem); else firstnode = new listnode<t>(insertitem, firstnode); ...

position - Python "Option" to determine IF ELSE decision is not working -

position - Python "Option" to determine IF ELSE decision is not working - i'm trying write programme moving position. below here code. def robot(): = input("please come in direction: ") j = input("please come in steps: ") k = int(j) #convert steps input integer x = 0 #x-axis position y = 0 #y-axis position xpos = "" ypos = "" alternative = 1 if (option == 1): if (i == "up"): y += k if (y > 0): steps = str(y) print ("i " + steps + " steps above") elif (y < 0): steps = str(y) print ("i " + steps + " steps below") alternative = input("1 go on moving, 0 terminate: ") elif (i == "down"): y -= k if (y < 0): steps = str(y) print...

javascript - how to load a hyperlink ontop of an image -

javascript - how to load a hyperlink ontop of an image - creating basic html page, should show logo banner, hyperlink on bottom right of logo. iframe page. storing image , iframe within 2 seperate divs, set within div. problem when seek add together time, loads below image, , iframe sits ontop of blocking out. have tried z index , messing divs...any ideas? <!doctype html> <head> <title>interactive map - meath field names project</title> <style> *{margin:0;padding:0} html, body { height:100%; width:100%; overflow:hidden; background-color:#e0dedf; } iframe { height:100%; width:100% } .content { width: 100%; height:90% } .logoheader { width: 100%; height: 10%; } .fullpage { height:100%; width: 100%; } .hlink { z-index: 1; color:#acd0d4; ...

php - Update Record with PDO keep getting an error -

php - Update Record with PDO keep getting an error - i trying update row or record , maintain getting error: parse error: syntax error, unexpected '$sql' (t_variable) in c:\wamp\www\systems\update_process.php on line 11 i'm not sure how go fixing tried many things. <?php $db_host = "localhost"; $db_username = "root"; $db_pass = ""; $db_name = "systems_requests"; try{ $db = new pdo('mysql:host='.$db_host.';dbname='.$db_name,$db_username,$db_pass); $db->setattribute(pdo::attr_errmode, pdo::errmode_warning) $sql = 'update requests set lanid= :lanid, name= :name, department= :department,manager= :manager,request= :request,request_description= :request_description, request_comments= :request_comments,status= :status,comments= :comments,compuser= :compuser, compdt= :comdt id= :id'; $stmt = $pdo->prepare($sql); $stmt->bindparam(':id', $_post['lanid'], pdo::param_int); ...

c# - Zoom in at touch point -

c# - Zoom in at touch point - i have canvas 4048x8096, when seek zoom in, doesn't zoom in @ gesture point, moves towards point(0,0) canvas's position, here code i'm using: flickers when zoom limits reached. private void graphsurface_manipulationdelta(object sender, system.windows.input.manipulationdeltaeventargs e) { var matrix = ((matrixtransform)this.rendertransform).matrix; point center = new point(this.actualwidth / 2, this.actualheight / 2); center = matrix.transform(center); if (scale <= zoominlimit && scale >= zoomoutlimit) { matrix.scaleat(e.deltamanipulation.scale.x, e.deltamanipulation.scale.y, center.x, center.y); } if (scale > zoominlimit) { matrix.m11 -= 0.001; matrix.m22 -= 0.001; } else if (scale < zoomoutlimit) { matrix.m11 = zoomoutlimit + 0.001; matrix.m22 = zoomoutlimit + 0.001; } ...

Detecting empty string when decoding byte array into unicode? (Python) -

Detecting empty string when decoding byte array into unicode? (Python) - i'm trying read array of bytes character character , decode unicode string, below: current_character = byte_array[0:1].decode("utf-8") for each character, i'm trying check whether result of .decode("utf-8") equals empty string, can't seem able observe this. when print out result of decoding, empty string. how translate detection code? i've tried: if not current_character if current_character u"" but both don't work. suggestions? try this: if current_character == '': print('empty string') python unicode

sql - Error Code: 1452. Cannot add or update a child row: -

sql - Error Code: 1452. Cannot add or update a child row: - a foreign key constraint fails ( ldatabase . book , constraint bpid foreign key ( bpid ) references publish ( pid ) on delete no action on update no action) insert ldatabase . book ( bid , title , author , bpid , available , language ) values (20, 'dsp', 'kevin', 01, 10, 'eng') i have created tables , inserted values publish table.. when trying come in values book table .. due misfortune have encountered error posted error indicates that, column bpid in table ldatabase.book has foreign key relationship publish table pid column. which means, before insert bpid key in book table create sure same key ( pid ) exists in publish table else end above posted error. sql

R Logistic regression on ffdf objects -

R Logistic regression on ffdf objects - i have built logistic regression model using glm function stats package. predict outcome of model on big number of values, stored in "ffdf" object (see ff package), not find how proceed: how can create subset of ffdf object, in order maintain variables (i.e. columns) used in prediction? - needed specify input in predict function how should proceed next? function should used between predict(), predict.glm(), predict.bigglm() (maybe biglm bundle helpful)? thank in advance views on this! best regards update thank feedback bondeddust. allow me more precise, indeed coding question, aiming @ performing logistic regression based on ffdf object (learning dataset), , predict outcome of model ffdf object (test dataset). (1/3) learning info set: ffdf object (created ff package). ` class(train.random.sample)` > [1] "ffdf" below construction of ffdf object in case of needs: `str(train.random.sa...

java - ConstraintViolationException JPA -

java - ConstraintViolationException JPA - i'm trying add together info database using jpa entity @sequencegenerator. appears genereator doesnt expected , have no clue why. hibernate: phone call next value seq1 hibernate: insert client (firstname, surname, code, customertype, id) values (?, ?, ?, ?, ?) 13:20:36,078 error sqlexceptionhelper:147 - integrity constraint violation: not null check constraint; sys_ct_10093 table: client column: first_name heres model class : @entity public class client { @id @sequencegenerator(name = "my_seq", sequencename = "seq1", allocationsize = 1) @generatedvalue(strategy = generationtype.sequence, generator = "my_seq") private long id; public string firstname; public string surname; public string code; public enum customertype{private, corporate}; @enumerated(enumtype.string) public customertype customertype; servlet phone call save method protected void doget(httpservletrequest request, htt...

c# - DataGrid auto scrolling when doing selection -

c# - DataGrid auto scrolling when doing selection - i have custom datagrid, in datagrid alter way select element. have feature added selection, : when select element, it's "ctrl" key press. when click on selected row, row become unselected. when multiple selection, row alter selectedvalue 1 first row going have. when multiple selection (mouse down, move, mouse up) right click it's reversing selected value of rows. it's datagrid extension, coding in c#. for doing added event handle on previewmousedown , mouseup of datagridrow. private enum buttonclicked {left, middle, right}; private buttonclicked m_omousebuttonclicked; private void previewmousedownhandler(object sender, mousebuttoneventargs e) { datagridrow row = sender datagridrow; if (e.leftbutton == mousebuttonstate.pressed) { row.isselected = !row.isselected; m_omousebuttonclicked = buttonclicked.left; } ...

html - Phonegap, onscreen keyboard on iOS is shifting my content -

html - Phonegap, onscreen keyboard on iOS is shifting my content - i have phonegap app basic layout controlled translating divs when items clicked. shortened version looks this: html <body> <h1 class="main"> market coffee cart </h1> <div class="app"> <div id="home" class="page"> <p> welcome market coffee cart</p> <!-- <div class="lefthalf"> login</div> --> <div class="guestlogin"> go on guest</div> </div> <!-- kind --> <div id="itemtype" class="page right"> <p>what order?</p> <div id="coffee" class="type"> coffee </div> <div id="tea" class="type"> tea </...

excel vba - Why is this macro copying multiple times? -

excel vba - Why is this macro copying multiple times? - i found macro , need whenever it's activated seems copy/paste info multiple times. master list should have 75 or lines , when runs ends @ 268. why doing that? also, there way edit if sheet has no info in after "a1" doesn't re-create sheet? option explicit private sub worksheet_activate() 'merge sheets in workbook 1 summary sheet (stacked) dim cs worksheet, ws worksheet, lr long, nr long application.screenupdating = false set cs = sheets("master list") cs.activate range("a2:f" & rows.count).clearcontents each ws in worksheets if ws.name <> "master list" nr = cs.range("a" & rows.count).end(xlup).row + 1 lr = ws.range("a" & rows.count).end(xlup).row ws.range("a2:f" & lr).copy cs.range("a" & nr) end if next ws application.screenupdating = true end sub you hav...

'try catch' reconstruction from java 1.7 to java 1.6 -

'try catch' reconstruction from java 1.7 to java 1.6 - i using jar file other person, need add together source codes in project , compile them when import such packages. issue jar file seems generated java1.7 uses java1.7 fetures. using java1.6 . source codes: public properties getdefaults() { seek (inputstream stream = getclass().getresourceasstream(property_file)) { properties properties = new properties(); properties.load(stream); homecoming properties; } grab (ioexception e) { throw new runtimeexception(e); } } the eclipse gives such error hints: resource specification not allowed here source level below 1.7 then how rewrite such codes can handled java1.6 ? to re-write try-with-resource statement compatible java 1.6, following: declare variable before try block begins. create variable @ top of try block. add finally block close resource. example: inputstream stream = null; s...