<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[cbm.dev]]></title><description><![CDATA[cbm.dev]]></description><link>https://cbm.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 02:58:52 GMT</lastBuildDate><atom:link href="https://cbm.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Create api for user on Pterodactyl]]></title><description><![CDATA[In ApiKeyController add: In api-client add: In the pterodactyl panel disable captcha]]></description><link>https://cbm.dev/create-api-for-user-on-pterodactyl</link><guid isPermaLink="true">https://cbm.dev/create-api-for-user-on-pterodactyl</guid><category><![CDATA[pterodactyl]]></category><dc:creator><![CDATA[Christian Buchhave Mortensen]]></dc:creator><pubDate>Mon, 14 Jul 2025 08:14:05 GMT</pubDate><content:encoded><![CDATA[<p>In ApiKeyController add:</p>
<pre><code class="lang-php"><span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">storeforuser</span>(<span class="hljs-params">StoreApiKeyRequest $request, <span class="hljs-keyword">int</span> $userId</span>): <span class="hljs-title">array</span>
    </span>{
        $user = User::find($userId);
        <span class="hljs-keyword">if</span> (!$user) {
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> DisplayException(<span class="hljs-string">'User not found.'</span>);
        }   
        <span class="hljs-keyword">if</span> ($user-&gt;apiKeys-&gt;count() &gt;= <span class="hljs-number">25</span>) {
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> DisplayException(<span class="hljs-string">'You have reached the account limit for number of API keys.'</span>);
        }

        $token = $user-&gt;createToken(
            $request-&gt;input(<span class="hljs-string">'description'</span>),
            $request-&gt;input(<span class="hljs-string">'allowed_ips'</span>)
        );

        Activity::event(<span class="hljs-string">'user:api-key.create'</span>)
            -&gt;subject($token-&gt;accessToken)
            -&gt;property(<span class="hljs-string">'identifier'</span>, $token-&gt;accessToken-&gt;identifier)
            -&gt;log();

        <span class="hljs-keyword">return</span> <span class="hljs-keyword">$this</span>-&gt;fractal-&gt;item($token-&gt;accessToken)
            -&gt;transformWith(<span class="hljs-keyword">$this</span>-&gt;getTransformer(ApiKeyTransformer::class))
            -&gt;addMeta([<span class="hljs-string">'secret_token'</span> =&gt; $token-&gt;plainTextToken])
            -&gt;toArray();
    }
</code></pre>
<p>In api-client add:</p>
<pre><code class="lang-php">    Route::get(<span class="hljs-string">'/api-keys'</span>, [Client\ApiKeyController::class, <span class="hljs-string">'index'</span>]);
    Route::post(<span class="hljs-string">'/api-keys'</span>, [Client\ApiKeyController::class, <span class="hljs-string">'store'</span>]);
    Route::post(<span class="hljs-string">'/api-keys/user/{userId}'</span>, [Client\ApiKeyController::class, <span class="hljs-string">'storeforuser'</span>]);
    Route::delete(<span class="hljs-string">'/api-keys/{identifier}'</span>, [Client\ApiKeyController::class, <span class="hljs-string">'delete'</span>]);
</code></pre>
<p>In the pterodactyl panel disable captcha</p>
]]></content:encoded></item><item><title><![CDATA[Parsing multi dimensional json in classic asp]]></title><description><![CDATA[Had to do some new stuff to our old classic asp site. Wrote a SQL query which returned json, this had to be parsed and put into a Google graph component…]]></description><link>https://cbm.dev/parsing-multi-dimensional-json-in-classic-asp</link><guid isPermaLink="true">https://cbm.dev/parsing-multi-dimensional-json-in-classic-asp</guid><category><![CDATA[ASP]]></category><category><![CDATA[json parser]]></category><dc:creator><![CDATA[Christian Buchhave Mortensen]]></dc:creator><pubDate>Thu, 04 Apr 2024 11:22:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1712304292625/1d9cd712-304b-4d85-adce-fc024e7f3794.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Had to do some new stuff to our old classic asp site. Wrote a SQL query which returned json, this had to be parsed and put into a Google graph component.</p>
<p>Spent a shit load of time to get to know aspJson and figure out how to get my data.</p>
<p>This is what worked</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"places"</span>: [
        {
            <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>,
            <span class="hljs-attr">"total"</span>: <span class="hljs-number">38</span>,
            <span class="hljs-attr">"cols"</span>: [
                {
                    <span class="hljs-attr">"webbooking"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"walkin"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"beskrivelse"</span>: <span class="hljs-string">"Manual"</span>,
                    <span class="hljs-attr">"frasenavn"</span>: <span class="hljs-string">"manual"</span>,
                    <span class="hljs-attr">"farve"</span>: <span class="hljs-string">"#3366cc"</span>,
                    <span class="hljs-attr">"results"</span>: <span class="hljs-number">21</span>,
                    <span class="hljs-attr">"personer"</span>: <span class="hljs-number">1093</span>,
                    <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>
                },
                {
                    <span class="hljs-attr">"webbooking"</span>: <span class="hljs-literal">true</span>,
                    <span class="hljs-attr">"walkin"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"beskrivelse"</span>: <span class="hljs-string">"Online"</span>,
                    <span class="hljs-attr">"frasenavn"</span>: <span class="hljs-string">"online"</span>,
                    <span class="hljs-attr">"farve"</span>: <span class="hljs-string">"#109618"</span>,
                    <span class="hljs-attr">"results"</span>: <span class="hljs-number">12</span>,
                    <span class="hljs-attr">"personer"</span>: <span class="hljs-number">62</span>,
                    <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>
                },
                {
                    <span class="hljs-attr">"webbooking"</span>: <span class="hljs-literal">true</span>,
                    <span class="hljs-attr">"walkin"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"beskrivelse"</span>: <span class="hljs-string">"Reference"</span>,
                    <span class="hljs-attr">"frasenavn"</span>: <span class="hljs-string">"google_my_business"</span>,
                    <span class="hljs-attr">"farve"</span>: <span class="hljs-string">"#ea4335"</span>,
                    <span class="hljs-attr">"results"</span>: <span class="hljs-number">2</span>,
                    <span class="hljs-attr">"personer"</span>: <span class="hljs-number">5</span>,
                    <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>
                },
                {
                    <span class="hljs-attr">"webbooking"</span>: <span class="hljs-literal">true</span>,
                    <span class="hljs-attr">"walkin"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"beskrivelse"</span>: <span class="hljs-string">"Reference"</span>,
                    <span class="hljs-attr">"frasenavn"</span>: <span class="hljs-string">"facebook"</span>,
                    <span class="hljs-attr">"farve"</span>: <span class="hljs-string">"#3c5a98"</span>,
                    <span class="hljs-attr">"results"</span>: <span class="hljs-number">1</span>,
                    <span class="hljs-attr">"personer"</span>: <span class="hljs-number">4</span>,
                    <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>
                },
                {
                    <span class="hljs-attr">"webbooking"</span>: <span class="hljs-literal">true</span>,
                    <span class="hljs-attr">"walkin"</span>: <span class="hljs-literal">false</span>,
                    <span class="hljs-attr">"beskrivelse"</span>: <span class="hljs-string">"Reference"</span>,
                    <span class="hljs-attr">"frasenavn"</span>: <span class="hljs-string">"instagram"</span>,
                    <span class="hljs-attr">"farve"</span>: <span class="hljs-string">"#ed02d9"</span>,
                    <span class="hljs-attr">"results"</span>: <span class="hljs-number">2</span>,
                    <span class="hljs-attr">"personer"</span>: <span class="hljs-number">35</span>,
                    <span class="hljs-attr">"placeid"</span>: <span class="hljs-number">9210</span>
                }
            ]
        }
    ]
}
</code></pre>
<p>This is what I wrote to get the Results row out for each occurence:</p>
<pre><code class="lang-typescript"> oJson.loadJSON(oDb.RS(<span class="hljs-string">"BookingOriginJson"</span>))
            response.write oJson.JSONoutput
            <span class="hljs-keyword">for</span> each place <span class="hljs-keyword">in</span> oJson.data(<span class="hljs-string">"places"</span>)
                <span class="hljs-keyword">for</span> each coldata <span class="hljs-keyword">in</span> oJson.data(<span class="hljs-string">"places"</span>)(place).item(<span class="hljs-string">"cols"</span>)
                    <span class="hljs-string">'for each test in oJson.data("places")(place).item("cols").item(coldata)
                        '</span>response.write(<span class="hljs-string">"&lt;br&gt;"</span> &amp; test &amp; <span class="hljs-string">": "</span> &amp; oJson.data(<span class="hljs-string">"places"</span>)(place).item(<span class="hljs-string">"cols"</span>).item(coldata).item(test))
                        response.write(<span class="hljs-string">"&lt;br&gt;"</span> &amp; oJson.data(<span class="hljs-string">"places"</span>)(place).item(<span class="hljs-string">"cols"</span>).item(coldata).item(<span class="hljs-string">"results"</span>))
                    <span class="hljs-string">'next
                next
                response.write("&lt;br&gt;------------------------------")
            next</span>
</code></pre>
]]></content:encoded></item></channel></rss>