« first day (2196 days earlier)      last day (2753 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
 So, who knows about SQLite and encodings? I'm using Microsoft.Data.Sqlite on .NET Core (on Debian) to read a bunch of stuff from a SQLite database. The problem is that non-ASCII characters are getting mangled. I suspect it's because SQLite stores characters in UTF-8, but C# expects UTF-16. For example:
    Cronómetro should have the bytes 43 0 72 0 6F 0 6E 0 F3 00 6D 0 65 0 74 0 72 0 6F 0
    But it comes out as 43 0 72 0 6F 0 6E 0 FD FF 6D 0 65 0 74 0 72 0 6F 0
Any thoughts?
 
I know SQLite supports both 8 and 16
could be an issue with the new library
 
Yeah. The database I'm attaching to comes in UTF-8, and you can't change that.
There's a SQLite way to open as utf-16. Maybe that's what I want.
I'm not sure if there's a easy way to fix this. I'm starting to think sqlite3_open16 just interprets the filename as utf-16 and doesn't actually affect that database encoding.
So now it's "how do you get C# to unmangle the string"
 
what's your reader code?
IIRC SqlDataReader returns strings
so it's already mangled at that point
 
And the bytes there are how it comes out of the function.
And digging around in the NativeMethod guy, I'm pretty sure they're using UTF8 all the way down.
I'm thinking I should file a Github issue with them.
 
5:27 PM
@CuddleBunny well I figured out one thing, the swf file seems to have 8 extra bytes in one of its tags, and I have NO idea what they are for. The tag in question is the Define_Font3 Tag, Defined here http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf Page 166.

the extra bytes after reading all the data are as follows: 04 56 A0 19 A4 1F 00 00 7F
 
maybe an embedded font for east asian characters?
 
wouldnt it explain that though?...
It grabbed the font name correctly I think hmmm... let me double check that though
 
is this in the output or input?
 
Input file has this extra data
which seems to be breaking everything
 
if you strip it out does it still play?
 
5:31 PM
Il see... But I think flash has some stupid CRC thing where it wont run unless the file is a certain size...
So how should I strip it? Null it?
 
yeah, null it
 
hmmm
I dont notice anything weird :S
 
it might be hard to identify unless you're used to east asian characters, but try going to any parts of the video that you might've noticed had different fonts
 
well the intro only has 1 font
Nulling those bytes didnt break the file though
unlike
when I write the file... which seems to be grabbing the wrong bytecodes so Il be looking into that now and see if its not reading file correctly at the earlier points
Like how bytecode 26 becomes 06 in places
4D becomes 23 and 1c became 14
 
do all occurances of 26 become 06?
 
5:39 PM
No which makes me thing its the header for tags
page 38 of that adobe pdf
 
I wonder if the library is changing the tags
 
no idea what header 06 is though... :S
 
do swfs need signed in any way by the compiler?
 
I believe they just require the length/size of the swf in the header
the the 4th to 7th bytes i think
 
could you roll your own code to write the header properly?
shouldn't be that hard and you can still leverage the library you were using, just re-write the header portion once it is done
 
5:43 PM
I gotta rewrite alot of that library... since It wont actually let me change the bytes lol
or im using it wrong lol
but I cant get access to the Tags[].Statements[].values to change them...
specially with foreach loops like I was using
... err gotta check something important now lol
nvm.. Still trying to track down why its changing the byte to 06 from 26 If im even in the right place... I guess I could follow the dam thing in memory while it writes each byte... and open it in hex editor while its writing the file..
 
if you manually change those bytes back in the output does it play?
 
It breaks halfway through due to the broken tag that has extra data
basically I cant find out whats different past that point
hmm il try opening it using my other decompiler
Jpexs decompiles the broken one, I can take a better look at what happens to it now :D
 
cool
 
so the broken file is missing the 2nd set of fonts...
Wonder if swf2xna is not correctly reading the Tag Length for the font maybe?
 
maybe
 
6:01 PM
Is there anyway to import java code into C# lol Then I can just use Jpexs Code to decompile and recompile a swf file...
 
does jpexs have a CLI?
 
CLI?
 
command line
 
dont think so
 
probably not easily then
 
6:03 PM
Also I still think its broken due to the definefont3
I just noticed the original has a japanese font embedded in it.
 
doubt it, but maybe it is a font licensing issue?
yeah, the swf couldn't show those chars without the font embedded
 
the one passed through swf2xna has a Massive ErrorTag and no font...
 
do the errortags have messages?
 
nope
 
fun...
 
6:05 PM
all I get is Tag Type 75, Offset (location in hex) and the length which is massive...
goes from 0x00093FAB to 0x0030de8d
 
what is the contents of that range?
might be a message in there
 
just about to look at it in hex editor
yeh the errortag is the broken font for sure
Im looking at half of the fonts name
 
perhaps swf2xna doesn't support fonts or some subset of the swf font features?
 
Possibly I think its due to the Jap Name though
 
most likely
 
6:09 PM
welp now i get to look into it again :D
 
but if that was the problem it would probably also be mangling the rest of the text
 
how so?
the other font is english
M+ 2c bold
 
like if the name of the font is in east asian characters and it doesn't like that it would probably not like the same characters in the text fields
 
but it seems to handle language codes
 
but I guess it could just be the fonts stuff. Maybe the dev made an assumption that font names are all ascii
 
6:12 PM
thats what i thin
i hope at least lol
Does anyone have a Link to a site that Converts Hex to Text With multiple Choices for Text Encoding
nvm found one that works. Also heres the font type that its dealing with 小塚ゴシック Pro B
 
is mvc5 identity role based access and built in encryption good enough?
 
@Skullomania good enough for me
@JasonBrown might be an adobe licensed font
 
well Thats what il look into after I examine this...
since its just using string variable which I dont believe supports unicode...
 
string does not support unicode?
 
6:27 PM
@CuddleBunny do you feel it will be secure enough to protect credit or patient information?
 
@Skullomania you can probably make it secure enough, but aren't there government regulations for that sorta thing?
 
there are...I really am just looking for best practices
 
6:47 PM
it is definitely more secure than rolling your own
 
Does this linq make sense?
var offer = deal.DealName == "All Offers"
			? offers : deal.DealName == "Saved"
			? offers.Where(o => o.IsSelected == true): offers.Select(x => x.Categories) != null // want to add a null check for categories
			? offers.Where(o => o.Categories.Contains(deal.DealName)) : Enumerable.Empty<Offer>();
 
get those nested ternaries outta my face
 
hiss
Nested ternaries are the devil's work. — mikeTheLiar Aug 9 at 14:13
 
it's still returning offer with null category
I want it to return an empty list if the category is null
 
seriously, who did that nested ternary crap
 
7:04 PM
I didn't... a coworker did
I need to add a null check to it though and I think it's not working
 
@KalaJ squirt him with a spray bottle
 
Here's my second attempt to add the null check but still adds the null offer
var offer = deal.DealName == "All Offers" ? offers : deal.DealName == "Saved" ? offers.Where(o => o.IsSelected == true) : offers.Where(o => o.Categories.Contains(deal.DealName));

if(String.IsNullOrEmpty(offer.Select(x=>x.Categories).ToString())) {
	offer.Where(x => x.Categories != null).ToList();
}
Unfortunately, we originally outsourced this project and all the code is terrible
The team is no longer with us
 
7:16 PM
Why not use FirstOrDefault?
 
When you say "no longer with us" you mean that you had them all executed for writing truly awful code, right?
 
They were forced to swim home and never sent in a Holiday pay request
 
I love how Kala asked a question that we're all ignoring because we hate nested ternaries so much
s/china/mexico/
 
what is the easiest way to truncate a decimal at a certain decimal point? eg. 12.3498747 if you truncated at 2 digits would become 12.34. looking for a better way than converting to a string then back.
 
s/mexico/in the fevered dreams of a madman/
 
7:28 PM
Sooo I found my issue with the stupid Encoding
 
@im1dermike do you want rounding or just truncation?
 
the latter
 
68
A: Truncate Two decimal places without rounding

Hans Passantvalue = Math.Truncate(100 * value) / 100; Beware that fractions like these cannot be accurately represented in floating point.

 
How Can I fix this code so it doesnt break on 2 byte char's

public string GetString(uint len)
        {
            Align();
            uint start = pos;
            char c = (char)bytes[pos++];
            while ((byte)c != 0)
            {
                c = (char)bytes[pos++];
            }
            uint end = pos;
            pos = start;
            string result = utf8Encoder.GetString(bytes, (int)start, (int)len - 1);
            pos = end;

            return result;
 
!!tell jason format
 
7:30 PM
@jason Format your code - hit Ctrl+K before sending and see the faq
 
Bytes :\
 
amazing
thanks!
 
sry I cant fix that stupid thing...
Formating on here hates me :(
 
Hi
Maybe someone know an easy way to assign dropdown list selected item to <input> in mvc6?
 
utf8Encoder.GetString is what throws the error?
 
7:34 PM
nvm it is returning the correct string...
fml I dont now whats breaking in this stupid swf2xna library, And My swf file Has some random Junk bytes in places that seem to do nothing but break things :S
 
Selected Item to an Input? on the DOM?
or to the controller
 
to the controller
 
@TravisJ Hi Travis. I would up using the Group method, sorting, and then selecting the top 1. The solution did not perform well enough though, so I rewrote it as a proc using CTEs. This was too slow too, so I rewrote it again using table variables. That was only marginally quicker. Switching to temp tables did the trick, cutting run time from 2 min 50 sec to 15 sec. Funny I had always found table variables to be quicker than temp tables. Maybe it being on Azure SQL made the difference.
 
Basically there is a form where u need to select one of the items from dropdown list or write it urself in input field
 
dropdown should have a name that is passes as the query string value
 
7:39 PM
I'm trying to break it down and I'm confused by the logic.
Part of that code return a bool LOL
Here's the original code:
var offer = deal.DealName == "All Offers" ? offers : deal.DealName == "Saved" ? offers.Where(o => o.IsSelected == true) : offers.Where(o => o.Categories.Contains(deal.DealName));
How can I break out the second half?
I tried and it returns a bool and not a collection of that offer ?
 
@PaulJ are you required to use mvc6?
 
This is how I'm breaking up the second half:
 IEnumerable<Offer> offer;
            var offerList = new List<Offer>();

            if (deal.DealName == "All Offers")
            {
                offer = offers;
            }
            else
            {
                offer = Enumerable.Empty<Offer>(); //Not sure if this is expected???
            }

            foreach (var item in offer)
            {
                if (item.Categories != null)
                {
                    var savedOffer = deal.DealName == "Saved" ? item.IsSelected == true : item.Categories.Contains(deal.DealName); //returns bool when it should return
 
@juanvan yes, we try to implement some small projects in asp.net core
 
item.IsSelected == true hiss
 
doing some demo's in CORE
 
7:42 PM
@mikeTheLiar can't do that, dropdown list values comes from injectable service
 
s/== true//g
 
so it`s not in a ViewModel
 
I think you mean to reply to someone else because I haven't been following your issue
 
Sorry I added more details
 
@mikeTheLiar oh :D
 
7:43 PM
But that's my attempt at breaking down that nested ternary
 
@KalaJ that line that you're confused about can be re-written as:
if(deal.DealName == "Saved)
{
      savedOffer = item.IsSelected;
}
else
{
    savedOffer = item.Categories.Contains(deal.DealName);
}
 
Hi guys. I am working with an EF6 edmx, and the Update Model from Database Wizard is coming up without any objects. I verified the connection string in SSMS and recreated it on the edmx.
 
That's better
@KalaJ does that help at all?
It's returning a bool because, well, it's returning a bool
 
@ChristopherJ.Grace - I could have told you all of that was not going to be high performance lol
Hopefully you got in some good learning figuring it out
 
So SavedOffer should be a bool?
 
7:47 PM
Perhaps you meant any instead of Where in your && clause?
 
@TravisJ I definitely did. It was my first serious use of Linq with EF for db access.
 
@ton.yeung make sure you send her an invoice :)
 
I guess what I mean is... I'm not understanding the second half of this ternary
var offer = deal.DealName == "All Offers" ? offers : deal.DealName == "Saved" ? offers.Where(o => o.IsSelected == true) : offers.Where(o => o.Categories.Contains(deal.DealName));
why is there a bool there?
 
@ChristopherJ.Grace - Nice :)
 
@KalaJ ton wrote what I think you want
But look at the code that I posted
 
7:50 PM
I'm having some issues getting my PropertyGrid to edit values. I'm doing this:
internal class Properties {
    private string localLoginName = ConfigurationManager.AppSettings["LocalLoginName"];
    [ReadOnly(false)]
    public string LocalLoginName {get { return localLoginName; } set { localLoginName = value; }}
}
Properties properties = new Properties();
PropertyGrid propertyGrid = new PropertyGrid();
propertyGrid.SelectedObject = properties;
private void Save() { Console.Log(properties.LocalLoginName) }
And the Console.Log prints the default value, even after I edit it.
 
@ton.yeung ok but the if for saved isn't working
cannot apply operand && to bool and IEnumerable
 
@KalaJ - Are you refactoring or just trying to grok?
 
ohh
you're right
Thanks
it's because I had it in my foreach. Opps
oh wait not, still have the same error
 
@KalaJ - Yes, the if statement is flawed.
It requires an else.
all: offers
saved: offers.where(bool)
default: offers.where(contains(deal))
 
@TravisJ Thank you. I got it :)
 
7:57 PM
:)
 
This is what the wizard looks like
<a href="http://imgur.com/yDtxYLO"><img src="http://i.imgur.com/yDtxYLO.png" title="source: imgur.com" /></a>
 
I'm following this tutorial, which seems to indicate that the above is how to do a property grid. Is there a better way?
 
Aha! That's how you post an image :)
 
lol
 
Yeah, either hit upload, or post it in a message by itself with the right file extension on it.
 
8:00 PM
@ChristopherJ.Grace - I don't work with stored procs
 
Yeah, this is something wrong with the EF designer in Visual Studio. It's not showing any of the tables or anything that's in the db.
 
What if you login with those credentials to the sql server
 
8:15 PM
urgh guys need help with the same thing
 IEnumerable<Offer> offer;

            foreach (var item in offers)
            {
                if (item.Categories != null)
                {
                    if (deal.DealName == "All Offers")
                    {
                        offer = offers;
                    }
                    else if (deal.DealName == "Saved")
                    {
                        offer = offers.Where(x => x.IsSelected == true);
                    }
                    else
                    {
I need to use offer outside of the foreach (after the foreach but it's not recognized... it says it has not been assigned?)
 
You shouldn't be doing this in a foreach loop
 
You'd need to define offer outside of the foreach and then it'll store the value of the last iteration of the foreach but yeah, that seems really weird to do in a foreach.
 
IEnumerable<Offer> offer;
switch(deal.DealName)
{
 case "All Offers": offer = offers; break;
 case "Saved": offer = offers.Where(x => x.IsSelected); break;
 default: offer = offers.Where(o => o.Categories.Contains(deal.DealName));
}
 
okay I'll test your changes but I got it working with mine. I just forgot to set offer = new List<Offer>();
I need the foreach because I need to do a null check against categories
in case an offer does not have a category
@TravisJ ^
Also control can't fall out of switch from default?
 
Yup. Any case not handled explicitly will hit the default.
 
8:45 PM
@juanvan The same credentials work fine when copied and pasted into SSMS.
 
@KalaJ - So in your foreach example, you were constantly overwriting the offer variable. Is there supposed to be a set of offer sets, or just one offer set? I ask this, because the question "null check against categories" seems to refer to individual offers in the set that do not have categories.
 
ugh FTP/IIS
 
thinking out loud...our team has a Sharepoint they use for a holiday calender and storing meeting minutes documents. It seems under utilized besides these use cases.

What are some cool things I could do leveraging Sharepoint to improve processes and the like? They are a team supporting DB platform and application operations
I was thinking using the connector to connect to one of their DB's and pull up some useful KPI's on the Sharepoint landing page
that would give them a quick glance at how operations were running that day
 
Most people do not utilize calendar features regardless of how well built they are.
I think it may not be the best way to spend your time.
 
the coolest thing to do with sharepoint is killing it
 
8:52 PM
lol
They use the calendar and storage for documents on the site. But I was thinking of using the site for something other than the calendar, ya dig?
 
no, i dont. lol
been there done that man
just dont do it
 
so people would engage more with the site
 
if you have to... sorry!
 
why is it that bad?
 
maybe a year from now you will be out of sharepoint hell
when i jumped shipped, my new company doesnt use sharepoint. love it.
sharepoint just sucks man. i guess im biased, but i KNOW there are a ton of ppl in here that also detest it
i think most devs do
to get it to do anything you have to hack the shit out of it and it takes waaaay too much time.. it still doesn't really work right, etc
 
8:55 PM
ah ok
It's kind of the team site though
so I'd like to make a mark on it..in a positive way if possible :P
 
thats fine
i totally get it
i did too
 
and did it work out?
 
then a year later it was still just a pile of shit nobody REALLY used and it stressed me out greatly
i left the company
 
it's not my main job, I'd like to mess with it i spare time
*in
 
and they abandoned the project (because they knew SP sucked and now had nobody else stupid enough to engage with it)
it wasnt my main thing either
but started taking up more time cuz it was so shitty
thats just my experience tho
you know anything about setting up FTP? i got a server on our network i need to send files to via FTP from a win CE app
but im not sure how to authenticate with the server. idk how to setup a username/password in IIS/FTP server
 
9:00 PM
nope never set it up
.
 
oh wait think i just got it
 
I just run to the the server
and plop it in
 
I've been using SP more and more with Office 365. The document libraries integrate with so many other Microsoft products. Now there is Delve and the Office Graph that provide conveniences such as knowing which file you want to attach when using Outlook. The Office Graph data is also an important data source for calculating performance KPIs.
I was with one company that used it extensively. They got great value out of the workflows. It was their go-to tool for process automation.
I was at another company that used it for internal department websites. That was fine, but it's capable of so much more. Talk to a Microsoft SharePoint gold partner. Many use it as a RAD tool.
Absolutely it can be frustrating (OneDrive for Business has been an incredible time hog for me) But it continually improves. The new sync client is supposed to support sp doc libraries any day now.
 
9:25 PM
@TravisJ Sorry, I was trying to do the same thing as what the ternary below was doing, which I believe was returning a single set of offers?
var offer = deal.DealName == "All Offers" ? offers : deal.DealName == "Saved" ? offers.Where(o => o.IsSelected == true) : offers.Where(o => o.Categories.Contains(deal.DealName));
However, I just need to add a null check for categories because the code breaks when it is null
I want to remove the null item from the collection
 
@KalaJ - Oh, just preface that with offers = offers.Where(o => o.Categories != null);
 
that?
the ternary above you mean?
 
That referring to the ternary (or switch, or whichever solution chosen).
 
which is cleaner? the switch or ternary? Lol
 
I think the ternary is fine.
It could help to format it a little though
var offer = deal.DealName == "All Offers" ? offers :
    deal.DealName == "Saved" ? offers.Where(o => o.IsSelected == true) :
    offers.Where(o => o.Categories.Contains(deal.DealName));
 
9:37 PM
Thanks, was obvious.... I think I tried to do something similar but wasn't working, so I make it more complex
This was my original attempt:
var offer = deal.DealName == "All Offers"
			? offers : deal.DealName == "Saved"
			? offers.Where(o => o.IsSelected == true): offers.Select(x => x.Categories) != null // want to add a null check for categories
			? offers.Where(o => o.Categories.Contains(deal.DealName)) : Enumerable.Empty<Offer>();
But I guess I might have messed something up because it wasn't working
 
Yeah that syntax is incorrect for the != null
 
ah got it
 
Also, small nitpick, .Where(o => o.IsSelected == true) is the same as .Where(o => o.IsSelected).
Another point to make, is that if you have offers, and use a clause that returns 0 results, it will be the same as Enumerable.Empty<Offer>()
For example, offers.Where(o => false) is the same as Enumerable.Empty<Offer>()
 
ohh I see
 
Using .Select creates a projection, and will return a set of Categories when used with .Select(x => x.Categories). Instead of offers.Select(x => x.Categories) != null you could have used offers.Any(o => o.Catgeories != null).
Which would return a boolean stating that at least one offer had categories populated
However, I don't think that your "original attempt" was as good as the other one paired with the pre screening of categories.
 
10:14 PM
If anyone was super invested in my problem earlier, the problem is that the database was not in UTF-8 and instead had older encoding going on.
 
10:48 PM
@TravisJ, yup, makes sense. I went with the prescreening. It's more concise and consistent with what I want to do. Thank you so much!
As a side note, if you're not a Microsoft MVP, please let me know if you want me to nominate you haha
 
@KalaJ - You're welcome :) I don't think I have enough contribution to qualify as an MSMVP, but that is kind of you to say
 
Your contributions on Stack Overflow are noteworthy
 
I need a help in asp.net sitemap. Is there any one who can help?
 
Besides, I think that in order to be an MSMVP you need to release your full name and whatnot. I enjoy my low profile online presence :)
 
10:57 PM
Haha yeah you do. Maybe later down the road :)
 
@Peck_conyon - A sitemap? xml-sitemaps.com ?
 
breadcrumb
 
@KalaJ - Although, to be honest, I have always wanted to attend those msmvp invite only events. All the cool people are there! :)
 
@TravisJ breadcrumb
 
@TravisJ I can only imagine!
 
11:01 PM
@Peck_conyon - Oh, I get it. That is your response to the suggested site that will crawl your site and create a sitemap. Uhm, let me see, something in terms of your responses... how about "needle" (ref: needle in a haystack). Going to need to give more information than "help in asp.net sitemap" to get anything more than breadcrumbs.
@KalaJ - The channel 9 interviews are usually pretty awesome too
 
Yes, they are. I need to watch more of them. Haven't been keeping up. I've been focused on Xamarin, haven't noticed if there's anything new about .NET Core or Standard out yet
When is C# 7.0 coming?
 
On a side note, I got my echo dot today to play with.
 
@Peck_conyon - Nice, tons of detail. I think the example in this msdn article should help you develop the sitemap provider msdn.microsoft.com/en-us/library/…
@KalaJ - I am not sure when 7 is planned to be released ( I am sure google knows but I didn't bother :), what is echo dot?
 
Alexa voice controlled smart device. You can ask Alexa to turn on/off lights, play music, etc..
I was hoping to work on adding a new "skill" when I get the time.
 
11:11 PM
Ahh
hmm, very IoT
 
00:00 - 17:0017:00 - 00:00

« first day (2196 days earlier)      last day (2753 days later) »